- Add export_spss.py to generate long, wide, summary, and paired CSVs - Add codebook, SPSS import syntax, and paired-analysis syntax - Include generated SPSS files for the original and obfuscated runs
4.1 KiB
Validation artifacts
This directory contains reproducible checks and the executed results used to validate the obfuscated dataset condition.
Automated pipeline test
The test starts a local mock OpenAI-compatible API and runs the real
run_sast_eval.py CLI against four benchmark samples. It covers:
- valid JSON
- fenced JSON
- malformed JSON followed by a repair request
- a
429retry - SQLite persistence
- CSV export
--reportwithout API calls- dry-run without an API key
Run it with the standard library only:
python3 -m unittest validation/test_pipeline.py -v
Current result: 3 tests passed.
Bandit comparison
Bandit was installed in a uv virtual environment:
uv venv --python 3.14 .venv
uv pip install --python .venv/bin/python -r requirements-dev.txt
Commands:
.venv/bin/bandit -r Samples -f json -o validation/bandit/samples.json
.venv/bin/bandit -r Samples_Obfuscated_v2 -f json -o validation/bandit/obfuscated_v2.json
Result:
- Original: 89 findings
- Obfuscated v2: 86 findings
- 86 findings identical by file, rule, severity, and confidence
- No new findings
- The only difference is 3 B608 findings in
BenchmarkTest00192.py,BenchmarkTest00284.py, andBenchmarkTest00286.py
B608 is a string-pattern rule for SQL-looking text. The obfuscator replaces SQL
strings with generic msg tokens, so those findings disappear. The SQL sink
and data flow remain. With B608 skipped, both directories produce exactly
86/86 identical findings.
See bandit_comparison.txt for the full report and bandit/*.json for raw
Bandit output.
DeepSeek comparison
Two runs were executed with opencode-go/deepseek-v4.1-flash and
prompts/sast_v1.txt:
| Metric | Original | Obfuscated v2 |
|---|---|---|
| TP | 46 | 46 |
| FP | 13 | 18 |
| TN | 98 | 93 |
| FN | 0 | 0 |
| Accuracy | 91.7% | 88.5% |
| Precision | 78.0% | 71.9% |
| Recall | 100% | 100% |
| Category accuracy (TP) | 100% | 100% |
| CWE accuracy (TP) | 100% | 100% |
| Total tokens | 381,410 | 472,990 |
| API calls | 201 | 202 |
Paired McNemar test on the 157 in-scope samples: p = 0.125, so the +5 false-positive difference is not statistically significant in this single run.
Caveat: the original run used --workers 4 and the obfuscated run used
--workers 1, so wall-clock times are not comparable. See
deepseek_comparison.md for the per-category breakdown, new false positives,
and the recommended replication.
Raw per-sample outputs are in deepseek/*.csv; deepseek/summary.csv contains
the comparison table in machine-readable form.
SPSS exports
export_spss.py reads the two DeepSeek runs from results/sast_runs.sqlite3
and writes importable files to validation/spss/:
sast_long.csv— 400 rows (200 samples × 2 conditions)sast_wide.csv— 200 paired rowssast_summary.csv— aggregate metricssast_paired.csv— McNemar counts and exact p-valuecodebook.csv/codebook.mdsast_import.sps/sast_wide.sps/sast_summary.sps
python3 validation/export_spss.py
See spss/README.md for import instructions and suggested analyses.
Contents
validation/
├── test_pipeline.py # mock-API end-to-end test
├── export_spss.py # generate SPSS-ready CSVs/syntax
├── bandit_comparison.txt # human-readable Bandit diff
├── bandit/
│ ├── samples.json # raw Bandit JSON, original
│ └── obfuscated_v2.json # raw Bandit JSON, obfuscated
├── deepseek_comparison.md # original vs obfuscated analysis
├── deepseek/
│ ├── deepseek-original.csv # per-sample original results
│ ├── deepseek-v4.1-flash.csv # per-sample obfuscated results
│ └── summary.csv # comparison metrics
└── spss/
├── sast_long.csv
├── sast_wide.csv
├── sast_summary.csv
├── sast_paired.csv
├── codebook.csv
├── codebook.md
├── sast_import.sps
├── sast_wide.sps
├── sast_summary.sps
└── README.md