-
Notifications
You must be signed in to change notification settings - Fork 1.9k
JS: superagent modeling
#19068
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: superagent modeling
#19068
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 adds missing modeling for superagent use cases in the code analysis framework.
- Adds modeling for the del method (superagent.del(url)).
- Models function call syntax for specifying HTTP method (superagent('GET', url)).
- Introduces modeling for agent-based requests (superagent.agent().post(url).send(data)).
Reviewed Changes
Copilot reviewed 2 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| javascript/ql/test/library-tests/frameworks/ClientRequests/tst.js | Adds a new function with superagent API modeling |
| javascript/ql/lib/change-notes/2025-03-20-superagent.md | Updates change notes for enhanced superagent support |
Files not reviewed (2)
- javascript/ql/lib/semmle/javascript/frameworks/ClientRequests.qll: Language not supported
- javascript/ql/test/library-tests/frameworks/ClientRequests/ClientRequests.expected: Language not supported
Tip: Copilot only keeps its highest confidence comments to reduce noise and keep you focused. Learn more
| agent = DataFlow::moduleMember(moduleName, "agent").getACall() and | ||
| this = agent.getAMethodCall(httpMethodName()) and | ||
| url = this.getArgument(0) | ||
| ) |
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.
If you feel like going a step further you could switch to API:: here instead of DataFlow::, but I'll leave it up to you.
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.
I have tried to remake it to use API graph d61d038, hopefully I didn't miss anything.
Co-authored-by: Asger F <asgerf@github.com>
This PR addresses missing modeling for
superagentin specific use cases:superagent.del(url).superagent('GET', url).superagent.agent().