JS: Support 'response' threat model and @tanstack/react-query#18834
Merged
asgerf merged 7 commits intogithub:mainfrom Feb 25, 2025
Merged
JS: Support 'response' threat model and @tanstack/react-query#18834asgerf merged 7 commits intogithub:mainfrom
asgerf merged 7 commits intogithub:mainfrom
Conversation
ff24c1b to
df2e7d1
Compare
Contributor
There was a problem hiding this comment.
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
asgerf
reviewed
Feb 25, 2025
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 <asgerf@github.com>
asgerf
reviewed
Feb 25, 2025
| @@ -0,0 +1,4 @@ | |||
| --- | |||
| category: minorAnalysis | |||
Contributor
There was a problem hiding this comment.
Suggested change
| category: minorAnalysis | |
| category: majorAnalysis |
| --- | ||
| category: minorAnalysis | ||
| --- | ||
| * Added support for the `useQuery` hook from `@tanstack/react-query`. |
Contributor
There was a problem hiding this comment.
Suggested change
| * 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`. |
Contributor
|
Since the PR is also adding support for the |
Co-authored-by: Asgerf <asgerf@github.com>
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.
The following pull requests introduce support for
Tanstack, specifically for theuseQueryfunction.Closes #464