JS/PY: do not filter away regular expressions with lookbehinds #6734
Conversation
asgerf
approved these changes
Sep 23, 2021
We still don't include lookbehinds in the NFA construction, so a lookbehind will be seen as a rejection (a state with no outgoing transitions), and if it occurs after the pump this could lead to a spurious rejecting suffix being found.
If we wanted to play it safe I'd say we'd need to add a transition which acts as epsilon during rejecting-suffix construction, and as an unmatchable symbol during the pump.
But like you said, it's hard to think of a realistic scenario where this would happen, so I'm ok with leaving it like this for now.
Maybe add a change note?
I don't think this needs a change note. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.


The new result in the tests appears to be a TP (although I'm not sure, it appears to be an invalid RegExp according to V8).
CVE-2021-3795: TP/TN
The original PR that filtered away lookbehinds was the PR that added support for lookbehinds throughout the JavaScript analysis. But no new tests for ReDoS were added back then, so I'm not sure what the motivation was.
I can't think of a realistic way of causing an FP with this change.
Python evaluation looks OK.
JavaScript evaluation looks OK.
The text was updated successfully, but these errors were encountered: