|
Download docs/README.md from Helinity/python-security-benchmark: direct link, hf CLI and curl.
- Browser
- Download file 9.16 kB
-
https://huggingface.co/datasets/Helinity/python-security-benchmark/resolve/main/docs/README.md
- Command line
-
hf download hf://datasets/Helinity/python-security-benchmark/docs/README.md
-
curl -L -o README.md https://huggingface.co/datasets/Helinity/python-security-benchmark/resolve/main/docs/README.md
9.16 kB
| # Technical documentation | |
| [Project overview](../README.md) · [Release audit](reports/RELEASE_CANDIDATE_REPORT.md) · [Reviewer packet](../releases/v0.1.0/review/README.md) | |
| This guide is the navigation entry point for CodeDNA's schemas, evidence and | |
| reproduction procedures. Dataset and evidence paths remain stable. Current guides live here; the | |
| [report index](reports/README.md) identifies historical audit snapshots. | |
| ## Find what you need | |
| | Task | Reference | | |
| |---|---| | |
| | Inspect counts and coverage | [Statistics](../releases/v0.1.0/statistics.json) | | |
| | Read exact feature schemas | [Configuration schemas](../releases/v0.1.0/schemas.json) | | |
| | Check official membership | [Eligibility ledger](../releases/v0.1.0/eligibility.json) | | |
| | Understand scoring and splitting | [Benchmark methodology](methodology.md) | | |
| | Inspect runtime evidence | [Evidence report](reports/EVIDENCE_REPORT.md) and [application observations](../data/research/v3c1/runtime.json) | | |
| | Investigate excluded records | [Ground-truth audit](reports/GROUND_TRUTH_AUDIT.md) and [sink-context probe](../releases/v0.1.0/exclusion-audit.json) | | |
| | Review labels independently | [Review pages and forms](../releases/v0.1.0/review/README.md) and [review protocol](review.md) | | |
| | Reproduce container execution | [Application verification guide](../research/expansion/README.md) | | |
| | Inspect the acceptance checks | [Release report](reports/RELEASE_CANDIDATE_REPORT.md) and [recorded command outputs](../releases/v0.1.0/validation-results.json) | | |
| | Prepare a future version | [PowerShell release procedure](releasing.md) | | |
| ## Repository map | |
| ```text | |
| README.md Project overview and quick start | |
| docs/ Current guides, release notes and reports/ | |
| data/ Original snapshot and versioned research datasets | |
| curation/ Original example definitions | |
| research/ Fixtures, generators, verification and evaluation | |
| scripts/ Original dataset generation and validation | |
| tests/ Regression tests | |
| releases/v0.1.0/ Schemas, statistics, evidence ledger and review packet | |
| RELEASE_MANIFEST.json Checksums for the current main-branch snapshot | |
| LICENSE Apache-2.0 license | |
| ``` | |
| Historical reports are grouped under `docs/reports/`. Their phase names and | |
| recorded results describe earlier audit runs, not current deployment status. | |
| Use [release notes](releases.md) for the migrated release and current documentation. | |
| The immutable `v0.1.0` revision retains the original root-level report layout. | |
| ## Schema and labels | |
| The `default` configuration preserves eight string fields: `id`, `code`, `label`, | |
| `cwe_id`, `pattern`, `explanation`, `secure_fix` and `source_type`. | |
| Research configurations add `sample_id`, `pair_id`, family/split groups, | |
| `code_files`, source/sink locations, finding locations and evidence metadata. | |
| Application records also carry explicit assumptions, a threat model, CWE rationale, | |
| a source hash and `verification_contract`: a JSON string with benign/adversarial | |
| requests and expected outputs. Configurations have distinct schemas; combining | |
| them requires an explicit mapping. The JSON feature schemas are authoritative. | |
| `secure` and `insecure` are scoped to the stated mechanism and assumptions. | |
| A secure record's CWE identifies the weakness being avoided, not a positive | |
| finding. Paths are relative to each fixture, with one-based inclusive lines. | |
| Secure examples have no `vulnerable_lines`. The annotations are author-provided | |
| locations, not dynamic execution traces. | |
| New fixtures contain `app.py` and `service.py`. For example, `customer-search` | |
| compares SQL interpolation with parameter binding, testing both a normal lookup | |
| and a predicate-changing input. Actual observations are stored separately from | |
| expected outputs and are bound to source hashes. | |
| ## Evidence and eligibility | |
| The two official configurations contain 115 distinct records: 49 historical and | |
| 66 newer examples. Their populations are scored separately. Among those records, | |
| 82 have Docker runtime evidence and 33 have controlled local-process property | |
| evidence. Local audit-hook controls are not an OS sandbox; the release eligibility | |
| ledger makes this distinction explicit without rewriting historical terminology. | |
| The historical acceptance run recorded 65 regression tests and 140 application | |
| contract checks. The migrated release passed 66 regression tests, including the | |
| subsequently added privacy-log check. Historical logs retain their original counts. The application worker uses an image identified by content, no network or | |
| host mounts, non-root execution, dropped capabilities, a read-only root, bounded | |
| resources and timeouts. Legacy critical-CWE checks use a separate hardened worker. | |
| Mocks and parser-only outcomes do not qualify as equivalent runtime evidence. | |
| There are 39 excluded records: 35 legacy and four newer HTML/redirect records. | |
| The latter return JSON through their actual routes; the required HTML-rendering | |
| or redirect sink is absent. They remain research-only. No independent human | |
| reviews are complete. The 64-record review packet covers a stratified portion of | |
| the newer release, not all 154 records. | |
| ## Splits and evaluation | |
| Pairs, family groups and detected near duplicates stay together. Existing split | |
| assignments are preserved. The combined exact-text, AST and normalized-token audit | |
| found no cross-split near matches at the documented threshold; this is not proof | |
| of semantic independence. The original `default` snapshot contains held-out | |
| examples and must not be used as a training split for those same evaluations. | |
| Use only `code` or `code_files` as detector inputs. Fixes, contracts, labels, | |
| explanations and location annotations can leak the answer. The evaluator accepts | |
| binary predictions or primary-CWE/location findings and rejects stale evidence | |
| manifests before official scoring. | |
| The unchanged lexical baseline is a smoke test. On `official/test` (10 records), | |
| F1 is 0.571429 and balanced accuracy is 0.70. On `official_3c1/test` (23 records), | |
| F1 is 0.181818 and balanced accuracy is 0.55. Different populations make these | |
| unsuitable for claims of improvement or regression on a fixed test set. | |
| ## Reproduction | |
| The validated runtime uses Python 3.13. Create an isolated environment, then | |
| install the pinned development and dataset-loading dependencies: | |
| ```powershell | |
| python -m venv .venv | |
| $Python = Join-Path $PWD '.venv\Scripts\python.exe' | |
| & $Python -m pip install -r requirements-release.txt | |
| ``` | |
| With Docker's Linux engine running and the recorded application image available: | |
| ```powershell | |
| & $Python -m pytest -q | |
| & $Python -m scripts.generate_dataset --check | |
| & $Python -m research.build --check | |
| & $Python -m research.harden --check | |
| & $Python -m research.expansion.release --check | |
| & $Python -m research.release_candidate.historical | |
| & $Python -m research.release_candidate.check_loading | |
| ``` | |
| Check each command's exit code; PowerShell does not stop automatically on a native | |
| command failure. The `--check` commands compare generated artifacts without | |
| replacing the recorded dataset. Historical baseline reproduction is covered by | |
| `research.release_candidate.historical`. | |
| The application verification requires the recorded local Docker image or a | |
| `docker save`/`docker load` copy. Pinned dependencies support rebuilding, but a | |
| different image ID requires a separately recorded audit. See the | |
| [container guide](../research/expansion/README.md). | |
| To reproduce the exact released snapshot, use `v0.1.0`. To inspect the current | |
| documentation and relocated report paths, use `main`. Acceptance runners named | |
| `validate` write fresh logs and reports: run them only in a disposable working | |
| copy and do not upload those outputs over frozen evidence. | |
| The root `RELEASE_MANIFEST.json` describes the files in its own revision. The | |
| nested `releases/v0.1.0/RELEASE_MANIFEST.json` is a retained earlier staging | |
| manifest; it is **not** the manifest of the migrated `v0.1.0` Git tree. Use the | |
| root manifest at `revision="v0.1.0"` to validate that release. See | |
| [manifest semantics and release identifiers](releases.md). | |
| ## Scope, provenance and licensing | |
| Examples are original, AI-assisted synthetic educational code. No third-party | |
| dataset, proprietary source or real private record was imported. Credential-like | |
| values and sensitive-data markers are synthetic. Legacy Django metadata does not | |
| claim that a deployed Django application was verified. | |
| Small fixtures and limited test inputs do not model complete authentication | |
| deployments, distributed races, production databases or all hostile inputs. | |
| Shared adapters and synthetic names may create detector shortcuts. No independent | |
| validation, production representativeness, unrestricted training suitability or | |
| blanket security guarantee is claimed. | |
| Original code and annotations use [Apache-2.0](../LICENSE). Framework dependencies | |
| and MITRE CWE references retain their separate licenses and terms. | |