Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JS: Taint propagation from low-level ArrayBuffer to Strings #19231

Merged
merged 14 commits into from
Apr 11, 2025

Conversation

Napalys
Copy link
Contributor

@Napalys Napalys commented Apr 7, 2025

This pull request introduces taint modeling for the most commonly used TypedArray, specifically the Uint8Array, which is primarily utilized in byte-to-string operations. It excludes other TypedArray types, such as Int32Array, as they are generally not associated with taint propagation.

Additionally, this update adds support for ArrayBuffer and SharedArrayBuffer, which are frequently used in low-level operations and are often passed to TypedArray constructors.

Finally, the pull request includes taint propagation for TextDecoder, as it plays a key role in converting ArrayBuffer or TypedArray data into Strings.

@github-actions github-actions bot added the JS label Apr 7, 2025
@Napalys Napalys marked this pull request as ready for review April 7, 2025 16:51
@Copilot Copilot bot review requested due to automatic review settings April 7, 2025 16:51
@Napalys Napalys requested a review from a team as a code owner April 7, 2025 16:51
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This pull request introduces taint propagation for low-level byte-related objects in JavaScript, ensuring that taints are maintained from ArrayBuffer through various TypedArray operations into string conversions.

  • Introduces taint propagation for Uint8Array, ArrayBuffer, and SharedArrayBuffer operations.
  • Adds taint tracking for TextDecoder.decode() and byte-to-string operations.

Reviewed Changes

Copilot reviewed 2 out of 7 changed files in this pull request and generated 1 comment.

File Description
javascript/ql/test/library-tests/TaintTracking/typed-arrays.js Adds tests for taint propagation across different TypedArray and ArrayBuffer operations
javascript/ql/lib/change-notes/2025-04-07-typed-arrays.md Documents the minor analysis update related to taint propagation changes
Files not reviewed (5)
  • javascript/ql/lib/semmle/javascript/internal/flow_summaries/AllFlowSummaries.qll: Language not supported
  • javascript/ql/lib/semmle/javascript/internal/flow_summaries/Decoders.qll: Language not supported
  • javascript/ql/lib/semmle/javascript/internal/flow_summaries/TypedArrays.qll: Language not supported
  • javascript/ql/test/library-tests/TaintTracking/BasicTaintTracking.expected: Language not supported
  • javascript/ql/test/query-tests/Security/CWE-522-DecompressionBombs/DecompressionBombs.expected: Language not supported

Tip: Copilot only keeps its highest confidence comments to reduce noise and keep you focused. Learn more

@Napalys Napalys requested a review from asgerf April 9, 2025 14:15
Copy link
Contributor

@asgerf asgerf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One last comment otherwise LGTM

…rings.qll

Co-authored-by: Asger F <asgerf@github.com>
@Napalys Napalys requested a review from asgerf April 11, 2025 09:25
@Napalys Napalys merged commit 3d7c020 into github:main Apr 11, 2025
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants