Go: sanitize simple types in go/request-forgery#20613
Merged
owen-mc merged 4 commits intogithub:mainfrom Oct 10, 2025
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR refactors the CodeQL Go request forgery analysis to sanitize simple types (numeric and boolean types) that are unlikely to carry taint. It also introduces a shared sanitizer class and deprecates an existing SQL injection sanitizer.
Key changes:
- Creates a new shared
SimpleTypeSanitizerclass for simple types like numbers and booleans - Applies this sanitizer to the request forgery detection to reduce false positives
- Deprecates the existing
NumericOrBooleanSanitizerin SQL injection analysis in favor of the shared sanitizer
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| go/ql/lib/semmle/go/security/Sanitizers.qll | New shared sanitizer module with SimpleTypeSanitizer class |
| go/ql/lib/semmle/go/security/RequestForgeryCustomizations.qll | Adds simple type sanitization to request forgery analysis |
| go/ql/lib/semmle/go/security/SqlInjectionCustomizations.qll | Deprecates existing sanitizer in favor of shared implementation |
| go/ql/test/query-tests/Security/CWE-918/tst.go | Adds test case for simple type sanitization |
| go/ql/test/query-tests/Security/CWE-918/RequestForgery.ext.yml | Test configuration for the new test case |
| go/ql/test/query-tests/Security/CWE-918/RequestForgery.expected | Updated expected test results |
| go/ql/lib/change-notes/ | Documentation for the changes |
go/ql/lib/change-notes/2025-10-09-sanitize-simple-types-request-forgery.md
Outdated
Show resolved
Hide resolved
fc69a65 to
3715179
Compare
Contributor
Author
|
I ran multi-repo analyses before and after. One repo out of the 1000 had alert changes: we go from 26 to 21 results on |
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.
Should fix this issue.