fix: prevent substring false positives in dc.js and Bootstrap scriptSrc rules#269
Open
sybioo wants to merge 2 commits into
Open
fix: prevent substring false positives in dc.js and Bootstrap scriptSrc rules#269sybioo wants to merge 2 commits into
sybioo wants to merge 2 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hi maintainers,
I encountered false positives for both
dc.jsandBootstrapwhen scanning websites built with Framer (e.g.,https://fundraisly.com/). The currentscriptSrcregex patterns lack proper URL path boundary constraints, causing them to match substrings within long hash strings.1. dc.js False Positive
https://framer.com/bootstrap.7bfce40f145f2895acab3198e0c542f6ad79a5dc.jsdc(?:\.leaflet)?\.jsmatches the trailingdc.jsin the hash string...a5dc.jsbecause there is no left-boundary assertion.(?:/|-)beforedcto enforce a valid URL path separator or hyphen boundary.2. Bootstrap False Positive
https://framer.com/bootstrap.7bfce40f145f2895acab3198e0c542f6ad79a5dc.js[^>]*?which was likely intended for HTML<script>tag parsing. However,scriptSrcreceives pure URL strings where>does not exist. This causes[^>]*?to act like.*?, greedily swallowing path separators and matching unrelated trailing characters.(?:/|-)beforebootstrapto enforce strict path boundaries.[^>]*?with[^/]*?to strictly confine the match within the current URL path segment.(?:\\.[\\d]+for better regex accuracy.Modified Patterns:
dc.js (
src/technologies/d.json):"(?:((?:\d+\.)+\d+)\/(?:dc\/)?)?(?:/|-)dc(?:\.leaflet)?\.js\;version:\1"
Bootstrap (src/technologies/b.json):
"(?:/|-)bootstrap(?:[^/]?([0-9a-fA-F]{7,40}|[\d]+(?:\.[\d]+(?:\.[\d]+)?)?)|)[^/]?(?:\.min)?\.js\;version:\1"