-
Notifications
You must be signed in to change notification settings - Fork 1.8k
JS: Make API graphs use steps from summaries #19012
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
Conversation
b8f6522
to
aa11c0e
Compare
…ement() Although they mean slightly different things, every single call site of getUnknownMember() just used it as a way to get array elements. Since there is no known use-case for the original meaning of getUnknownMember() I am deprecating it for now.
aa11c0e
to
cd39092
Compare
The use of AnyMember was a workaround until the bugfix in this PR landed.
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 pull request updates API graphs to use steps from summaries and refactors how array elements are handled in various test and configuration files.
- Updates the tests by adding an array source function to exercise new API graph handling.
- Changes the dynamic property read in the API graph to use ArrayElement.
- Modifies configuration files for test extensions and tanstack models to support the new array element representation.
Reviewed Changes
Copilot reviewed 5 out of 18 changed files in this pull request and generated no comments.
Show a summary per file
File | Description |
---|---|
javascript/ql/test/library-tests/frameworks/data/test.js | Adds tests for array source function calls using testlib. |
javascript/ql/test/ApiGraphs/dynamic-prop-read/index.js | Updates the dynamic call from getUnknownMember() to getArrayElement(). |
javascript/ql/test/library-tests/frameworks/data/test.ext.yml | Extends test configuration with ArrayElement return for testlib. |
javascript/ql/lib/ext/tanstack.model.yml | Adjusts tanstack API queries to return ArrayElement for useQueries. |
javascript/ql/test/query-tests/Security/CWE-079/DomBasedXssWithResponseThreat/testUseQueries.vue | Updates comment markers to reflect correct source and alert tags. |
Files not reviewed (13)
- javascript/ql/lib/semmle/javascript/ApiGraphs.qll: Language not supported
- javascript/ql/lib/semmle/javascript/dataflow/internal/Contents.qll: Language not supported
- javascript/ql/lib/semmle/javascript/frameworks/D3.qll: Language not supported
- javascript/ql/lib/semmle/javascript/frameworks/Puppeteer.qll: Language not supported
- javascript/ql/lib/semmle/javascript/frameworks/Vuex.qll: Language not supported
- javascript/ql/lib/semmle/javascript/frameworks/data/internal/ApiGraphModelsSpecific.qll: Language not supported
- javascript/ql/lib/semmle/javascript/internal/CachedStages.qll: Language not supported
- javascript/ql/lib/semmle/javascript/internal/flow_summaries/Arrays.qll: Language not supported
- javascript/ql/lib/semmle/javascript/security/dataflow/ExternalAPIUsedWithUntrustedDataCustomizations.qll: Language not supported
- javascript/ql/src/experimental/Security/CWE-347/JWT.qll: Language not supported
- javascript/ql/src/experimental/semmle/javascript/Execa.qll: Language not supported
- javascript/ql/test/library-tests/frameworks/data/test.expected: Language not supported
- javascript/ql/test/query-tests/Security/CWE-079/DomBasedXssWithResponseThreat/Xss.expected: Language not supported
Tip: Copilot code review supports C#, Go, Java, JavaScript, Markdown, Python, Ruby and TypeScript, with more languages coming soon. Learn more
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.
Nice 👍
Although I feel the latest DCA evaluation hints towards a minor performance regression?
I've started another evaluation to see whether that's just a spurious result.
Makes API graphs use
Content
internally and use steps from summaries.Steps from summaries are already converted into type-tracking steps, we just need to use them in API graphs.
The handling of
Content
/ContentSet
is the same as in Ruby: the graph is generated usinggetAStoreContent
(both for use and def nodes) and queried usinggetAReadContent
. We want to avoid materialising a graph based ongetAReadContent()
because that set can be huge.Based on this we can now implement
getArrayElement()
properly. This looks through things like.map()
and.pop()
based on the existing models for arrays. This in turn fixes some issues with theArrayElement
MaD token, as shown in the new test case.