-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
JS: Support 'response' threat model and @tanstack/react-query #18834
Conversation
ff24c1b
to
df2e7d1
Compare
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.
PR Overview
This pull request introduces support for Tanstack by modeling the useQuery hook from @tanstack/react-query to enhance the security analysis of DOM-based XSS scenarios.
- Introduces a test case using the Tanstack useQuery hook in a React component.
- Adds a wrapper module to re-export useQuery from @tanstack/react-query.
- Updates threat model configuration and change notes for Tanstack support.
Reviewed Changes
File | Description |
---|---|
javascript/ql/test/query-tests/Security/CWE-079/DomBasedXssWithResponseThreat/test.jsx | Added a new test case simulating a DOM-based XSS scenario using useQuery. |
javascript/ql/test/query-tests/Security/CWE-079/DomBasedXssWithResponseThreat/wrapper.js | Created a wrapper to import and export the Tanstack useQuery hook. |
javascript/ql/test/query-tests/Security/CWE-079/DomBasedXssWithResponseThreat/Xss.ext.yml | Updated extension configuration for threat modeling. |
javascript/ql/lib/change-notes/2025-02-21-tanstack.md | Documented the addition of Tanstack useQuery support. |
Copilot reviewed 11 out of 11 changed files in this pull request and generated no comments.
Tip: If you use Visual Studio Code, you can request a review from Copilot before you push from the "Source Control" tab. Learn more
javascript/ql/lib/semmle/javascript/frameworks/ClientRequests.qll
Outdated
Show resolved
Hide resolved
javascript/ql/test/query-tests/Security/CWE-079/DomBasedXssWithResponseThreat/wrapper.js
Outdated
Show resolved
Hide resolved
Co-authored-by: Asgerf <[email protected]>
@@ -0,0 +1,4 @@ | |||
--- | |||
category: minorAnalysis |
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.
category: minorAnalysis | |
category: majorAnalysis |
--- | ||
category: minorAnalysis | ||
--- | ||
* Added support for the `useQuery` hook from `@tanstack/react-query`. |
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.
* Added support for the `useQuery` hook from `@tanstack/react-query`. | |
* Added support for the `response` threat model kind, which can enabled with [advanced setup](https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/customizing-your-advanced-setup-for-code-scanning#extending-codeql-coverage-with-threat-models). When enabled, the response data coming back from an outgoing HTTP request is considered a source of taint. | |
* Added support for the `useQuery` hook from `@tanstack/react-query`. |
Since the PR is also adding support for the |
Co-authored-by: Asgerf <[email protected]>
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.
Awesome! 🎉
The following pull requests introduce support for
Tanstack
, specifically for theuseQuery
function.Closes #464