JS: Accept MaD sanitizers for queries with MaD sinks#21336
Open
owen-mc wants to merge 3 commits intogithub:mainfrom
Open
JS: Accept MaD sanitizers for queries with MaD sinks#21336owen-mc wants to merge 3 commits intogithub:mainfrom
owen-mc wants to merge 3 commits intogithub:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds support for MaD (Models-as-Data) sanitizers/barriers to JavaScript security queries, following the pattern established in Python (PR #21004). The change enables external model contributors to define sanitizers for security queries that already use MaD sinks.
Changes:
- Added
SanitizerFromModelclasses to 14 JavaScript security query customization files - Each sanitizer uses
ModelOutput::barrierNodewith a kind matching the correspondingSinkFromModelkind - HardcodedCredentials uses a special pattern to match multiple credential types (credentials-key, credentials-password, credentials-username)
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| UnsafeDeserializationCustomizations.qll | Adds MaD sanitizer support for "unsafe-deserialization" kind |
| TaintedPathCustomizations.qll | Adds MaD sanitizer support for "path-injection" kind |
| SqlInjectionCustomizations.qll | Adds MaD sanitizer support for "sql-injection" kind |
| ServerSideUrlRedirectCustomizations.qll | Adds MaD sanitizer support for "url-redirection" kind |
| RequestForgeryCustomizations.qll | Adds MaD sanitizer support for "request-forgery" kind |
| ReflectedXssCustomizations.qll | Adds MaD sanitizer support for "html-injection" kind |
| NosqlInjectionCustomizations.qll | Adds MaD sanitizer support for "nosql-injection" kind |
| LogInjectionQuery.qll | Adds MaD sanitizer support for "log-injection" kind |
| HardcodedCredentialsCustomizations.qll | Adds MaD sanitizer support for "credentials-*" kinds with documentation explaining that all credential sanitizers work for all credential sink types |
| DomBasedXssCustomizations.qll | Adds MaD sanitizer support for "html-injection" kind |
| CommandInjectionCustomizations.qll | Adds MaD sanitizer support for "command-injection" kind |
| CodeInjectionCustomizations.qll | Adds MaD sanitizer support for "code-injection" kind |
| ClientSideUrlRedirectCustomizations.qll | Adds MaD sanitizer support for "url-redirection" kind |
| CorsPermissiveConfigurationCustomizations.qll | Adds MaD sanitizer support for "cors-origin" kind |
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.
I looked through all the existing sanitizers but didn't find any more that could be converted.
Note that two sanitizers for one query were converted in #21004, but actually I have found it necessary to revert the commits for that. The problem is that there isn't a natural sink kind for the query (
js/incomplete-html-attribute-sanitization).request-forgerywas used, but one of those two methods should not be sanitizers for request forgery.