JS: Convert qlref tests to inline expectations#22126
Open
owen-mc wants to merge 2 commits into
Open
Conversation
f1eda90 to
de7723f
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR continues the migration of JavaScript QL tests from standalone .expected-only validation toward inline expectation annotations, by adding $ Alert / $ Source / $ Sink / $ SPURIOUS / $ MISSING markers in test code and enabling the inline-expectations postprocessor in .qlref files.
Changes:
- Added inline expectation markers across multiple JS/security/templating test inputs (including HTML comment markers in templates).
- Updated multiple
.qlreffiles to usequery:syntax and enablepostprocess: utils/test/InlineExpectationsTestQuery.ql. - Performed minor formatting adjustments in some test files while adding annotations.
Show a summary per file
| File | Description |
|---|---|
| javascript/ql/test/query-tests/AngularJS/MissingExplicitInjection/missing-explicit-injection.js | Add inline $ MISSING marker |
| javascript/ql/test/library-tests/frameworks/Templating/views/njk_sinks.njk | Add $ Alert markers in template |
| javascript/ql/test/library-tests/frameworks/Templating/views/hbs_sinks.hbs | Add $ Alert markers in template |
| javascript/ql/test/library-tests/frameworks/Templating/views/ejs_sinks.ejs | Add $ Alert markers in template |
| javascript/ql/test/library-tests/frameworks/Templating/views/angularjs_sinks.ejs | Add $ Alert markers in template |
| javascript/ql/test/library-tests/frameworks/Templating/views/angularjs_include.ejs | Add $ Alert markers in include |
| javascript/ql/test/library-tests/frameworks/Templating/CodeInjection.qlref | Enable inline-expectations postprocess |
| javascript/ql/test/library-tests/frameworks/Templating/app.js | Add $ Source markers for flows |
| javascript/ql/test/library-tests/frameworks/HTTP-heuristics/UnpromotedRouteSetupCandidate.qlref | Enable inline-expectations postprocess |
| javascript/ql/test/library-tests/frameworks/HTTP-heuristics/UnpromotedRouteHandlerCandidate.qlref | Enable inline-expectations postprocess |
| javascript/ql/test/library-tests/frameworks/HTTP-heuristics/src/tst.js | Add $ Alert[...] markers |
| javascript/ql/test/library-tests/frameworks/HTTP-heuristics/src/route-objects.js | Add $ Alert[...] markers |
| javascript/ql/test/library-tests/frameworks/HTTP-heuristics/src/nodejs.js | Add $ Alert[...] markers |
| javascript/ql/test/library-tests/frameworks/HTTP-heuristics/src/hapi.js | Add $ Alert[...] marker |
| javascript/ql/test/experimental/StandardLibrary/MultipleArgumentsToSetConstructor/tst.js | Add $ Alert marker |
| javascript/ql/test/experimental/StandardLibrary/MultipleArgumentsToSetConstructor/MultipleArgumentsToSetConstructorBad.js | Add $ Alert marker |
| javascript/ql/test/experimental/StandardLibrary/MultipleArgumentsToSetConstructor/MultipleArgumentsToSetConstructor.qlref | Enable inline-expectations postprocess |
| javascript/ql/test/experimental/Security/CWE-918/SsrfIpv6TransitionIncompleteGuard/SsrfIpv6TransitionIncompleteGuard.qlref | Enable inline-expectations postprocess |
| javascript/ql/test/experimental/Security/CWE-918/SsrfIpv6TransitionIncompleteGuard/bad-rfc1918-regex.js | Add $ Alert[...] marker |
| javascript/ql/test/experimental/Security/CWE-918/SsrfIpv6TransitionIncompleteGuard/bad-private-ip-pkg.js | Add $ Alert[...] marker |
| javascript/ql/test/experimental/Security/CWE-918/SSRF.qlref | Enable inline-expectations postprocess |
| javascript/ql/test/experimental/Security/CWE-918/check-validator.js | Add inline markers + formatting |
| javascript/ql/test/experimental/Security/CWE-918/check-regex.js | Add inline markers + formatting |
| javascript/ql/test/experimental/Security/CWE-918/check-path.js | Add $ Alert markers |
| javascript/ql/test/experimental/Security/CWE-918/check-middleware.js | Add $ SPURIOUS marker |
| javascript/ql/test/experimental/Security/CWE-918/check-domain.js | Add $ Source/$ Alert markers |
| javascript/ql/test/experimental/Security/CWE-347/remotesource/jwtSimple.js | Add $ Alert/$ Sink markers |
| javascript/ql/test/experimental/Security/CWE-347/remotesource/jwtDecode.js | Add $ Alert/$ Sink markers |
| javascript/ql/test/experimental/Security/CWE-347/remotesource/JsonWebToken.js | Add $ Alert/$ Sink markers |
| javascript/ql/test/experimental/Security/CWE-347/remotesource/jose.js | Add $ Alert/$ Sink markers |
| javascript/ql/test/experimental/Security/CWE-347/remotesource/decodeJwtWithoutVerification.qlref | Enable inline-expectations postprocess |
| javascript/ql/test/experimental/Security/CWE-347/localsource/jwtSimple.js | Add $ Alert/$ Sink markers |
| javascript/ql/test/experimental/Security/CWE-347/localsource/jwtDecode.js | Add $ Alert/$ Sink markers |
| javascript/ql/test/experimental/Security/CWE-347/localsource/JsonWebToken.js | Add $ Alert/$ Sink markers |
| javascript/ql/test/experimental/Security/CWE-347/localsource/jose.js | Add $ Alert/$ Sink markers |
| javascript/ql/test/experimental/Security/CWE-347/localsource/decodeJwtWithoutVerificationLocalSource.qlref | Enable inline-expectations postprocess |
| javascript/ql/test/experimental/Security/CWE-099/EnvValueInjection/test.js | Add $ Source/$ Alert markers |
| javascript/ql/test/experimental/Security/CWE-099/EnvValueInjection/EnvValueInjection.qlref | Enable inline-expectations postprocess |
| javascript/ql/test/experimental/Security/CWE-099/EnvValueAndKeyInjection/test.js | Add $ Source/$ Alert markers |
| javascript/ql/test/experimental/Security/CWE-099/EnvValueAndKeyInjection/EnvValueAndKeyInjection.qlref | Enable inline-expectations postprocess |
| javascript/ql/test/experimental/Security/CWE-094-dataURL/test.js | Add $ Source/$ Alert markers |
| javascript/ql/test/experimental/Security/CWE-094-dataURL/CodeInjection.qlref | Enable inline-expectations postprocess |
Review details
- Files reviewed: 42/42 changed files
- Comments generated: 3
- Review effort level: Low
Comment on lines
20
to
24
| const decodedURI = decodeURIComponent(req.query.url); | ||
| const { hostname } = url.parse(decodedURI); | ||
|
|
||
| const { hostname } = url.parse(decodedURI); | ||
|
|
|
|
||
| (function () { | ||
| const UserToken = aJwt() | ||
| const UserToken = aJwt() // $ Alert |
Comment on lines
+33
to
35
| if (!isInBlacklist(req.params.tainted)) { | ||
| axios.get(baseURL + req.params.tainted); // $ Alert // SSRF | ||
| } |
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.
No description provided.