|
Download docs/reports/PHASE_3C1_REPORT.md from Helinity/python-security-benchmark: direct link, hf CLI and curl.
- Browser
- Download file 13.6 kB
-
https://huggingface.co/datasets/Helinity/python-security-benchmark/resolve/main/docs/reports/PHASE_3C1_REPORT.md
- Command line
-
hf download hf://datasets/Helinity/python-security-benchmark/docs/reports/PHASE_3C1_REPORT.md
-
curl -L -o PHASE_3C1_REPORT.md https://huggingface.co/datasets/Helinity/python-security-benchmark/resolve/main/docs/reports/PHASE_3C1_REPORT.md
13.6 kB
| # Phase 3C.1 acceptance report | |
| Status: **PASS for the scoped expansion and evidence-gated release**, with four | |
| research-only exclusions. Further scaling should follow independent review. | |
| This is a synthetic application regression resource, not a production prevalence | |
| study or independently validated benchmark. Phase 3C.2 was not started. | |
| ## 1. Original and new sample counts | |
| The original 64 rows and IDs are byte-preserved inside the historical 84-record | |
| corpus. This release adds 70 distinct records: 30 authored vulnerable/secure pairs | |
| and 10 standalone hard negatives. Total distinct research records: **154**. | |
| The old data and evaluation artifacts are checked against 27 historical file | |
| hashes; five pre-expansion documentation snapshots are also preserved and hashed. | |
| All four original Hugging Face configurations retain their paths and records. | |
| The historical Phase 3B official population remains 49 records (23/16/10). | |
| ## 2. Scenario families and independence | |
| There are 40 authored scenario IDs (30 pairs plus 10 standalone negatives), | |
| grouped into **27 conservative CWE/similarity leakage groups**. They should not | |
| be interpreted as 40 statistically independent security mechanisms. The numeric | |
| target of 30 pairs is met; the stronger claim of 30 mutually independent families | |
| is not made. Closely related SQL and filesystem scenarios remain grouped. | |
| The new official test set has 23 samples, 13 authored scenario IDs and 10 leakage | |
| groups. The groups are an independence safeguard, not a proof of independence. | |
| ## 3. Newly verified pairs | |
| All 30 pairs passed their two implementations' explicit benign/adversarial | |
| contracts. **28 pairs** have evidence sufficient for this release's official | |
| scoring policy. The HTML and redirect pairs demonstrate output serialization, | |
| but lack browser/redirect-sink execution, so both members of each are excluded. | |
| Every accepted pair preserves its documented benign behavior and observes the | |
| vulnerable effect and secure prevention. Scope is limited to the stated inputs | |
| and assumptions, not a guarantee that the secure variant has no other weakness. | |
| ## 4. Hard negatives | |
| All **10** standalone negatives passed both contracts and are eligible. They cover | |
| bound SQL, literal subprocess arguments, trusted fixed pickle data, catalog | |
| labels resembling paths, public object lookup, escaped audit data, nonsecret | |
| credential-shaped display strings, field allowlists, literal parsing and HMAC | |
| verification. Difficulty is author-assessed, not empirically calibrated against | |
| multiple SAST tools or models. | |
| ## 5. Coverage | |
| Each record has one primary CWE, with scope/rationale and a MITRE reference. | |
| Broad classes such as CWE-20, CWE-436 and CWE-672 are retained with explicit | |
| mechanism descriptions rather than unsupported claims of finer classification. | |
| The invitation case uses an expiring resource, not a browser session. Its draft | |
| CWE-613 mapping was corrected to CWE-672 before release: MITRE has deprecated | |
| [CWE-613](https://cwe.mitre.org/data/definitions/613.html), while | |
| [CWE-672](https://cwe.mitre.org/data/definitions/672.html) covers use of expired | |
| resources. The cache case scopes exposure across tenants, consistent with | |
| [CWE-524](https://cwe.mitre.org/data/definitions/524.html). No MITRE example code | |
| was copied into the fixtures. | |
| | CWE | New samples | Official samples | Authored scenarios | | |
| |---|---:|---:|---:| | |
| | CWE-113 | 2 | 2 | 1 | | |
| | CWE-117 | 3 | 3 | 2 | | |
| | CWE-187 | 2 | 2 | 1 | | |
| | CWE-20 | 2 | 2 | 1 | | |
| | CWE-209 | 2 | 2 | 1 | | |
| | CWE-22 | 5 | 5 | 3 | | |
| | CWE-294 | 2 | 2 | 1 | | |
| | CWE-347 | 3 | 3 | 2 | | |
| | CWE-377 | 2 | 2 | 1 | | |
| | CWE-436 | 2 | 2 | 1 | | |
| | CWE-489 | 2 | 2 | 1 | | |
| | CWE-502 | 3 | 3 | 2 | | |
| | CWE-524 | 2 | 2 | 1 | | |
| | CWE-59 | 2 | 2 | 1 | | |
| | CWE-601 | 2 | 0 | 1 | | |
| | CWE-639 | 3 | 3 | 2 | | |
| | CWE-672 | 2 | 2 | 1 | | |
| | CWE-732 | 2 | 2 | 1 | | |
| | CWE-770 | 2 | 2 | 1 | | |
| | CWE-78 | 3 | 3 | 2 | | |
| | CWE-79 | 2 | 0 | 1 | | |
| | CWE-798 | 3 | 3 | 2 | | |
| | CWE-807 | 2 | 2 | 1 | | |
| | CWE-862 | 2 | 2 | 1 | | |
| | CWE-89 | 7 | 7 | 4 | | |
| | CWE-915 | 3 | 3 | 2 | | |
| | CWE-95 | 3 | 3 | 2 | | |
| | Framework/library | New samples | Official samples | | |
| |---|---:|---:| | |
| | FastAPI | 22 | 22 | | |
| | Flask | 22 | 18 | | |
| | SQLAlchemy | 3 | 3 | | |
| | stdlib | 23 | 23 | | |
| Every sample has `app.py` and `service.py`. Request adapters import service code; | |
| selected services add helper functions and multiple paths. Flask and FastAPI | |
| use real in-process clients; SQLAlchemy uses its real SQLite engine. The adapters | |
| are deliberately small and shared in structure. Identity, tenant, provisioning, | |
| clock and filesystem setup are deterministic fixture context, not a complete | |
| authentication deployment. No HTTP server, browser or production service runs. | |
| ## 6. Runtime evidence | |
| All 70 records passed 140 observed contract checks (70 benign and 70 adversarial). | |
| No new result is based on mocking. Actual JSON outputs and code hashes are in | |
| `data/research/v3c1/runtime.json`; expected outputs are in each record's | |
| `verification_contract`. Re-running generation performs the checks again. | |
| The worker asserts Linux, UID 65534, zero effective capabilities, no-new-privileges, | |
| only the loopback interface, a read-only root, 256 MiB memory and 32 PIDs. Docker | |
| also limits CPU to one core and tmpfs to 32 MiB with noexec/nosuid. No host files, | |
| credentials or Docker socket are mounted. The batch has a 90-second timeout and | |
| forced cleanup; fixture subprocesses have two-second timeouts. Image setup alone | |
| downloaded exact-version dependencies; all verification is network-disabled. | |
| Audited image: `sha256:70baa9f65d8a7edbda2c2ed87a21b3225d48113eb93ecbe2c25a376e60c952cf`. Python: `3.13.18`. | |
| Runtime packages: Flask 3.1.2, fastapi 0.115.12, httpx 0.28.1, sqlalchemy 2.0.40. | |
| The dependency lock includes all 22 installed package versions. The immutable | |
| local image is required for byte-identical replay of its recorded identity; | |
| rebuilding may produce a different image ID. See the reproduction guide for | |
| the distinction between replaying this image and producing a new local audit. | |
| ## 7. Failures and exclusions | |
| Final runtime contract failures: **0**. Four records are excluded by evidence | |
| scope despite passing their serialization contracts: | |
| | Record | Scenario | Reason | | |
| |---|---|---| | |
| | c3c1-1287ced8dcad | comment-html-rendering | serialization_only_no_browser_or_redirect_sink | | |
| | c3c1-619d9b0f64ca | post-login-return-path | serialization_only_no_browser_or_redirect_sink | | |
| | c3c1-6ae7c2fad7f9 | post-login-return-path | serialization_only_no_browser_or_redirect_sink | | |
| | c3c1-e6331421b872 | comment-html-rendering | serialization_only_no_browser_or_redirect_sink | | |
| The initial red test correctly failed before the release module existed. An | |
| authoring-time bytes-literal syntax issue in the trusted-pickle negative was | |
| corrected before runtime acceptance. No failed observation was relabeled as a | |
| pass, and no dependency failure or missing runtime was replaced by a mock. | |
| Final source review also moved the secure credential to a worker-provisioned | |
| environment value, added real HTTP header parsing to the CRLF fixture, and made | |
| the permission fixture's parent directory traversable for the POSIX access | |
| assumption. All affected contracts and acceptance checks were rerun. | |
| Historical exclusions remain unchanged; this release does not promote legacy | |
| records or rewrite prior Phase 3B annotations. | |
| ## 8. Leakage analysis and historical preservation | |
| Across all 154 records: 11,781 pair comparisons, 0 exact text duplicates, 0 exact AST duplicates, 22 near matches, and **0 cross-split near matches**. | |
| The seven historical near-duplicate dispositions remain byte-identical. | |
| Whole-application analysis includes both source files; normalized names/literals | |
| and five-token shingles detect additional structure similarity. Threshold: 0.80, | |
| minimum 18 tokens. Similarity components and CWE strata are assigned together, | |
| anchored to the historical splits; a new component connecting historical splits | |
| fails generation. Exact duplicates also fail. Distinct scenarios can still share | |
| concepts below these thresholds. Fixed SHA-256 assignment is independent of | |
| baseline scores. No historical test example or score was replaced. | |
| ## 9. Official eligibility and split counts | |
| | Release/configuration | Train | Validation | Test | Total | | |
| |---|---:|---:|---:|---:| | |
| | Historical `corpus` | 53 | 16 | 15 | 84 | | |
| | Historical `official` | 23 | 16 | 10 | 49 | | |
| | New `corpus_3c1` | 31 | 16 | 23 | 70 | | |
| | New `official_3c1` | 27 | 16 | 23 | 66 | | |
| Official new records occupy 38 authored scenario IDs and 25 conservative groups. | |
| There are 115 distinct eligible records across the two official versions, but | |
| they are intentionally scored separately. The default evaluator remains Phase | |
| 3B; `--scope official_3c1` is explicit. Before scoring, it re-executes evidence, | |
| checks hashes and all generated artifacts, and rejects missing/stale manifests. | |
| Eligibility is atomic for pairs. Manual promotion is covered by a regression test. | |
| ## 10. Baseline evaluation and regression results | |
| The lexical keyword rules are unchanged. They consume code only, with no fixes, | |
| contracts or label metadata. New test scores use 23 samples / 13 scenarios / | |
| 10 conservative groups: TP=1, TN=13, FP=0, FN=9; precision=1.0, recall=0.10, | |
| F1=0.181818, balanced accuracy=0.55, false-positive rate=0, false-negative rate=0.90. | |
| Only three standalone hard negatives are in this test split; zero false positives | |
| on three samples is weak evidence. Per-CWE and pair outcomes are in the saved JSON. | |
| Historical test results are unchanged: the 11-row Phase 3A baseline has F1=0 and | |
| balanced accuracy=0.428571; the six-row early Phase 3B baseline has F1=0 and | |
| balanced accuracy=0.5; the completed 10-row Phase 3B baseline has F1=0.571429 and | |
| balanced accuracy=0.7. Differences across releases reflect different populations | |
| and must not be described as detector improvement or regression on a fixed set. | |
| Complete suite: `55 passed in 19.03s`. | |
| - PASS: `python -m pytest -q` | |
| - PASS: `python -m scripts.generate_dataset --check` | |
| - PASS: `python -m scripts.validate_dataset` | |
| - PASS: `python -m research.build --check` | |
| - PASS: `python -m research.harden --check` | |
| - PASS: `python -m research.expansion.release --check` | |
| - PASS: `python -m research.check_hf` | |
| - PASS: `python -m research.evaluate --scope official_3c1 --split test --baseline` | |
| The Hugging Face offline check loaded six configurations and all 16 splits with | |
| exact record/field equality. Baseline generation, Phase 3A regeneration, Phase | |
| 3B regeneration and the new release all passed byte comparisons. Stored command | |
| outputs and exit codes are in `research/expansion/validation-results.json`. | |
| ## 11. Remaining quality limitations and review preparation | |
| The stratified review packet contains 64 records (one complete pair per CWE plus every standalone hard negative), spanning all four framework/library | |
| groups. Code context, primary-CWE rationale, assumptions, expected/observed | |
| behavior and blank reviewer decisions are included. Independent reviews: **0**. | |
| Reviewers should follow `REVIEW_PROTOCOL.md`; label rejection or ambiguity must | |
| produce a new versioned eligibility decision rather than editing history. | |
| These are original synthetic educational micro-applications, not harvested CVEs. | |
| Examples are self-contained and deliberately smaller than production services. | |
| Most scenarios have one benign and one adversarial request, so input-space, | |
| concurrency, filesystem races, deployment permissions, actual browser behavior, | |
| full authentication middleware and distributed cache behavior remain untested. | |
| No DoS was attempted: the resource fixture checks a small explicit quota. POSIX | |
| permission checks observe mode bits rather than impersonating another OS user. | |
| Hardcoded fixture keys are intentionally public; secure labels are scoped to | |
| their annotated mechanism. Only one primary CWE is annotated per record. | |
| Sources/sinks and taint paths are author annotations tied to visible code and | |
| contracts, not dynamic instruction traces. The trusted constant-pickle example | |
| correctly has no untrusted taint path to its decoder. Thin request wrappers and | |
| synthetic names can create shortcut cues. Similarity analysis cannot prove | |
| semantic independence. Findings evaluation supports primary-CWE and location | |
| matching; the baseline itself predicts binary labels, not a multiclass CWE model. | |
| The review packet and author checks do not constitute independent validation. | |
| No private data, real credentials, proprietary code or third-party dataset was | |
| introduced. Credential-like strings and private data markers are explicitly | |
| synthetic. Authored additions use Apache-2.0; external framework/dependency | |
| licenses remain separate. No artifacts were published and no model was trained. | |
| ## 12. Readiness assessment | |
| Ready for external label review and reproducible small-scale SAST experiments | |
| using the named versioned subsets. Larger-scale expansion should wait for review | |
| of the broad CWE mappings, mechanism scope, input coverage and shortcut cues. | |
| Browser/redirect evidence remains a blocker to admitting the four excluded | |
| records, not to using the 66-record official subset. There are no unresolved | |
| runtime, regeneration, split-integrity or offline-loading failures in this audit. | |
| Reproduce with `research/expansion/README.md`. To rebuild this report from the | |
| recorded results, run `python -m research.expansion.report`. Stop at Phase 3C.1. | |