semgrep / pfff

pfff is mainly an OCaml API to write static analysis, dynamic analysis, code visualizations, code navigations, or style-preserving source-to-source transformations such as refactorings on source code.
https://semgrep.dev
Other
186 stars 29 forks source link

Add option to register a hook to clean up tmp files #575

Closed nmote closed 1 year ago

nmote commented 1 year ago

This is useful for cache invalidation when we cache information about files. We've run into issues where collisions in tmp file names lead to incorrect information in caches. https://github.com/returntocorp/semgrep/issues/5277 is one example, and I just investigated another (see test plan).

Test plan: Automated tests in Semgrep and DeepSemgrep, plus semgrep --deep --config=p/deepsemgrep ./NodeBB/ --verbose -j 1 where NodeBB is a fresh clone of the NodeBB repo, after using this new function to clean up the cache in Semgrep's Range.ml. Previously, that crashed.

Security