Skip to content

JS: Use TaintedUrlSuffix flow label to avoid FPs from $(location.hash)#6433

Merged
codeql-ci merged 6 commits intogithub:mainfrom
asgerf:js/tainted-url-suffix
Aug 12, 2021
Merged

JS: Use TaintedUrlSuffix flow label to avoid FPs from $(location.hash)#6433
codeql-ci merged 6 commits intogithub:mainfrom
asgerf:js/tainted-url-suffix

Conversation

@asgerf
Copy link
Copy Markdown
Contributor

@asgerf asgerf commented Aug 5, 2021

Fixes some FPs where location.hash flows to $() in a non-trivial way that preserves the # prefix.

This introduces the TaintedUrlSuffix flow label as a reusable flow label, although at the moment we only use it for detecting $() injection. The flow label includes most ordinary taint steps in its step relation -- a pattern which originally caused performance issues (materializing a separate copy of the taint step relation). This no longer seems to cause problems, which is possibly due to #5396 having been merged in the meantime, though I haven't verified the exact reason.

Evaluation was uneventful.

@asgerf asgerf added the JS label Aug 5, 2021
@asgerf asgerf requested a review from a team as a code owner August 5, 2021 13:52
Comment on lines +70 to +72
// Substring that is not a prefix
name = ["substring", "substr", "slice"] and
not call.getArgument(0).getIntValue() = 0
or
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Right now we have about 4-5 locations in our code where we handle substring/substr/slice.
I think we could use a common class in StringOps.

Otherwise 👍
But you need to run the autoformatter.

erik-krogh
erik-krogh previously approved these changes Aug 9, 2021
@asgerf
Copy link
Copy Markdown
Contributor Author

asgerf commented Aug 11, 2021

@erik-krogh can you take a quick look at the last commit? (the only one that changed after rebasing)

Copy link
Copy Markdown
Contributor

@erik-krogh erik-krogh left a comment

Choose a reason for hiding this comment

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

@erik-krogh can you take a quick look at the last commit? (the only one that changed after rebasing)

👍

@codeql-ci codeql-ci merged commit 8fe2a43 into github:main Aug 12, 2021
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.

3 participants