Skip to content

Conversation

@Napalys
Copy link
Contributor

@Napalys Napalys commented Mar 20, 2025

This PR addresses missing modeling for superagent in specific use cases:

  • Adds support for the del method superagent.del(url).
  • Handles cases where the HTTP method (e.g., 'GET') is passed as an argument superagent('GET', url).
  • Adds modeling for calls made on superagent.agent().

@github-actions github-actions bot added the JS label Mar 20, 2025
@Napalys Napalys marked this pull request as ready for review March 20, 2025 12:23
Copilot AI review requested due to automatic review settings March 20, 2025 12:23
@Napalys Napalys requested a review from a team as a code owner March 20, 2025 12:23
Copy link
Contributor

Copilot AI left a 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

@github github deleted a comment from Copilot AI Mar 20, 2025
agent = DataFlow::moduleMember(moduleName, "agent").getACall() and
this = agent.getAMethodCall(httpMethodName()) and
url = this.getArgument(0)
)
Copy link
Contributor

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.

Copy link
Contributor Author

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>
asgerf
asgerf previously approved these changes Mar 20, 2025
@Napalys Napalys merged commit 803aacf into github:main Mar 21, 2025
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants