Skip to content
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

detectors: cache_array_length: include source mapping in finding #2076

Merged
merged 3 commits into from
Sep 8, 2023

Conversation

elopez
Copy link
Member

@elopez elopez commented Aug 2, 2023

The detector was manually string-interpolating the code and line information, which left the finding without source mapping metadata and broke filtering. Include the node directly on the finding info so that the metadata is preserved.

The detector was manually string-interpolating the code and line
information, which left the finding without source mapping metadata
and broke filtering. Include the node directly on the finding info
so that the metadata is preserved.
@elopez elopez force-pushed the dev-fix-cache-array-length-filtering branch from 1ef3cfe to b99aa8f Compare August 2, 2023 22:10
@elopez
Copy link
Member Author

elopez commented Aug 2, 2023

I suspect the printing becomes a bit more unfriendly with this change (e.g. i_scope_23 instead of i) because Output uses .expression instead of .content to display Node source mappings.

@0xalpharush
Copy link
Contributor

@elopez I didn't realize the ramifications on the filtering when I made the changes in #2019. I'm not sure if we could switch to .content generally, but improving the code context and displaying detector findings more clearly is something we'd welcome. For now, we can just revert back to how it was previously and merge this.

The tests just need to be updated with pytest tests/e2e/detectors/test_detectors.py --insta update

@0xalpharush 0xalpharush merged commit 9da51ff into dev Sep 8, 2023
73 checks passed
@0xalpharush 0xalpharush deleted the dev-fix-cache-array-length-filtering branch September 8, 2023 03:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants