-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Go: sanitize simple types in go/request-forgery
#20613
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Go: sanitize simple types in go/request-forgery
#20613
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
smowton
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
|
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 |
Should fix this issue.