fix(security): give MEDUSA every host worker, also for scans with few files
🧪 Test / 🧪 Lock + lint (push) Canceled after 0s

security.py capped --workers at the number of files scanned, so a scan of
three files used three cores. MEDUSA with scanner slices
(Pantheon-Security/medusa#21) splits each file's scanners across all
workers, so the cap now only idles cores; an unpatched MEDUSA starts
workers on demand and is not affected.

🎯 Fix: 92 %
💥 Break: 5 %
💸 Tokens: –
⏱️ Velocity: –
🛡️ Security: 100 %
🏆 Score: 87
🚦 Gate: ✅ 90/5, tokens and velocity <= 100, security 100 %

Created-with: https://s.veen.world/skills
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Kevin Veen-BirkenbachandClaude Opus 5.5 committed 2026-11-24 11:32:18 +00:00
1 parent edf53982c8
commit a667ac485a
2 files changed
+4 -4

No files matched your search

@@ -22,8 +22,8 @@ Args:
Scan:
The regular files `git diff <ref>` names plus untracked ones, symlinks left
out, copied to a temporary tree and scanned once with
`medusa scan <tree> --format json -o <dir> --no-cache --workers <w>`, w the
files scanned but at most host_workers(), HOME pointing into the temporary
`medusa scan <tree> --format json -o <dir> --no-cache --workers <w>`, w
host_workers() also for fewer files, HOME pointing into the temporary
directory because medusa creates ~/.medusa on start and KNOB set to
--timeout (a medusa that ignores KNOB keeps its own cap), read from
`<dir>/medusa-scan-*.json`: a `findings` list whose entries carry
@@ -837,7 +837,7 @@ def scan(
return scanned, hit, missed
code, out, lasted = medusa_run(
[medusa, "scan", str(tree), "--format", "json", "-o", str(reports), "--no-cache",
"--workers", str(min(scanned, host_workers()))],
"--workers", str(host_workers())],
work, env, deadline,
)
try:
+1 -1
View File
@@ -222,7 +222,7 @@ class TestSecurity(unittest.TestCase):
argv = json.loads((self.bin / "argv.json").read_text(encoding="utf-8"))
self.assertEqual(
[argv[0], *argv[2:4], argv[4], *argv[6:]],
["scan", "--format", "json", "-o", "--no-cache", "--workers", str(min(2, security_module().host_workers()))],
["scan", "--format", "json", "-o", "--no-cache", "--workers", str(security_module().host_workers())],
)
result = self.scan("--json", env=self.env)
self.assertNotIn(PLACEHOLDER, result.stdout + result.stderr)