Benchmark: SafeRun vs Bandit
A small, advisory comparison on harmless simulated samples that are never executed. Held-out split of the second sample set: 32 bad and 12 clean code samples.
Not an independent evaluation. SafeRun is behind Bandit on catches; the new rules help it, but do not close the gap.
Catches, loose
any finding, among 32 bad samples
Catches, strict
SafeRun: FAIL verdict; Bandit: medium or high finding
False alarms, loose
any finding, among 12 clean samples (lower is better)
By category (loose, flagged / total)
| Category | SafeRun, unchanged | SafeRun, new rules | Bandit |
|---|---|---|---|
| Sensitive file read | 0/4 | 2/4 | 0/4 |
| Evasion variant | 1/4 | 3/4 | 1/4 |
| Persistence | 0/4 | 1/4 | 1/4 |
| Exfiltration | 0/4 | 0/4 | 2/4 |
| Destructive | 0/4 | 0/4 | 1/4 |
| Weak practice | 1/4 | 1/4 | 4/4 |
| Hardcoded secret | 1/2 | 1/2 | 2/2 |
| Dangerous calls | 2/2 | 2/2 | 2/2 |
| Obfuscated payload | 2/2 | 2/2 | 2/2 |
| Unsafe deserialization | 2/2 | 2/2 | 2/2 |
The three new rules cover credential-file reads, persistence setup and hidden function lookups. Five held-out samples were gained and none was lost. Dependency checks: SafeRun and pip-audit tie at 8/8 on the first set.
Limits
- SafeRun is still behind Bandit: 14/32 vs 17/32 loose and 7/32 vs 14/32 strict. It flagged none of the exfiltration or destructive samples.
- Strict catches did not change: the three new rules are medium severity, so they add findings and a WARNING, not a FAIL verdict.
- The samples are few, simulated and written by the SafeRun authors, who already knew where the first set was missed. This is not an independent evaluation and not a claim about real-world malware.
- Bandit looks for insecure coding practice; SafeRun is aimed at code you are about to run but do not trust. A lower score for one tool is not a verdict on the other.
- The rules were written against the dev samples only. The held-out samples were run once and must not be used to change rules any more.
- Only the scan is measured, not the sandbox. A PASS is not proof of safety.
Full report, method and every miss: docs/benchmark.md.