DeepZero
DeepZero copied to clipboard
A large scan loses every result and reports that semgrep is not installed
What happens
Running the bundled kernel-driver pipeline over a real driver pack (1,380 drivers that reached scanning) failed on every one of them:
[engine] semgrep_scanner: 1380 active samples
[semgrep_scanner] bulk scanning 12346 files from 1380 samples
[engine] semgrep_scanner: 0 passed, 0 filtered, 1380 failed (354.5s)
Every sample recorded the same error: semgrep not installed - pip install semgrep. semgrep was installed and on PATH the whole time, and the scan had already been running for six minutes before failing.
Two separate problems:
- The scanner asks semgrep for JSON on stdout and reads it back through a pipe. Measured on this corpus: 80 drivers produce a 4.3 MB results document, so 1,380 drivers produce roughly 74 MB. Reading that back fails, and the entire scan is lost after doing all the work.
- The failure handler assumes any launch error means semgrep is missing, so the reported cause was wrong and sent the user looking in the wrong place. The scan stage is the gate before assessment, so this silently ended the run: nothing was assessed and the report showed zero findings for a corpus that in fact had thousands.
Why it matters
This only appears at scale. Small runs pass, so the pipeline looks healthy until it is pointed at a real corpus - the case it exists for. Because the stage fails rather than partially succeeds, there is no partial result to salvage and no indication that findings existed.
Suggested fix (acceptance criteria)
- [ ] Results are read in a way that does not depend on their size (have semgrep write to a file and read that).
- [ ] A launch failure reports the actual error; only a genuinely missing executable says semgrep is not installed.
- [ ] A scan that finds work but cannot deliver results is distinguishable from one that legitimately found nothing.
- [ ] Consider scanning in chunks so one oversized batch cannot discard the results of the rest.