Refactor AST traversal for improved performance and accuracy - #12
Merged
Conversation
- Introduced a file indexing mechanism to reduce redundant AST walks across multiple rules, significantly improving scan performance. - Replaced direct descendant traversal with indexed methods for retrieving call expressions and function nodes. - Updated various rules to utilize the new indexing functions, ensuring consistent behavior and performance gains. - Added tests to validate the correctness of the new indexing methods against traditional traversal methods. - Introduced new test fixtures to cover edge cases and ensure robustness of the scanning process. - Enhanced Python AST parsing to correctly identify and handle calls, attributes, and other constructs, improving vulnerability detection.
|
You are seeing this message because GitHub Code Scanning has recently been set up for this repository, or this pull request contains the workflow file for the Code Scanning tool. What Enabling Code Scanning Means:
For more information about GitHub Code Scanning, check out the documentation. |
…t process, and revise documentation for improved clarity and accuracy
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.
What and why
Detection logic changes (delete this section if not applicable)
npm run regressionwas run and everyproven/likelyfinding it printed was reviewed against its source linetest-fixtures/vulnerable/andtest-fixtures/safe/src/scanner/catalog.tsandsrc/scanner/explainer.tsboth have an entry for any new rule IDtest/corpus.test.js'sEXPECTED_VULNERABLEwas updated for any new ruleCLI changes (delete this section if not applicable)
test/cli.test.jshas a new or updated case exercising the built binary (src/cli.tschanges aren't covered by any other test file)Checklist
npm run build && npm testpasses