Repository navigation
Browser scripts: fix the 13 CodeQL alerts (path injection, incomplete escape) - #78
Merged
Merged
Conversation
…d a full regex escape The 12 test/e2e scripts each carried an inline copy of the static server, flagged as js/path-injection by CodeQL (the root-or-inside check was one compound condition). They now share test/e2e/static-server.js: root serves the host page, a path outside the root, with a NUL byte or with bad %-encoding gets a 404 before any file read. soak_e2e.js escapes every regex metacharacter in the section name (js/incomplete-sanitization). Checked by hand: root, asset, missing route, ../ traversal, bad encoding and NUL. CodeQL cannot run locally; the alerts clear when it re-scans after this reaches integration.
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
|
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.
Follow-up to #70, which merged a few hours before this commit was pushed.
CodeQL flags 13 alerts on #32's ref, all in test scripts (none in app code):
js/path-injection: the browser scripts intest/e2e/each carried their own copy of a tiny static server whose root check CodeQL didn't recognize.js/incomplete-sanitizationintest/browser/soak_e2e.js: the regex escape only handled/.What changed:
test/e2e/static-server.jswith sequential guards (bad%-encoding and NUL bytes get a 404, then a resolved-path check against the root). The 12 scripts use it instead of their copies.soak_e2e.jsescapes every regex special character.Checked by hand: the helper serves the host page and assets, falls back to the host page for unknown routes, and returns 404 for
../,%2f, bad encoding and NUL.node --checkon every changed file. I haven't run the browser scripts against a built app, and CodeQL can't run locally, so the alerts only clear when #32 is re-scanned after this lands.Test-only, so no changelog line.