fix(sast): concurrent scans no longer fail semgrep while staging the rules #448

Merged
sharang merged 1 commits from fix/semgrep-rules-race into main 2026-10-05 13:48:57 +00:00
1 Commits
Author SHA1 Message Date
Sharang ParnerkarandClaude Opus 5.5 58ec612b77 fix(sast): concurrent scans no longer fail semgrep while staging the rules
CI / Check (push) Skipped
CI / Detect Changes (pull_request) Skipped
CI / Deploy Agent (pull_request) Skipped
CI / Deploy Dashboard (pull_request) Skipped
CI / Deploy Docs (pull_request) Skipped
CI / Deploy MCP (pull_request) Skipped
CI / Check (pull_request) Successful in 10m4s
stage_cra_rules wrote its temp file under the process id, which every scan
in an agent shares. With SCAN_CONCURRENCY above one, two scans wrote the
same temp file and one renamed it away from under the other, whose rename
then failed with "No such file or directory". Since #441 that fails the
SAST stage (before, it fell back to the registry rules), so the target got
no semgrep findings and its controls read "Nicht bewertet". Seen in the
local nightly; a burst of new targets (a Managed Git sync) triggers it.

The temp name is now unique per call. A multi-threaded test stages the
rules 32 times at once; it fails on the old code every time.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EYKjxacrr6K88DruUmP48p
2026-10-05 15:37:45 +02:00