Commit Graph
2 Commits
Author SHA1 Message Date
lukaszraczylo e4077066ef fix(scanner): remove scanner temp files after every scan
A scanner binary that its timeout kills cannot remove its own temp files.
A killed trivy left its database download in the temp dir as trivy-<n>
and getter<n>, up to 279 MB for each scan. Concurrent rescans filled the
scanner temp dir, and the disk guard then refused all new scans.

Each scanner run now gets a private dir in the temp dir, and the scanner
binary gets this dir as TMPDIR. The scan removes the dir and its contents
when the scan ends, also after a timeout or an error. Each new scan also
removes abandoned dirs that are older than one hour. These dirs come from
a process that stopped during a scan, or from a removal that failed.
2026-12-01 03:11:51 +00:00
lukaszraczylo 22f2a8dfb9 fix(trivy): unpack npm tarballs before scanning
Trivy does not read archives, so a bare npm tarball always scanned clean.
The scanner now extracts the tarball into node_modules/<name> in a temp
dir and runs trivy rootfs on it, so the node-pkg analyzer sees the
package.json. Extraction rejects absolute paths, parent segments and
links that leave the tree, and caps the unpacked size at 512 MiB. The
temp dir is removed after the scan.

PyPI wheels and Go module zips share the archive problem and need their
own extractors. This commit does not change them.
2026-11-24 00:16:07 +00:00