JS: ClientRequests Axios Instance support#19655
Merged
asgerf merged 7 commits intogithub:mainfrom Jun 24, 2025
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
Adds support for Axios instances in the ClientRequests framework and updates tests accordingly.
- Introduces a new test file (
axios.ts) that usesaxios.create({ ... })and exercises.getand.patchcalls. - Updates the expected outputs (
ClientRequests.expected) to include those new axios instance calls. - Extends the QL library (
ClientRequests.qll) with a newAxiosInstanceRequestclass and adds support for thepatchmethod.
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| javascript/ql/test/library-tests/frameworks/ClientRequests/axios.ts | Added tests for axios instances and their .get / .patch calls |
| javascript/ql/test/library-tests/frameworks/ClientRequests/ClientRequests.expected | Updated expected results to include axios.ts calls |
| javascript/ql/lib/semmle/javascript/frameworks/ClientRequests.qll | Added handling for axios instances and included patch method |
| javascript/ql/lib/change-notes/2025-06-03-axios-instance-support.md | Documented the new axios instance support |
Comments suppressed due to low confidence (1)
javascript/ql/test/library-tests/frameworks/ClientRequests/axios.ts:24
- [nitpick] The function is named
updateUserbut it actually patches a repository endpoint. Consider renaming it toupdateRepo(or adjust the endpoint if it should update a user).
export async function updateUser(owner: string, repo: string, data: any) {
asgerf
reviewed
Jun 10, 2025
Contributor
asgerf
left a comment
There was a problem hiding this comment.
The duplication between the two classes is a bit unfortunate but not blocking. I'll try and clean it up post-merge.
I've started a DCA run.
| AxiosInstanceRequest() { | ||
| instance = axios().getMember(["create", "createInstance"]).getACall() and | ||
| method = [httpMethodName(), "request", "postForm", "putForm", "patchForm", "getUri"] and | ||
| this = instance.getReturn().getMember(method).getACall() |
Contributor
There was a problem hiding this comment.
There's a case on line 227 that ought to be moved here:
this = axios().getMember("create").getReturn().getACall() and
method = "request"That is, if the result of create() is invoked directly, it should be treated as a call to request().
Contributor
Author
|
Thank @asgerf |
asgerf
approved these changes
Jun 24, 2025
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've added support for creation Axios instances using
create({ ... })