Potential fix for code scanning alert no. 43: Incomplete URL scheme check #734
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.
Potential fix for https://github.com/alienx5499/SortVision/security/code-scanning/43
In general, the fix is to treat
data:andvbscript:schemes the same way asjavascript:when validating or filtering URLs that may come from untrusted or semi-untrusted sources. Any logic that excludesjavascript:URLs from further processing should also excludedata:andvbscript:URLs.Concretely in
SortVision/tests/quality-assurance.mjs, modify theextractInternalPathsFromHtmlfunction so that the scheme check on line 140:is extended to also skip
data:andvbscript:links. To minimize behavioral changes and keep the intent clear, we can simply expand thisifto include additionalstartsWithchecks:This keeps the rest of the function intact and avoids altering any other logic or imports. No new helpers or imports are required; the change is local to this function and just broadens the set of schemes treated as non-navigational/executable.
Suggested fixes powered by Copilot Autofix. Review carefully before merging.