diff --git a/donors/af-02-adversarial-testing.yaml b/donors/af-02-adversarial-testing.yaml new file mode 100644 index 00000000..1d16a1c6 --- /dev/null +++ b/donors/af-02-adversarial-testing.yaml @@ -0,0 +1,105 @@ +schema: commandf.donor-manifest/v1 +updated: 2026-08-27 + +sources: + - id: rust-fuzz-cargo-fuzz + repository: https://github.com/rust-fuzz/cargo-fuzz + ref: 984c861c8dfea28055254c5f1d2659ab2cd63f76 + tag: 0.13.2 + license: MIT OR Apache-2.0 + mode: [DEPEND_DEV_TOOL, STUDY, ADAPT_CONFIG] + - id: sourcefrog-cargo-mutants + repository: https://github.com/sourcefrog/cargo-mutants + ref: 8ab1dc786a1f61a4e370416cc6c68b81a704e917 + tag: v27.1.0 + license: MIT + mode: [DEPEND_DEV_TOOL, STUDY, ADAPT_CONFIG] + - id: taiki-e-cargo-llvm-cov + repository: https://github.com/taiki-e/cargo-llvm-cov + ref: be59056988acd54c7f984b7c85643daea3711b29 + tag: v0.9.0 + license: Apache-2.0 OR MIT + mode: [DEPEND_DEV_TOOL, STUDY, ADAPT_CONFIG] + - id: nextest-rs-nextest + repository: https://github.com/nextest-rs/nextest + ref: 60fa45f638ffc3f35e74afa65737f45fcd32db2a + tag: cargo-nextest-0.9.143 + license: MIT OR Apache-2.0 + mode: [DEPEND_DEV_TOOL, STUDY, ADAPT_CONFIG] + - id: proptest-rs-proptest + repository: https://github.com/proptest-rs/proptest + ref: a6f033cf83adfd55557b86e6065e6f4df054ec70 + version: 1.11.0 + license: MIT OR Apache-2.0 + mode: [DEPEND_TEST_ONLY, STUDY, ADAPT_PATTERNS] + +adoption_decisions: + product_runtime: + use: none + rationale: AF-02 tools remain development/test assurance only. + fuzz: + use: + - "cargo-fuzz 0.13.2 at 984c861c8dfea28055254c5f1d2659ab2cd63f76" + - "libfuzzer-sys =0.4.13" + - "arbitrary =1.4.2 features=[derive]" + - "nightly-2026-08-25" + property: + use: [proptest =1.11.0] + flaky: + use: [cargo-nextest 0.9.143 at 60fa45f638ffc3f35e74afa65737f45fcd32db2a, --retries 2, --flaky-result fail] + coverage: + use: [cargo-llvm-cov 0.9.0 at be59056988acd54c7f984b7c85643daea3711b29] + mutation: + use: [cargo-mutants 27.1.0 at 8ab1dc786a1f61a4e370416cc6c68b81a704e917] + +immutable_acquisition_contract: + executable_mode: LOCKED_GIT_REV_SOURCE_BUILD + required_evidence: [exact upstream repository and commit, locked source/build command and dependency digest, installed executable SHA-256, version output SHA-256, compiler/cargo/target/features] + prohibited: [latest, branch-only identity, tag-only identity, self-update as retained proof identity, implementation-time acquisition-mode choice] + +registry_package_contract: + packages: + - syn =3.0.3 features=[full,visit] checksum=53e9bae58849f64dfa4f5d5ae372c8341f7305f82a3868709269343628b659a3 + - proptest =1.11.0 default-features + - libfuzzer-sys =0.4.13 default-features + - arbitrary =1.4.2 features=[derive] + rule: exact crates.io checksum MUST be canonical before the package activation stack executes dependent evidence. + +normative_contract: + path: specs/016-af-02-adversarial-test-strength/verification-protocol.md + policy_files: + - specs/016-af-02-adversarial-test-strength/tool-policy.json + - specs/016-af-02-adversarial-test-strength/exclusion-policy.json + - specs/016-af-02-adversarial-test-strength/waiver-policy.json + - specs/016-af-02-adversarial-test-strength/required-check-policy.json + - specs/016-af-02-adversarial-test-strength/semantic-contract.json + - specs/016-af-02-adversarial-test-strength/verifier-input-policy.json + inventory_files: + - specs/016-af-02-adversarial-test-strength/enforcement-inventory.json + schema_files: + - specs/016-af-02-adversarial-test-strength/schemas/af02-authority-baseline-v2.schema.json + - specs/016-af-02-adversarial-test-strength/schemas/af02-adversarial-proof-v1.schema.json + - specs/016-af-02-adversarial-test-strength/schemas/af02-adversarial-proof-core-v1.schema.json + - specs/016-af-02-adversarial-test-strength/schemas/af02-tool-policy-v1.schema.json + - specs/016-af-02-adversarial-test-strength/schemas/af02-tool-lock-v1.schema.json + - specs/016-af-02-adversarial-test-strength/schemas/af02-exclusion-policy-v1.schema.json + - specs/016-af-02-adversarial-test-strength/schemas/af02-evidence-inventories-v1.schema.json + - specs/016-af-02-adversarial-test-strength/schemas/af02-waiver-policy-v1.schema.json + - specs/016-af-02-adversarial-test-strength/schemas/af02-required-check-policy-v1.schema.json + - specs/016-af-02-adversarial-test-strength/schemas/af02-required-check-provenance-v1.schema.json + - specs/016-af-02-adversarial-test-strength/schemas/af02-retained-authority-sources-v1.schema.json + - specs/016-af-02-adversarial-test-strength/schemas/af02-semantic-contract-v1.schema.json + - specs/016-af-02-adversarial-test-strength/schemas/af02-verifier-input-policy-v1.schema.json + - specs/016-af-02-adversarial-test-strength/schemas/af02-surface-policy-v1.schema.json + - specs/016-af-02-adversarial-test-strength/schemas/af02-resource-policy-v1.schema.json + - specs/016-af-02-adversarial-test-strength/schemas/af02-corpus-v1.schema.json + - specs/016-af-02-adversarial-test-strength/schemas/af02-coverage-policy-v1.schema.json + - specs/016-af-02-adversarial-test-strength/schemas/af02-mutation-policy-v1.schema.json + - specs/016-af-02-adversarial-test-strength/schemas/af02-enforcement-inventory-v1.schema.json + +review_before_copy: + - verify exact source path and commit before copying upstream code + - preserve license notices where required + - prefer configuration/executable-tool adoption over vendoring + - re-audit every version/acquisition change through AF-01 workflow/dependency policy + - no adopted tool becomes commandF semantic authority diff --git a/specs/016-af-02-adversarial-test-strength/consistency.md b/specs/016-af-02-adversarial-test-strength/consistency.md new file mode 100644 index 00000000..8ccbb819 --- /dev/null +++ b/specs/016-af-02-adversarial-test-strength/consistency.md @@ -0,0 +1,112 @@ +# AF-02 Consistency Analysis — Adversarial Test Strength + +Status: PLANNING_CANDIDATE + +Canonical planning base: + +```text +main: 2b4033e237a5c74f3c45c12fbc7e7bfdc88067b1 +tree: 804ce63c15edb501574bd4aba9a9aadc5bfb07f3 +AF-01: CLOSED_CANONICAL +``` + +## Authority consistency + +AF-02 precedence is singular: + +1. repository governance/constitution/`AGENTS.md`; +2. `verification-protocol.md`, checked-in machine policies and schemas; +3. non-superseded `evidence-contracts.md`; +4. `spec.md`; +5. `plan.md`; +6. `tasks.md`; +7. this analysis and donor/provenance records. + +Authority-baseline v1 remains deprecated and non-implementable. Baseline v2 is the only authority-baseline schema. + +The final proof path and schema id remain `schemas/af02-adversarial-proof-v1.schema.json` / `commandf.af02-adversarial-proof/v1`. During planning it was strengthened into an envelope over the byte-identical prior schema now retained as `af02-adversarial-proof-core-v1.schema.json`. The core preserves the previous 25 contract roles and already contains the `enforcement_inventory` instance role. The envelope therefore adds 17 required extension roles, including only the standalone enforcement-inventory schema, so the final deterministic proof binds 42 distinct contract files without discarding or duplicating earlier structural constraints. The extension authority separately cross-binds the enforcement-inventory instance digest to the core role and the schema digest to the extension role. + +## Preserved external authority + +AF-02 does not weaken the active AF-01 assurance/review rulesets. Required contexts remain `assurance-proof`, `rust`, `scorecard`, each GitHub Actions integration id 15368. + +CF-06 remains HAPI FHIR `6.10.2`, source `d06577dbc5c62c74a2a8823fbc4830a3024d5b0b`, validator digest `a3addadfa18dfa23146a0a243b6ede68eaad92157a5407738c468bb3d7e4ccd6`, and R4 `hl7.fhir.r4.core@4.0.1`. + +CF-10 retained run `31916124080` remains `failure`. Its manifest/donor/run/artifact locators are validated against a closed schema and reconstructed from GitHub identity fields. AF-02 never relabels that production gate as PASS. + +## Reviewer finding closure + +The latest planning round is addressed as follows: + +- **Waiver authority:** `waiver-policy.json` + closed schema; zero initial waivers; canonical ancestry and mutant binding are named semantic-verifier algorithms. +- **Required-check provenance:** `required-check-policy.json` freezes repository, GitHub Actions app, workflow ids/paths/base blobs and job names; runtime provenance has a dedicated schema including run/job/check-suite/head/base identities. +- **Retained locator semantics:** exact repository/commit/blob/run/artifact URL relationships have a closed retained-authority schema; supplied URLs are reconstructed rather than trusted. +- **Prose-only semantic relations:** `semantic-contract.json` freezes algorithm ids, verifier package/path/entrypoint and required negative-fixture ids. Missing implementation/test mapping is non-green. +- **Candidate parser/resource boundary:** `verifier-input-policy.json` freezes preparse size/containment/symlink limits, JSON/YAML depth/record/string constraints, YAML safe-loader restrictions, aggregate wall-time/memory bounds, separate stdout/stderr byte ceilings, and observed-byte/overflow evidence. +- **Proof-critical policy schemas:** separate closed schemas now exist for surface, resource, corpus, coverage and mutation policy instances before dependent execution. +- **Enforcement-inventory closure:** `enforcement-inventory.json` and `schemas/af02-enforcement-inventory-v1.schema.json` freeze the 27-role activation inventory; the aggregate evidence schema requires exactly one runtime entry for each role. +- **Proof binding:** the proof envelope retains the original 25-role core, where `enforcement_inventory` already exists, and adds 17 exact extension contract roles including only `enforcement_inventory_schema`; final authority digests cross-bind the core instance and extension schema without duplicating a contract path. + +## Anti-self-forgery consistency + +A candidate cannot define both the acceptance rule and its own success. A0 bootstraps policy/schema/verifier infrastructure only. After A0 canonicalization, the base-controlled `pull_request_target` gate executes canonical-base workflow/verifier/schema blobs, never candidate code, and parses candidate data only under the input-limit policy. + +A same-candidate waiver, source exclusion, mutation exclusion, coverage floor reduction, policy weakening, verifier weakening or locator substitution cannot make dependent evidence green. + +## Source and coverage consistency + +Surface discovery and coverage share the same Git-derived tracked Rust universe: + +```text +crates/**/src/**/*.rs +tools/**/src/**/*.rs +``` + +minus canonical-base source exclusions only. Missing, unknown, duplicate-normalized or out-of-root paths fail instead of becoming implicit exclusions. + +Coverage policy is frozen before percentages. Coverage remains diagnostic evidence, not semantic authority. + +## Mutation consistency + +Mutation target paths, tool identity, test command, timeout/retry/diagnosis, exclusion policy and waiver policy freeze before listing. + +Required membership is deterministic: + +```text +all listed mutants in target scope +minus exactly matched pre-frozen exclusions +``` + +There is no top-N, percentage, operator preference or post-result manual subset. A waiver resolves only through canonical waiver authority and cannot be introduced by the candidate it greens. + +## Required-check consistency + +Integration id 15368 alone is insufficient. Qualification binds each context to repository, GitHub Actions app identity, canonical-base workflow id/path/blob, workflow run/attempt, job name/id, exact head/base, pull_request event and success. + +## Parser and resource consistency + +The privileged/base-controlled verifier treats candidate files as hostile data. Size is checked before parsing. Symlinks/path escapes are rejected. JSON and YAML have explicit depth/item/string bounds. YAML aliases, merge keys and custom tags are prohibited. Aggregate file/record/byte, parser wall-time and memory limits are fixed. Parent-enforced stdout/stderr byte ceilings are fixed separately, and evidence retains observed bytes plus overflow classification for both streams. Parser exhaustion or output-limit breach is failure, not neutral topology. + +## Tool and corpus consistency + +Executable tools retain immutable source and installed-binary identity. Registry packages cannot activate with unresolved checksums. + +Corpus entries remain synthetic/publicly redistributable non-PHI only, <=256 KiB by default and <=8 MiB aggregate. Corpus/assertion/replay membership is bijective and independently reconstructed. + +## Nextest consistency + +The fixed retry-pass fixture uses retries 2 and flaky-result fail. First failure then retry pass remains failed AF-02 evidence with non-zero process exit. JUnit/stdout/stderr/exit are bound to one waited-for process and dedicated clean output mount. + +## Temporal boundary + +T005/T006 evidence lives in GitHub because a commit cannot contain proof of its own future exact-head CI/review/merge. No planning merge occurs until the current head qualifies, and no implementation authority exists until post-merge main/tree plus live AF-01 rulesets are re-read. + +## Current decision + +```text +AF-02: PLANNING_CANDIDATE +T005: OPEN +T006: OPEN +IMPLEMENTATION AUTHORITY: NOT_GRANTED +NEXT AUTHORITY AFTER T006: STACK A0 ONLY +``` diff --git a/specs/016-af-02-adversarial-test-strength/enforcement-inventory.json b/specs/016-af-02-adversarial-test-strength/enforcement-inventory.json new file mode 100644 index 00000000..831fb10c --- /dev/null +++ b/specs/016-af-02-adversarial-test-strength/enforcement-inventory.json @@ -0,0 +1 @@ +{"schema":"commandf.af02-enforcement-inventory/v1","policy_status":"PLANNING_FREEZE","entries":[{"role":"AF02_SCHEMA","required_from_stack":"A0","implementation_kind":"SCHEMA_SET","planned_path":"specs/016-af-02-adversarial-test-strength/schemas/","entrypoint":"validate-all"},{"role":"AUTHORITY_PROJECTOR","required_from_stack":"A0","implementation_kind":"RUST_MODULE","planned_path":"tools/af02-verifier/src/authority.rs","entrypoint":"project-authority"},{"role":"RETAINED_AUTHORITY_PROJECTOR","required_from_stack":"A0","implementation_kind":"RUST_MODULE","planned_path":"tools/af02-verifier/src/retained.rs","entrypoint":"project-retained"},{"role":"SURFACE_SCANNER","required_from_stack":"A0","implementation_kind":"RUST_MODULE","planned_path":"tools/af02-verifier/src/surface.rs","entrypoint":"scan-surface"},{"role":"SURFACE_POLICY_PARSER","required_from_stack":"A0","implementation_kind":"RUST_MODULE","planned_path":"tools/af02-verifier/src/surface.rs","entrypoint":"parse-surface-policy"},{"role":"RESOURCE_RUNNER","required_from_stack":"A0","implementation_kind":"RUST_MODULE","planned_path":"tools/af02-verifier/src/resource.rs","entrypoint":"run-bounded"},{"role":"RESOURCE_POLICY_PARSER","required_from_stack":"A0","implementation_kind":"RUST_MODULE","planned_path":"tools/af02-verifier/src/resource.rs","entrypoint":"parse-resource-policy"},{"role":"TOOL_ACQUISITION_VERIFIER","required_from_stack":"A0","implementation_kind":"RUST_MODULE","planned_path":"tools/af02-verifier/src/tool_lock.rs","entrypoint":"verify-tool-lock"},{"role":"CORPUS_MANIFEST_PARSER","required_from_stack":"A0","implementation_kind":"RUST_MODULE","planned_path":"tools/af02-verifier/src/corpus.rs","entrypoint":"parse-corpus"},{"role":"ASSERTION_REGISTRY_PARSER","required_from_stack":"A0","implementation_kind":"RUST_MODULE","planned_path":"tools/af02-verifier/src/corpus.rs","entrypoint":"parse-assertions"},{"role":"VERIFIER_INPUT_GUARD","required_from_stack":"A0","implementation_kind":"RUST_MODULE","planned_path":"tools/af02-verifier/src/input_guard.rs","entrypoint":"guard-inputs"},{"role":"BASE_POLICY_COMPARATOR","required_from_stack":"A0","implementation_kind":"RUST_MODULE","planned_path":"tools/af02-verifier/src/policy.rs","entrypoint":"compare-base-policy"},{"role":"SEMANTIC_CONTRACT_VERIFIER","required_from_stack":"A0","implementation_kind":"RUST_MODULE","planned_path":"tools/af02-verifier/src/semantic.rs","entrypoint":"verify-semantic-contract"},{"role":"REQUIRED_CHECK_PROVENANCE_VERIFIER","required_from_stack":"A0","implementation_kind":"RUST_MODULE","planned_path":"tools/af02-verifier/src/github_provenance.rs","entrypoint":"verify-required-checks"},{"role":"AF02_WORKFLOW","required_from_stack":"A0","implementation_kind":"WORKFLOW","planned_path":".github/workflows/af02-base-verifier.yml","entrypoint":"af02-base-verifier"},{"role":"AF02_ACTION_OR_SCRIPT","required_from_stack":"A0","implementation_kind":"SCRIPT","planned_path":".github/scripts/run_af02_base_verifier.sh","entrypoint":"run-af02-base-verifier"},{"role":"REPLAY_RUNNER","required_from_stack":"A1","implementation_kind":"RUST_MODULE","planned_path":"tools/af02-verifier/src/replay.rs","entrypoint":"run-replay"},{"role":"RESULT_NORMALIZER","required_from_stack":"A1","implementation_kind":"RUST_MODULE","planned_path":"tools/af02-verifier/src/replay.rs","entrypoint":"normalize-result"},{"role":"NEXTEST_RESULT_PARSER","required_from_stack":"B0","implementation_kind":"RUST_MODULE","planned_path":"tools/af02-verifier/src/nextest.rs","entrypoint":"parse-nextest"},{"role":"COVERAGE_REPORT_PARSER","required_from_stack":"B0","implementation_kind":"RUST_MODULE","planned_path":"tools/af02-verifier/src/coverage.rs","entrypoint":"parse-coverage"},{"role":"COVERAGE_POLICY_PARSER","required_from_stack":"B0","implementation_kind":"RUST_MODULE","planned_path":"tools/af02-verifier/src/coverage.rs","entrypoint":"parse-coverage-policy"},{"role":"MUTATION_INVENTORY_PARSER","required_from_stack":"C0","implementation_kind":"RUST_MODULE","planned_path":"tools/af02-verifier/src/mutation.rs","entrypoint":"parse-mutation-inventory"},{"role":"MUTATION_RESULT_PARSER","required_from_stack":"C0","implementation_kind":"RUST_MODULE","planned_path":"tools/af02-verifier/src/mutation.rs","entrypoint":"parse-mutation-results"},{"role":"MUTATION_POLICY_PARSER","required_from_stack":"C0","implementation_kind":"RUST_MODULE","planned_path":"tools/af02-verifier/src/mutation.rs","entrypoint":"parse-mutation-policy"},{"role":"WAIVER_POLICY_VERIFIER","required_from_stack":"C0","implementation_kind":"RUST_MODULE","planned_path":"tools/af02-verifier/src/waiver.rs","entrypoint":"verify-waivers"},{"role":"PROOF_BUILDER","required_from_stack":"C0","implementation_kind":"RUST_MODULE","planned_path":"tools/af02-verifier/src/proof.rs","entrypoint":"build-proof"},{"role":"PROOF_VERIFIER","required_from_stack":"C0","implementation_kind":"RUST_MODULE","planned_path":"tools/af02-verifier/src/proof.rs","entrypoint":"verify-proof"}],"closure_rule":"EXACT_ROLE_SET_NO_DUPLICATES_ACTIVE_PATHS_MUST_RESOLVE_AT_OR_AFTER_REQUIRED_STACK"} \ No newline at end of file diff --git a/specs/016-af-02-adversarial-test-strength/evidence-contracts.md b/specs/016-af-02-adversarial-test-strength/evidence-contracts.md new file mode 100644 index 00000000..7f38b891 --- /dev/null +++ b/specs/016-af-02-adversarial-test-strength/evidence-contracts.md @@ -0,0 +1,349 @@ +# AF-02 Normative Evidence Contracts + +Status: PLANNING_CANDIDATE + +This file is normative for AF-02 only where it is not superseded by the higher-precedence closed verification protocol and machine-readable schemas. + +Authoritative precedence: + +1. repository constitution/governance and `AGENTS.md`; +2. `verification-protocol.md`; +3. `schemas/af02-authority-baseline-v2.schema.json` and `schemas/af02-adversarial-proof-v1.schema.json`; +4. this file; +5. `spec.md`, `plan.md`, `tasks.md`, `consistency.md`, donor/provenance records. + +If a lower-precedence document is looser or contradictory, the higher-precedence fail-closed rule controls. A future weakening requires a dedicated reviewed policy/verifier change under the previously canonical contract. + +## 1. Canonical planning authority + +Planning base: + +```text +main: 2b4033e237a5c74f3c45c12fbc7e7bfdc88067b1 +tree: 804ce63c15edb501574bd4aba9a9aadc5bfb07f3 +AF-01: CLOSED_CANONICAL +``` + +External authorities are inputs, not AF-02-owned semantics. + +### AF-01 + +Live rulesets: + +```text +21652953 commandF main assurance +21652974 commandF main review governance +``` + +AF-02 reconstructs the closed semantic projections defined in `verification-protocol.md` from live GitHub ruleset read-back. The older illustrative semantic digests previously recorded in this file are superseded by the closed projection definitions in `verification-protocol.md`. + +### CF-06 + +Frozen production identity unless separately changed canonically: + +```text +project: hapifhir/org.hl7.fhir.core +release: 6.10.2 +source_commit: d06577dbc5c62c74a2a8823fbc4830a3024d5b0b +validator_cli_jar_sha256: a3addadfa18dfa23146a0a243b6ede68eaad92157a5407738c468bb3d7e4ccd6 +R4_core_context: hl7.fhir.r4.core@4.0.1 +``` + +The authority projector derives this from canonical-base repository source files named in the protocol; candidate AF-02 prose is never source authority. + +### CF-10 + +Frozen deltas: + +```text +C001 hl7.fhir.us.core 8.0.1 -> 9.0.0 +C002 hl7.fhir.uv.ips 1.1.0 -> 2.0.1 +C003 hl7.fhir.us.mcode 3.0.0 -> 4.0.0 +``` + +Retained evidence: + +```text +PR: 11 +head: 5fe10d9859407272acf6649fc3e868d3eb2fbd12 +base: 5cb1a4c3445c0ebd86654cfb467a5e008e801c3e +run: 31916124080 +run conclusion: failure +artifact_id: 9255732702 +artifact_name: cf10-real-corpus-evidence +artifact_sha256: 9fdde985bb5abbe53ec2bce2dadc5f65c95557f8848c9af68755fc81a45af612 +``` + +The exact retained manifest/donor commit, path, Git blob SHA, and API locators are machine-readable in `retained-authority-sources.json`. Current `main` presence is not assumed. The retained failed run is never relabeled as CF-10 production success. + +## 2. Authority baseline schema transition + +The earlier planning-only `commandf.af02-authority-baseline/v1` shape is **deprecated and non-implementable**. It MUST NOT be accepted by AF-02 code. + +The only implementation schema is: + +```text +commandf.af02-authority-baseline/v2 +schemas/af02-authority-baseline-v2.schema.json +``` + +The v2 schema structurally requires: + +- canonical captured main SHA/tree; +- both AF-01 live ruleset projection identities; +- exact CF-06 projection plus authoritative source digests; +- exactly three CF-10 deltas; +- exactly six expanded CF-10 states; +- retained PR/head/base/run/conclusion/artifact id/name/digest; +- retained manifest/donor Git blob identities and derived raw SHA-256; +- CF-10 semantic projection digest. + +Candidate editing of a baseline can never establish the authority it claims to describe. + +## 3. Surface discovery contract + +AF-02 uses one deterministic AST discovery model, not an implementation-time choice between scanners. + +The Git-derived Rust source universe is: + +```text +crates/**/src/**/*.rs +tools/**/src/**/*.rs +``` + +minus only exact previously canonical reviewed non-product exclusions. + +The scanner uses `syn=3.0.3` with locked registry checksum and frozen features `[full, visit]`. It parses every source-universe file and visits production-tracked syntax regardless of cfg/dead-code reachability. Comments and string literals do not create executable matches. Alias/import handling, conservative macro handling, uncertain method-call handling, and stale-entry behavior are specified in the protocol. + +Frozen boundary categories: + +```text +SERDE_OR_TEXT_PARSE +ARCHIVE_OR_COMPRESSION +FILESYSTEM +NETWORK_OR_ACQUISITION +CACHE_OR_PERSISTENCE +SUBPROCESS +``` + +Every finding has exactly one disposition: + +```text +CRITICAL_SURFACE: +REVIEWED_EXCLUSION: +``` + +Unclassified, multiply classified, stale, or unresolved source entries fail. + +## 4. Resource/offline contract + +`commandf.af02-resource-policy/v1` is executable policy. It includes at minimum: + +```text +campaign_wall_seconds +max_executions_or_zero_if_time_bounded +per_input_timeout_seconds +max_input_bytes +process_memory_mib +cpu_count +pids_limit +tmpfs_mib +max_decompressed_or_generated_bytes +max_temporary_files +subprocess_timeout_seconds +max_single_artifact_bytes +max_total_artifact_bytes +max_committed_corpus_bytes +artifact_retention_days +offline_required +``` + +Canonical deterministic qualification uses the digest-pinned Linux OCI image and exact runtime enforcement from the protocol. Network-enabled acquisition and network-denied execution are separate phases. + +A required run with missing/ambiguous network, cgroup, tmpfs, mount, timeout, or negative-probe evidence is incomplete, never green. + +## 5. Tool-lock contract + +Every executable AF-02 tool uses one of: + +```text +LOCKED_GIT_REV_SOURCE_BUILD +IMMUTABLE_RELEASE_ASSET_WITH_SHA256 +``` + +Executable evidence records: + +```text +id +version +upstream_repository +upstream_commit +acquisition_mode +source_lock_sha256_or_release_asset_sha256 +installed_executable +installed_executable_sha256 +version_output_sha256 +build_rustc +build_cargo +build_target +features[] +``` + +Registry/test packages record exact package, version, registry checksum and features. Upstream commit alone is never treated as an installed binary identity. + +Initial tools remain: + +```text +cargo-fuzz 0.13.2 @ 984c861c8dfea28055254c5f1d2659ab2cd63f76 +cargo-nextest 0.9.143 @ 60fa45f638ffc3f35e74afa65737f45fcd32db2a +cargo-llvm-cov 0.9.0 @ be59056988acd54c7f984b7c85643daea3711b29 +cargo-mutants 27.1.0 @ 8ab1dc786a1f61a4e370416cc6c68b81a704e917 +proptest =1.11.0 +libfuzzer-sys =0.4.13 +arbitrary =1.4.2 +nightly-2026-08-25 fuzz-only +product Rust 1.97.1 +``` + +## 6. Property/model contract + +Each property family records stable property id, surface id, generator model, validity domain, invalidity mutations, collection/depth limits, case count, seed/shrink policy, expected model, and independent oracle/model identity. + +Initial independent models cover archive manifest contents, Lockfile graph/canonical order, portable paths, canonical-reference resolution, graph ordering, and gate/fingerprint/suppression set/truth-table behavior. + +Calling the same product implementation twice is not independent evidence. + +## 7. Corpus and replay contract + +`commandf.af02-corpus/v1` contains stable scenario IDs, exact fixture path/SHA-256/bytes/provenance/expected outcome, assertion id, replay identity, discovery origin, and minimization lineage. + +Default promoted fixture maximum: `256 KiB`. +Aggregate committed AF-02 corpus maximum: `8 MiB`. + +No PHI or patient-derived data may enter source, corpus, artifacts, logs, or crash retention. Public-source/license ambiguity is metadata-only until resolved. + +`commandf.af02-assertion-registry/v1` is bijective with the corpus. Exact runner kind, package/binary, target/test, argv, cwd, environment allowlist, parser, source/config digests and expected normalized outcome are bound. Shell command strings are not authority. + +## 8. Deterministic outcome contract + +Allowed normalized deterministic surface outcomes: + +```text +ACCEPT_CANONICAL +REJECT_INVALID +FAIL_CLOSED_LIMIT +UNEXPECTED_ACCEPTANCE +INVARIANT_VIOLATION +ORACLE_DIVERGENCE +PANIC_OR_ABORT +HARNESS_TIMEOUT +HARNESS_MEMORY_LIMIT +HARNESS_FILESYSTEM_LIMIT +HARNESS_PROCESS_LIMIT +HARNESS_INTERNAL_ERROR +``` + +Only outcomes explicitly allowed by the surface policy can be green. Any unexpected acceptance, invariant violation, oracle divergence, panic/abort, or unresolved harness/resource failure blocks qualification and requires diagnosis; discovered defects require deterministic minimized replay before closure. + +## 9. Nextest contract + +Pinned nextest is `0.9.143`. + +Both config and command line enforce: + +```text +retries = 2 +flaky-result = fail +--retries 2 +--flaky-result fail +``` + +The canonical isolated fixture is defined in the protocol. The runner proves its dedicated output mount clean before execution and binds the newly created JUnit file, stdout, stderr and process exit into one waited-for process envelope. A retry-pass result is `FLAKY_RETRY_PASS` and the process must be non-zero. + +## 10. Coverage contract + +Coverage uses a descriptor frozen before observing percentages. Source authority is the same Git-derived Rust universe used by surface discovery: + +```text +crates/**/src/**/*.rs +tools/**/src/**/*.rs +``` + +minus exact previous exclusions only. + +Every authoritative source path appears exactly once in the raw report, including zero-hit files. Missing, unknown, duplicate-normalized, out-of-root or zero-total critical scope fails. + +Workspace and critical-surface floors use checked integer arithmetic: + +```text +floor_percent = (covered * 100) // total +``` + +Floor/scope/exclusion/command/test-selection weakening cannot self-green in the same candidate. + +## 11. Mutation contract + +Before listing/execution, C0 freezes exact target paths, exact exclusions, tool lock, command/config and timeout/test authority. + +Then: + +```text +required = every cargo-mutants-listed mutant inside frozen target paths + minus exact pre-frozen reviewed exclusions +``` + +No top-N, percentage, operator priority, security-interest subset, or post-result manual selection exists. + +Result classes remain separate: + +```text +KILLED +SURVIVED +TIMEOUT +UNVIABLE_OR_BUILD_FAILURE +WAIVED_EQUIVALENT_OR_OUT_OF_SCOPE +``` + +Required `SURVIVED`, `TIMEOUT`, `UNVIABLE_OR_BUILD_FAILURE`, or unclassified results are non-green. Retry/diagnosis is mandatory. A waiver used for qualification must already be canonical before the implementation candidate. + +## 12. Proof and anti-forgery contract + +The only structural proof schema is: + +```text +commandf.af02-adversarial-proof/v1 +schemas/af02-adversarial-proof-v1.schema.json +``` + +The schema rejects unknown fields and freezes scalar types, nullability, identity/digest patterns, enum values, cardinalities, conditional tool shapes, fixed green-state fields and bounded counters. + +`verification-protocol.md` supplies semantic invariants not safely expressible in JSON Schema: ordering/uniqueness, arithmetic relations, exact required-check membership, cross-artifact digest relationships, path containment and base/candidate authority rules. + +The independent verifier reconstructs deterministic evidence from raw artifacts. Producer-created normalized summaries are never source authority. + +After A0 canonicalization, all policy/schema/verifier/scanner/parser/result/workflow/enforcement-inventory changes are judged by a canonical-base-controlled verifier execution anchor. Candidate workflow code cannot choose, replace, skip or relabel that base verifier. + +## 13. Stochastic discovery contract + +Stochastic fuzzing is observational only. Allowed classes: + +```text +NO_CRASH_OBSERVED_WITHIN_BOUND +DEFECT_DISCOVERED +INCOMPLETE_RESOURCE_OR_HARNESS_FAILURE +CANCELLED_OR_SUPERSEDED +``` + +Stochastic fields are outside `AF02_ADVERSARIAL_SHA256`. “No crash within bound” is never a correctness PASS. + +## 14. Planning/implementation ordering + +Planning T006 must be canonical before A0. +A0 must be canonical before A1. +A1 must be canonical before B0. +B0 must be canonical before B1. +B1 must be canonical before C0. +C0 must be canonical before C1. +C1 must be canonical before final convergence. + +Every stack uses exact-head CI, fresh reviewers when available, zero unresolved substantive findings, expected-head guarded merge and post-merge authority read-back. No later head inherits earlier-head qualification. diff --git a/specs/016-af-02-adversarial-test-strength/exclusion-policy.json b/specs/016-af-02-adversarial-test-strength/exclusion-policy.json new file mode 100644 index 00000000..8bcfb62c --- /dev/null +++ b/specs/016-af-02-adversarial-test-strength/exclusion-policy.json @@ -0,0 +1,14 @@ +{ + "schema": "commandf.af02-exclusion-policy/v1", + "policy_base_sha": "2b4033e237a5c74f3c45c12fbc7e7bfdc88067b1", + "policy_base_tree": "804ce63c15edb501574bd4aba9a9aadc5bfb07f3", + "production_source_exclusions": [], + "mutation_exclusions": [], + "rules": { + "surface_and_coverage_share_production_source_exclusions": true, + "new_exclusion_requires_prior_canonical_policy_change": true, + "same_candidate_exclusion_cannot_make_dependent_evidence_green": true, + "post_result_exclusion_creation_prohibited": true, + "unlisted_exclusion_prohibited": true + } +} diff --git a/specs/016-af-02-adversarial-test-strength/plan.md b/specs/016-af-02-adversarial-test-strength/plan.md new file mode 100644 index 00000000..26b482e1 --- /dev/null +++ b/specs/016-af-02-adversarial-test-strength/plan.md @@ -0,0 +1,353 @@ +# AF-02 Plan — Adversarial Test Strength + +Status: PLANNING_CANDIDATE + +## Entry condition + +Canonical planning base: + +```text +main: 2b4033e237a5c74f3c45c12fbc7e7bfdc88067b1 +tree: 804ce63c15edb501574bd4aba9a9aadc5bfb07f3 +AF-01: CLOSED_CANONICAL +``` + +AF-02 implementation starts only after this planning package is exact-head qualified, independently reviewed, merged to canonical `main`, and post-merge authority is re-read. + +The first authorized implementation unit after planning closure is **Stack A0 design freeze**. No fuzz/property result may be used for closure before A0 is canonical. + +## Normative contract set + +Implementation follows the precedence in `spec.md`: + +1. repository governance/constitution/`AGENTS.md`; +2. `verification-protocol.md` and machine-readable schemas; +3. `evidence-contracts.md` for non-superseded requirements; +4. `spec.md`; +5. this plan; +6. `tasks.md`; +7. consistency/donor/provenance records. + +The old illustrative authority-baseline v1 shape in `evidence-contracts.md` is not implementable authority. The closed baseline is `commandf.af02-authority-baseline/v2` in `schemas/af02-authority-baseline-v2.schema.json`. + +## Architecture summary + +AF-02 adds an assurance/evidence plane around the existing commandF Rust product core. It adds no new user-facing semantic engine and does not change CF-06/CF-10 authority. + +Evidence classes remain separate: + +1. deterministic regression/property evidence; +2. deterministic coverage evidence; +3. deterministic frozen-scope mutation evidence; +4. stochastic fuzz-discovery observations. + +The final verifier reconstructs deterministic evidence from raw inputs. Stochastic observations are retained but excluded from `AF02_ADVERSARIAL_SHA256`. + +## Existing high-risk boundary inventory + +### Archive/package ingestion + +`crates/commandf-pkg/src/archive.rs` handles gzip/tar input, manifest limits, archive-entry limits, decompressed scan limits, and normalized package paths. Fuzzing enters through an existing public product seam and does not publish private API merely for fuzzing. + +### Lockfile retained evidence + +Lockfile V1/V2 parsing/canonicalization/validation is a critical structured-property and mutation surface because malformed persisted evidence must not be silently normalized into authority. + +### Source mapping and portable paths + +CF-09 source mapping enforces source-root containment, portable relative paths, bounded report/input size, line ranges, duplicate-output rejection, and report consistency. AF-02 reaches the narrowest existing public or internal test seam; no public API is added solely for fuzz tooling. + +### Context graph and canonical references + +Graph construction consumes verified lock/cache evidence and canonical references, then sorts/deduplicates nodes and edges. Important properties are order independence and explicit resolved/ambiguous/external status. + +### Compatibility/check/gate evidence + +Canonical fingerprints, baseline/suppression membership, report validators, and quality-gate decisions are false-PASS-critical surfaces. Properties cover JSON key ordering, set ordering, evaluate-then-validate agreement, and tamper rejection. + +### Acquisition/cache/subprocess boundaries + +Registry responses, local mirrors, cache reads/writes/reuse, archive scans, and external-process boundaries belong to the deterministic source scanner inventory even when a particular fuzz target uses an offline seam. + +## Frozen initial tool identities + +```text +cargo-fuzz 0.13.2 + upstream 984c861c8dfea28055254c5f1d2659ab2cd63f76 + +libfuzzer-sys =0.4.13 +arbitrary =1.4.2 +fuzz compiler nightly-2026-08-25 + +proptest =1.11.0 + +cargo-nextest 0.9.143 + upstream 60fa45f638ffc3f35e74afa65737f45fcd32db2a + +cargo-llvm-cov 0.9.0 + upstream be59056988acd54c7f984b7c85643daea3711b29 + +cargo-mutants 27.1.0 + upstream 8ab1dc786a1f61a4e370416cc6c68b81a704e917 + +surface parser: syn =3.0.3 + source registry+https://github.com/rust-lang/crates.io-index + features [full, visit] + +normal product Rust 1.97.1 +``` + +Every executable tool uses the immutable acquisition models in the tool-lock contract and records installed binary digest plus compiler/target/features. Exact registry checksums are read from canonical locked metadata and retained before use. + +## Retained authority source resolution + +CF-10 authority is not expected to exist on current `main`. AF-02 explicitly references retained source blobs through: + +```text +retained-authority-sources.json +``` + +That file binds repository, retained commit, path, Git blob SHA, PR/base/run/artifact identities, and API locators. The authority projector fetches those exact retained blobs by commit/blob identity and computes raw SHA-256 itself. Hard-coded case values alone are not sufficient. + +CF-06 is reconstructed from canonical-base `oracle_model.rs`, donor metadata, and `cf06-oracle.yml`. AF-01 is reconstructed from the two live ruleset endpoints. + +## Stack A0 — design freeze and base-controlled enforcement + +A0 is policy/verifier infrastructure only. It MUST NOT use newly generated fuzz/property results as evidence that A0 itself is correct. + +### A0.1 Authority baseline v2 + +Create machine-readable `commandf.af02-authority-baseline/v2` validated by `schemas/af02-authority-baseline-v2.schema.json`. + +It records independently derived: + +- AF-01 assurance/review projection digests; +- CF-06 exact projection and authoritative source digests; +- CF-10 exactly three deltas and six states; +- retained PR/head/base/run/conclusion/artifact id/name/digest; +- retained manifest/donor Git blob identities and derived raw SHA-256. + +Candidate-edited baseline values never establish authority. + +### A0.2 Deterministic surface policy + +Implement one `syn=3.0.3` AST scanner over Git-tracked `.rs` source under: + +```text +crates/**/src/** +tools/**/src/** +``` + +The protocol freezes alias/macro/comment/string/cfg/dead-code and stale-entry semantics. Every finding gets exactly one disposition. The scanner dependency checksum, scanner source, matcher policy, source universe, and raw/classified inventories are evidence. + +### A0.3 Resource/offline policy + +Freeze checked-in campaign/per-input memory/CPU/PID/tmpfs/generated/decompressed/temp-file/subprocess/artifact/corpus/retention limits. + +Canonical proof execution uses the digest-pinned Linux Rust container with network none, read-only root/source, dedicated writable output, cgroup limits, tmpfs, runtime inspection, and negative network/write probes. “Equivalent mechanism” is not canonical proof authority. + +### A0.4 Tool lock + +For each executable, freeze one acquisition mode: + +- locked exact-revision source build; or +- immutable release asset with verified SHA-256. + +For crates, retain exact registry package/version/checksum. Record commands, compiler, cargo, target, features, executable SHA-256, and version-output digest. + +### A0.5 Property/model design + +Freeze independently expressed model registries for archive manifest behavior, Lockfile graph/canonicalization, portable paths, canonical-reference resolution, graph ordering, and gate/fingerprint/suppression truth tables. + +### A0.6 Corpus/assertion design + +Freeze corpus manifest and `commandf.af02-assertion-registry/v1` before discovery results. Each scenario/registry entry is bijective and binds runner kind, target, exact argv, expected normalized outcome, parser, source/config digests, provenance, and fixture digest. + +### A0.7 Proof schemas + +Adopt the machine-readable closed schemas: + +```text +schemas/af02-authority-baseline-v2.schema.json +schemas/af02-adversarial-proof-v1.schema.json +``` + +Schema files and SHA-256 are mandatory proof contract files. Repository-owned semantic validation adds cross-field/arithmetic/path relations that JSON Schema alone cannot express. + +### A0.8 Base-verifier execution anchor + +A0 introduces a base-controlled GitHub Actions gate using `pull_request_target` semantics so candidate workflow code cannot decide whether its own verifier weakening is accepted. + +The base-controlled job MUST: + +- execute workflow/script/verifier blobs from the PR canonical base, not candidate copies; +- use read-only GitHub permissions; +- check out base and candidate into separate directories with credentials disabled; +- never execute candidate code in the base-controlled job; +- treat candidate policy/evidence as data only; +- record exact base workflow, verifier, schema, and enforcement-inventory blob SHAs; +- trigger for every AF-02 policy/schema/verifier/scanner/parser/result/workflow/inventory path; +- fail if the base verifier cannot run or parse candidate evidence. + +A0 first proves this check has universal terminal topology. Only then may a separate live-policy reconciliation add the new check to the AF-01 assurance ruleset. Read-back is mandatory before A0 merge if promoted. + +## Stack A1 — fuzz/property/regression implementation + +A1 starts only after A0 is canonical. + +### Fuzz workspace + +Expected layout: + +```text +fuzz/ + Cargo.toml + rust-toolchain.toml + fuzz_targets/ + corpus/ + artifacts/ # generated, ignored +``` + +The nightly/libFuzzer workspace remains isolated from normal product dependency authority. + +### Required reachability + +Initial target families cover package archive bytes, Lockfile JSON/structured forms, retained report evidence, context graph/reference shapes, and source-map/path semantics. + +One raw fuzzer plus properties may jointly cover a surface when that exercises the real public/internal seam more strongly than forcing every path through libFuzzer. + +### Harness bounds + +Routine raw input cap is `1 MiB` unless a narrower surface limit applies. Structured collection/depth sizes are small and policy-bound. Production maximums implying routine multi-hundred-MiB allocations are not normal fuzz iteration sizes. + +Every run uses A0's OCI/offline/resource runner. + +### Regression promotion + +Every crash/invariant failure/unexpected acceptance/property counterexample is minimized and committed only when provenance/no-PHI rules permit. Default fixture <=256 KiB and aggregate committed corpus <=8 MiB. + +A1 cannot close while a discovered defect lacks a deterministic assertion/replay entry. + +## Stack B0 — flaky/coverage design freeze + +B0 contains policy/fixture/parser design only. + +### Nextest fixture + +Freeze the isolated fixture specified by `verification-protocol.md`: + +```text +tests/assurance/af02-nextest-flake-fixture/ +selected test: af02_retry_pass_is_failure +``` + +Invocation forces `--retries 2 --flaky-result fail` so per-test overrides cannot weaken the result. + +The JUnit output root is an **empty dedicated output mount created by the base-controlled runner**. Before nextest: + +- parent exists with mode 0700 and expected unprivileged UID/GID; +- target JUnit path does not exist; +- no path component is symlink; +- output mount is empty except runner-created directories. + +After nextest: + +- JUnit path is a regular non-symlink file owned by the expected UID; +- it resides on the dedicated output mount; +- link count is one; +- the base-controlled runner opens/hashes it directly after process wait; +- no wrapper-supplied alternate path is accepted; +- raw stdout/stderr/exit and JUnit hash are captured together in the same runner result envelope. + +The state-file protocol proves deterministic first-fail/retry-pass behavior. JUnit must contain the selected testcase's flaky retry history and process exit must remain non-zero. + +### Coverage descriptor + +Before measuring percentage, freeze exact source/tree, Linux/x86_64, Rust/tool identity, command, Cargo inputs, replay/property inputs, and exclusions. + +Coverage source universe matches surface source universe for tracked Rust production paths: + +```text +crates/**/src/**/*.rs +tools/**/src/**/*.rs +``` + +Only exact previously canonical non-product exclusions can remove a path. Every production source appears exactly once in the report, including zero-hit files. Missing/unknown/duplicate paths fail. + +## Stack B1 — flaky/coverage execution + +After B0 canonical: + +- run canonical `cargo test --workspace --all-features --locked`; +- run nextest ordinary suite and retry-pass self-test; +- collect coverage from the frozen command/input set; +- derive workspace and each critical-surface floor independently from exact integer covered/total pairs; +- fail on any floor decrease, missing path, descriptor drift, or same-candidate scope weakening. + +A coverage-policy/floor/exclusion change must be a dedicated policy-only PR evaluated under the prior policy; it cannot modify product source, tests, or the measurement command. A later candidate adopts the new baseline. + +## Stack C0 — mutation/proof design freeze + +C0 freezes mutation target source paths and exact exclusions **before listing or executing mutants**. + +### Complete required mutant set + +Run pinned cargo-mutants JSON listing on the exact tree and target paths. Every listed mutant in that scope is REQUIRED unless it matches exactly one pre-frozen exact exclusion. + +There is no “choose required mutants” step after listing. There is no percentage, top-N, operator preference, or post-result manual subset. + +Stable mutant IDs bind source blob/span/function/diff/tool-lock/policy identity. Duplicate/missing dispositions fail. + +### Proof schema and semantic validator + +The machine schema defines field types/nullability/patterns/enums/cardinality/conditional shapes. Repository semantic validation freezes: + +- counter arithmetic/relations; +- required-check exact membership and success; +- digest/source relationships; +- sorted/unique set identities; +- path normalization/containment; +- tool-lock conditional executable versus registry shapes; +- inventory-object shapes referenced by digest; +- authority/proof/raw-evidence cross-links. + +Malformed type/format/range/conditional shape/cross-field relation negative fixtures are required before C0 closes. + +## Stack C1 — mutation execution and final proof + +After C0 canonical: + +- execute every required mutant; +- keep KILLED/SURVIVED/TIMEOUT/UNVIABLE_OR_BUILD_FAILURE separate; +- retry and diagnose TIMEOUT/UNVIABLE required results; +- close every required result as KILLED or a previously canonical exact waiver; +- run stochastic campaigns only as separately labeled observations; +- reconstruct final deterministic proof from raw evidence; +- validate JSON Schema and semantic invariants; +- recompute `AF02_ADVERSARIAL_SHA256` independently; +- prove required check uniqueness/provenance on exact head. + +No producer-created normalized outcome or summary is trusted without independent reconstruction. + +## CI and path topology + +Each AF-02 workflow/action/script/config is included in AF-01 workflow-trust/path auditing. + +Expensive lanes use explicit timeouts and resource policy. Path-skipped work must produce explicit terminal neutral/success topology only where the canonical gate contract defines it; absence of a required result is never silently interpreted green. + +The base-verifier gate is special: after A0 canonicalization its execution anchor comes from canonical-base `pull_request_target` workflow code, not the candidate workflow copy. + +## Closure and convergence + +AF-02 reaches `CLOSED_CANONICAL` only after: + +1. A0, A1, B0, B1, C0, and C1 each become canonical in dependency order; +2. every required corpus/property/nextest/coverage/mutation/proof gate passes on exact final head; +3. AF-01/CF-06/CF-10 authority is re-derived and unchanged; +4. required checks retain exact GitHub Actions provenance and uniqueness; +5. Qodo and CodeRabbit substantive findings are closed or explicitly recorded unavailable without inventing PASS; +6. final convergence document records exact final head/tree, runs/checks/artifacts, live policy read-back, waivers, and residual risks; +7. final PR merges with expected-head guard; +8. canonical post-merge main/tree and live rulesets are re-read. + +AF-02 closure does not authorize a CF-06 production pin change or merge blocked CF-10 work. diff --git a/specs/016-af-02-adversarial-test-strength/required-check-policy.json b/specs/016-af-02-adversarial-test-strength/required-check-policy.json new file mode 100644 index 00000000..5e9415b2 --- /dev/null +++ b/specs/016-af-02-adversarial-test-strength/required-check-policy.json @@ -0,0 +1,33 @@ +{ + "schema": "commandf.af02-required-check-policy/v1", + "repository": "TheHalfMoon/commandF", + "app": { + "id": 15368, + "slug": "github-actions", + "owner": "github" + }, + "event": "pull_request", + "checks": [ + { + "context": "assurance-proof", + "workflow_id": 343599979, + "workflow_path": ".github/workflows/af01-assurance-proof.yml", + "workflow_blob_sha": "f41045416803fac9ed22aeacf0e38c0fc2a6289f", + "job_name": "assurance-proof" + }, + { + "context": "rust", + "workflow_id": 333259855, + "workflow_path": ".github/workflows/ci.yml", + "workflow_blob_sha": "41f33c1aa0f458363cc92bbc206df4fe203b32ef", + "job_name": "rust" + }, + { + "context": "scorecard", + "workflow_id": 343592713, + "workflow_path": ".github/workflows/af01-scorecard.yml", + "workflow_blob_sha": "69aa7d808d7b13b3a7cac21a71a09b55c432794b", + "job_name": "scorecard" + } + ] +} diff --git a/specs/016-af-02-adversarial-test-strength/retained-authority-sources.json b/specs/016-af-02-adversarial-test-strength/retained-authority-sources.json new file mode 100644 index 00000000..f9c0bc16 --- /dev/null +++ b/specs/016-af-02-adversarial-test-strength/retained-authority-sources.json @@ -0,0 +1 @@ +{"schema":"commandf.af02-retained-authority-sources/v1","repository":{"owner":"TheHalfMoon","name":"commandF","full_name":"TheHalfMoon/commandF"},"planning_base":{"sha":"2b4033e237a5c74f3c45c12fbc7e7bfdc88067b1","tree":"804ce63c15edb501574bd4aba9a9aadc5bfb07f3"},"cf10":{"pull_request":{"number":11,"node_id_numeric":4284052835,"head_ref":"feat/cf-10-real-ig-delta-corpus","base_ref":"main"},"retained_head":"5fe10d9859407272acf6649fc3e868d3eb2fbd12","retained_base":"5cb1a4c3445c0ebd86654cfb467a5e008e801c3e","manifest":{"path":"corpus/real-ig/v1/corpus.json","git_blob_sha":"655949a8a30d67502dffd624a175d2e8e02b1d1f"},"donor":{"path":"donors/cf-10-real-ig-delta-corpus.yaml","git_blob_sha":"566b46f4e6f467a1ccae3ac810b31956309173b6"},"workflow_run":{"id":31916124080,"name":"cf10-real-corpus","path":".github/workflows/cf10-real-corpus.yml","event":"pull_request","workflow_id":335093310,"run_number":45,"run_attempt":1,"check_suite_id":86559814682,"head_sha":"5fe10d9859407272acf6649fc3e868d3eb2fbd12","base_sha":"5cb1a4c3445c0ebd86654cfb467a5e008e801c3e","conclusion":"failure","pull_request_number":11,"pull_request_head_sha":"5fe10d9859407272acf6649fc3e868d3eb2fbd12","pull_request_base_sha":"5cb1a4c3445c0ebd86654cfb467a5e008e801c3e"},"artifact":{"id":9255732702,"name":"cf10-real-corpus-evidence","sha256":"9fdde985bb5abbe53ec2bce2dadc5f65c95557f8848c9af68755fc81a45af612","workflow_run_id":31916124080}},"reconstruction":{"supplied_urls_are_authority":false,"api_urls_reconstructed_from_structured_fields":true,"git_blob_verified_before_parse":true,"raw_sha256_computed_after_git_identity":true,"retained_failure_preserved":true}} \ No newline at end of file diff --git a/specs/016-af-02-adversarial-test-strength/schemas/af02-adversarial-proof-core-v1.schema.json b/specs/016-af-02-adversarial-test-strength/schemas/af02-adversarial-proof-core-v1.schema.json new file mode 100644 index 00000000..91cc5b01 --- /dev/null +++ b/specs/016-af-02-adversarial-test-strength/schemas/af02-adversarial-proof-core-v1.schema.json @@ -0,0 +1,147 @@ +{ + "$schema":"https://json-schema.org/draft/2020-12/schema", + "$id":"https://commandf.dev/schemas/af02-adversarial-proof-v1.schema.json", + "title":"commandf.af02-adversarial-proof/v1", + "type":"object", + "additionalProperties":false, + "required":["schema","deterministic","stochastic_observations","af02_adversarial_sha256"], + "properties":{ + "schema":{"const":"commandf.af02-adversarial-proof/v1"}, + "deterministic":{ + "type":"object","additionalProperties":false, + "required":["source","contract_files","authority","tool_lock","surface","resources","corpus","properties","nextest","coverage","mutation","canonical_cargo_test","required_checks"], + "properties":{ + "source":{"$ref":"#/$defs/source"}, + "contract_files":{"$ref":"#/$defs/contractFiles"}, + "authority":{"$ref":"#/$defs/authority"}, + "tool_lock":{"$ref":"#/$defs/toolLockEntries"}, + "surface":{"$ref":"#/$defs/surface"}, + "resources":{"$ref":"#/$defs/resources"}, + "corpus":{"$ref":"#/$defs/corpus"}, + "properties":{"$ref":"#/$defs/propertiesEvidence"}, + "nextest":{"$ref":"#/$defs/nextest"}, + "coverage":{"$ref":"#/$defs/coverage"}, + "mutation":{"$ref":"#/$defs/mutation"}, + "canonical_cargo_test":{"$ref":"#/$defs/cargoTest"}, + "required_checks":{ + "type":"array","minItems":3,"maxItems":3, + "prefixItems":[ + {"$ref":"#/$defs/checkAssurance"}, + {"$ref":"#/$defs/checkRust"}, + {"$ref":"#/$defs/checkScorecard"} + ], + "items":false + } + } + }, + "stochastic_observations":{"type":"array","items":{"$ref":"#/$defs/stochasticObservation"}}, + "af02_adversarial_sha256":{"$ref":"#/$defs/sha256"} + }, + "$defs":{ + "gitSha":{"type":"string","pattern":"^[0-9a-f]{40}$"}, + "sha256":{"type":"string","pattern":"^[0-9a-f]{64}$"}, + "path":{"type":"string","minLength":1,"pattern":"^(?!/)(?!.*\\\\)(?!.*//)(?!.*(?:^|/)\\.(?:/|$))(?!.*(?:^|/)\\.\\.(?:/|$))[^\\u0000]+$"}, + "nonNegative":{"type":"integer","minimum":0}, + "positive":{"type":"integer","minimum":1}, + "source":{ + "type":"object","additionalProperties":false, + "required":["sha","tree","canonical_base_sha","canonical_base_tree"], + "properties":{"sha":{"$ref":"#/$defs/gitSha"},"tree":{"$ref":"#/$defs/gitSha"},"canonical_base_sha":{"$ref":"#/$defs/gitSha"},"canonical_base_tree":{"$ref":"#/$defs/gitSha"}} + }, + "contractFile":{ + "type":"object","additionalProperties":false, + "required":["path","blob_sha","sha256","role"], + "properties":{ + "path":{"$ref":"#/$defs/path"},"blob_sha":{"$ref":"#/$defs/gitSha"},"sha256":{"$ref":"#/$defs/sha256"}, + "role":{"enum":["spec","plan","tasks","consistency","evidence_contracts","verification_protocol","donor_manifest","retained_authority_sources","authority_baseline_schema","proof_schema","tool_policy","tool_policy_schema","tool_lock_schema","exclusion_policy","exclusion_policy_schema","evidence_inventory_schema","authority_baseline","surface_policy","resource_policy","tool_lock","corpus_manifest","assertion_registry","coverage_policy","mutation_policy","enforcement_inventory"]} + } + }, + "contractFiles":{"type":"array","minItems":25,"maxItems":25,"items":{"$ref":"#/$defs/contractFile"}}, + "authority":{ + "type":"object","additionalProperties":false, + "required":["baseline_file_sha256","authority_schema_sha256","retained_authority_sources_sha256","tool_policy_sha256","tool_policy_schema_sha256","tool_lock_schema_sha256","exclusion_policy_sha256","exclusion_policy_schema_sha256","evidence_inventory_schema_sha256","af01_assurance_projection_sha256","af01_review_projection_sha256","cf06_projection_sha256","cf10_projection_sha256","live_readback_completed"], + "properties":{ + "baseline_file_sha256":{"$ref":"#/$defs/sha256"},"authority_schema_sha256":{"$ref":"#/$defs/sha256"},"retained_authority_sources_sha256":{"$ref":"#/$defs/sha256"}, + "tool_policy_sha256":{"$ref":"#/$defs/sha256"},"tool_policy_schema_sha256":{"$ref":"#/$defs/sha256"},"tool_lock_schema_sha256":{"$ref":"#/$defs/sha256"}, + "exclusion_policy_sha256":{"$ref":"#/$defs/sha256"},"exclusion_policy_schema_sha256":{"$ref":"#/$defs/sha256"},"evidence_inventory_schema_sha256":{"$ref":"#/$defs/sha256"}, + "af01_assurance_projection_sha256":{"$ref":"#/$defs/sha256"},"af01_review_projection_sha256":{"$ref":"#/$defs/sha256"},"cf06_projection_sha256":{"$ref":"#/$defs/sha256"},"cf10_projection_sha256":{"$ref":"#/$defs/sha256"},"live_readback_completed":{"const":true} + } + }, + "toolLockEntries":{ + "type":"array","minItems":8,"maxItems":8, + "prefixItems":[{"$ref":"#/$defs/arbitrary"},{"$ref":"#/$defs/cargoFuzz"},{"$ref":"#/$defs/cargoLlvmCov"},{"$ref":"#/$defs/cargoMutants"},{"$ref":"#/$defs/cargoNextest"},{"$ref":"#/$defs/libfuzzerSys"},{"$ref":"#/$defs/proptest"},{"$ref":"#/$defs/synScanner"}], + "items":false + }, + "execTool":{ + "type":"object","additionalProperties":false, + "required":["kind","id","version","upstream_repository","upstream_commit","acquisition_mode","source_lock_sha256","installed_executable","installed_executable_sha256","version_output_sha256","build_rustc","build_cargo","build_target","features"], + "properties":{"kind":{"const":"executable"},"id":{"type":"string"},"version":{"type":"string"},"upstream_repository":{"type":"string"},"upstream_commit":{"$ref":"#/$defs/gitSha"},"acquisition_mode":{"const":"LOCKED_GIT_REV_SOURCE_BUILD"},"source_lock_sha256":{"$ref":"#/$defs/sha256"},"installed_executable":{"type":"string","minLength":1},"installed_executable_sha256":{"$ref":"#/$defs/sha256"},"version_output_sha256":{"$ref":"#/$defs/sha256"},"build_rustc":{"type":"string","minLength":1},"build_cargo":{"type":"string","minLength":1},"build_target":{"const":"x86_64-unknown-linux-gnu"},"features":{"type":"array","items":{"type":"string"},"uniqueItems":true}} + }, + "registryTool":{ + "type":"object","additionalProperties":false, + "required":["kind","id","package","version","registry","registry_checksum_sha256","default_features","features"], + "properties":{"kind":{"const":"registry_package"},"id":{"type":"string"},"package":{"type":"string"},"version":{"type":"string"},"registry":{"const":"crates.io"},"registry_checksum_sha256":{"$ref":"#/$defs/sha256"},"default_features":{"type":"boolean"},"features":{"type":"array","items":{"type":"string"},"uniqueItems":true}} + }, + "arbitrary":{"allOf":[{"$ref":"#/$defs/registryTool"},{"properties":{"id":{"const":"arbitrary"},"package":{"const":"arbitrary"},"version":{"const":"1.4.2"},"default_features":{"const":true},"features":{"const":["derive"]}}}]}, + "cargoFuzz":{"allOf":[{"$ref":"#/$defs/execTool"},{"properties":{"id":{"const":"cargo-fuzz"},"version":{"const":"0.13.2"},"upstream_repository":{"const":"https://github.com/rust-fuzz/cargo-fuzz"},"upstream_commit":{"const":"984c861c8dfea28055254c5f1d2659ab2cd63f76"},"features":{"const":[]}}}]}, + "cargoLlvmCov":{"allOf":[{"$ref":"#/$defs/execTool"},{"properties":{"id":{"const":"cargo-llvm-cov"},"version":{"const":"0.9.0"},"upstream_repository":{"const":"https://github.com/taiki-e/cargo-llvm-cov"},"upstream_commit":{"const":"be59056988acd54c7f984b7c85643daea3711b29"},"features":{"const":[]}}}]}, + "cargoMutants":{"allOf":[{"$ref":"#/$defs/execTool"},{"properties":{"id":{"const":"cargo-mutants"},"version":{"const":"27.1.0"},"upstream_repository":{"const":"https://github.com/sourcefrog/cargo-mutants"},"upstream_commit":{"const":"8ab1dc786a1f61a4e370416cc6c68b81a704e917"},"features":{"const":[]}}}]}, + "cargoNextest":{"allOf":[{"$ref":"#/$defs/execTool"},{"properties":{"id":{"const":"cargo-nextest"},"version":{"const":"0.9.143"},"upstream_repository":{"const":"https://github.com/nextest-rs/nextest"},"upstream_commit":{"const":"60fa45f638ffc3f35e74afa65737f45fcd32db2a"},"features":{"const":[]}}}]}, + "libfuzzerSys":{"allOf":[{"$ref":"#/$defs/registryTool"},{"properties":{"id":{"const":"libfuzzer-sys"},"package":{"const":"libfuzzer-sys"},"version":{"const":"0.4.13"},"default_features":{"const":true},"features":{"const":[]}}}]}, + "proptest":{"allOf":[{"$ref":"#/$defs/registryTool"},{"properties":{"id":{"const":"proptest"},"package":{"const":"proptest"},"version":{"const":"1.11.0"},"default_features":{"const":true},"features":{"const":[]}}}]}, + "synScanner":{"allOf":[{"$ref":"#/$defs/registryTool"},{"properties":{"id":{"const":"syn-af02-scanner"},"package":{"const":"syn"},"version":{"const":"3.0.3"},"registry_checksum_sha256":{"const":"53e9bae58849f64dfa4f5d5ae372c8341f7305f82a3868709269343628b659a3"},"default_features":{"const":true},"features":{"const":["full","visit"]}}}]}, + "surface":{ + "type":"object","additionalProperties":false, + "required":["policy_sha256","exclusion_policy_sha256","scanner_source_sha256","scanner_dependency_lock_sha256","source_universe_sha256","discovery_inventory_sha256","classified_boundary_count","reviewed_exclusion_count","stale_entry_count","unclassified_boundary_count"], + "properties":{"policy_sha256":{"$ref":"#/$defs/sha256"},"exclusion_policy_sha256":{"$ref":"#/$defs/sha256"},"scanner_source_sha256":{"$ref":"#/$defs/sha256"},"scanner_dependency_lock_sha256":{"$ref":"#/$defs/sha256"},"source_universe_sha256":{"$ref":"#/$defs/sha256"},"discovery_inventory_sha256":{"$ref":"#/$defs/sha256"},"classified_boundary_count":{"$ref":"#/$defs/nonNegative"},"reviewed_exclusion_count":{"$ref":"#/$defs/nonNegative"},"stale_entry_count":{"const":0},"unclassified_boundary_count":{"const":0}} + }, + "resources":{ + "type":"object","additionalProperties":false, + "required":["policy_sha256","runner_image_digest","runtime_identity_sha256","effective_enforcement_sha256","offline_probe_sha256","network_mode","memory_bytes","nano_cpus","pids_limit","tmpfs_bytes","source_mount_read_only","output_mount_path","output_mount_read_write"], + "properties":{"policy_sha256":{"$ref":"#/$defs/sha256"},"runner_image_digest":{"const":"sha256:9146b0f62e1939989aa96fc8d89699a43c5635bf212819235a773e1a9e71a98f"},"runtime_identity_sha256":{"$ref":"#/$defs/sha256"},"effective_enforcement_sha256":{"$ref":"#/$defs/sha256"},"offline_probe_sha256":{"$ref":"#/$defs/sha256"},"network_mode":{"const":"none"},"memory_bytes":{"const":805306368},"nano_cpus":{"const":2000000000},"pids_limit":{"const":256},"tmpfs_bytes":{"const":536870912},"source_mount_read_only":{"const":true},"output_mount_path":{"type":"string","pattern":"^/af02-output(?:/[^/]+)*$"},"output_mount_read_write":{"const":true}} + }, + "corpus":{ + "type":"object","additionalProperties":false, + "required":["manifest_sha256","assertion_registry_sha256","fixture_inventory_sha256","scenario_count","total_fixture_bytes","replay_result_sha256","orphan_manifest_count","orphan_assertion_count","provenance_violation_count"], + "properties":{"manifest_sha256":{"$ref":"#/$defs/sha256"},"assertion_registry_sha256":{"$ref":"#/$defs/sha256"},"fixture_inventory_sha256":{"$ref":"#/$defs/sha256"},"scenario_count":{"$ref":"#/$defs/nonNegative"},"total_fixture_bytes":{"type":"integer","minimum":0,"maximum":8388608},"replay_result_sha256":{"$ref":"#/$defs/sha256"},"orphan_manifest_count":{"const":0},"orphan_assertion_count":{"const":0},"provenance_violation_count":{"const":0}} + }, + "propertiesEvidence":{ + "type":"object","additionalProperties":false, + "required":["config_sha256","model_registry_sha256","case_count","passed_count","failed_count","counterexample_inventory_sha256"], + "properties":{"config_sha256":{"$ref":"#/$defs/sha256"},"model_registry_sha256":{"$ref":"#/$defs/sha256"},"case_count":{"$ref":"#/$defs/nonNegative"},"passed_count":{"$ref":"#/$defs/nonNegative"},"failed_count":{"const":0},"counterexample_inventory_sha256":{"$ref":"#/$defs/sha256"}} + }, + "nextest":{ + "type":"object","additionalProperties":false, + "required":["config_sha256","command_argv_sha256","selected_test_name","state_protocol_sha256","output_mount_preflight_sha256","junit_sha256","junit_process_binding_sha256","stdout_sha256","stderr_sha256","process_exit_code","first_attempt_class","retry_attempt_class","normalized_class","selected_test_count","ordinary_suite_result_sha256"], + "properties":{"config_sha256":{"$ref":"#/$defs/sha256"},"command_argv_sha256":{"$ref":"#/$defs/sha256"},"selected_test_name":{"const":"af02_retry_pass_is_failure"},"state_protocol_sha256":{"$ref":"#/$defs/sha256"},"output_mount_preflight_sha256":{"$ref":"#/$defs/sha256"},"junit_sha256":{"$ref":"#/$defs/sha256"},"junit_process_binding_sha256":{"$ref":"#/$defs/sha256"},"stdout_sha256":{"$ref":"#/$defs/sha256"},"stderr_sha256":{"$ref":"#/$defs/sha256"},"process_exit_code":{"type":"integer","not":{"const":0}},"first_attempt_class":{"const":"FAIL"},"retry_attempt_class":{"const":"PASS"},"normalized_class":{"const":"FLAKY_RETRY_PASS"},"selected_test_count":{"const":1},"ordinary_suite_result_sha256":{"$ref":"#/$defs/sha256"}} + }, + "coverage":{ + "type":"object","additionalProperties":false, + "required":["descriptor_sha256","exclusion_policy_sha256","raw_report_sha256","source_universe_sha256","file_metrics_sha256","workspace_covered_lines","workspace_total_lines","workspace_floor_percent","critical_surface_metrics_sha256","unknown_production_path_count","missing_production_path_count","duplicate_normalized_path_count"], + "properties":{"descriptor_sha256":{"$ref":"#/$defs/sha256"},"exclusion_policy_sha256":{"$ref":"#/$defs/sha256"},"raw_report_sha256":{"$ref":"#/$defs/sha256"},"source_universe_sha256":{"$ref":"#/$defs/sha256"},"file_metrics_sha256":{"$ref":"#/$defs/sha256"},"workspace_covered_lines":{"$ref":"#/$defs/nonNegative"},"workspace_total_lines":{"$ref":"#/$defs/positive"},"workspace_floor_percent":{"type":"integer","minimum":0,"maximum":100},"critical_surface_metrics_sha256":{"$ref":"#/$defs/sha256"},"unknown_production_path_count":{"const":0},"missing_production_path_count":{"const":0},"duplicate_normalized_path_count":{"const":0}} + }, + "mutation":{ + "type":"object","additionalProperties":false, + "required":["policy_sha256","exclusion_policy_sha256","inventory_sha256","required_set_sha256","exclusion_set_sha256","result_inventory_sha256","required_count","killed_count","survived_count","timeout_count","unviable_or_build_failure_count","waived_count","unclassified_count"], + "properties":{"policy_sha256":{"$ref":"#/$defs/sha256"},"exclusion_policy_sha256":{"$ref":"#/$defs/sha256"},"inventory_sha256":{"$ref":"#/$defs/sha256"},"required_set_sha256":{"$ref":"#/$defs/sha256"},"exclusion_set_sha256":{"$ref":"#/$defs/sha256"},"result_inventory_sha256":{"$ref":"#/$defs/sha256"},"required_count":{"$ref":"#/$defs/nonNegative"},"killed_count":{"$ref":"#/$defs/nonNegative"},"survived_count":{"const":0},"timeout_count":{"const":0},"unviable_or_build_failure_count":{"const":0},"waived_count":{"$ref":"#/$defs/nonNegative"},"unclassified_count":{"const":0}} + }, + "cargoTest":{ + "type":"object","additionalProperties":false, + "required":["command_argv_sha256","source_sha","exit_code","test_count","passed_count","failed_count","ignored_count","raw_result_sha256"], + "properties":{"command_argv_sha256":{"$ref":"#/$defs/sha256"},"source_sha":{"$ref":"#/$defs/gitSha"},"exit_code":{"const":0},"test_count":{"$ref":"#/$defs/nonNegative"},"passed_count":{"$ref":"#/$defs/nonNegative"},"failed_count":{"const":0},"ignored_count":{"$ref":"#/$defs/nonNegative"},"raw_result_sha256":{"$ref":"#/$defs/sha256"}} + }, + "checkBase":{ + "type":"object","additionalProperties":false, + "required":["context","integration_id","check_run_id","head_sha","conclusion"], + "properties":{"context":{"type":"string"},"integration_id":{"const":15368},"check_run_id":{"$ref":"#/$defs/positive"},"head_sha":{"$ref":"#/$defs/gitSha"},"conclusion":{"const":"success"}} + }, + "checkAssurance":{"allOf":[{"$ref":"#/$defs/checkBase"},{"properties":{"context":{"const":"assurance-proof"}}}]}, + "checkRust":{"allOf":[{"$ref":"#/$defs/checkBase"},{"properties":{"context":{"const":"rust"}}}]}, + "checkScorecard":{"allOf":[{"$ref":"#/$defs/checkBase"},{"properties":{"context":{"const":"scorecard"}}}]}, + "stochasticObservation":{ + "type":"object","additionalProperties":false, + "required":["campaign_id","target_id","source_sha","tool_lock_entry_sha256","campaign_config_sha256","seed_or_null","wall_seconds","executions_or_null","corpus_start_sha256","corpus_end_sha256","outcome_class","artifact_manifest_sha256_or_null","started_at_utc","completed_at_utc"], + "properties":{"campaign_id":{"type":"string","minLength":1},"target_id":{"type":"string","minLength":1},"source_sha":{"$ref":"#/$defs/gitSha"},"tool_lock_entry_sha256":{"$ref":"#/$defs/sha256"},"campaign_config_sha256":{"$ref":"#/$defs/sha256"},"seed_or_null":{"oneOf":[{"type":"integer","minimum":0},{"type":"null"}]},"wall_seconds":{"$ref":"#/$defs/nonNegative"},"executions_or_null":{"oneOf":[{"type":"integer","minimum":0},{"type":"null"}]},"corpus_start_sha256":{"$ref":"#/$defs/sha256"},"corpus_end_sha256":{"$ref":"#/$defs/sha256"},"outcome_class":{"enum":["NO_CRASH_OBSERVED_WITHIN_BOUND","DEFECT_DISCOVERED","INCOMPLETE_RESOURCE_OR_HARNESS_FAILURE","CANCELLED_OR_SUPERSEDED"]},"artifact_manifest_sha256_or_null":{"oneOf":[{"$ref":"#/$defs/sha256"},{"type":"null"}]},"started_at_utc":{"type":"string","format":"date-time"},"completed_at_utc":{"type":"string","format":"date-time"}} + } + } +} diff --git a/specs/016-af-02-adversarial-test-strength/schemas/af02-adversarial-proof-v1.schema.json b/specs/016-af-02-adversarial-test-strength/schemas/af02-adversarial-proof-v1.schema.json new file mode 100644 index 00000000..bb1fb31d --- /dev/null +++ b/specs/016-af-02-adversarial-test-strength/schemas/af02-adversarial-proof-v1.schema.json @@ -0,0 +1 @@ +{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://commandf.dev/schemas/af02-adversarial-proof-envelope-v1.schema.json","title":"commandf.af02-adversarial-proof/v1","type":"object","additionalProperties":false,"required":["schema","core","extension_contract_files","extension_authority","required_check_provenance","af02_adversarial_sha256"],"properties":{"schema":{"const":"commandf.af02-adversarial-proof/v1"},"core":{"$ref":"af02-adversarial-proof-core-v1.schema.json"},"extension_contract_files":{"type":"array","minItems":17,"maxItems":17,"uniqueItems":true,"prefixItems":[{"type":"object","additionalProperties":false,"required":["role","path","blob_sha","sha256"],"properties":{"role":{"const":"proof_core_schema"},"path":{"const":"specs/016-af-02-adversarial-test-strength/schemas/af02-adversarial-proof-core-v1.schema.json"},"blob_sha":{"type":"string","pattern":"^[0-9a-f]{40}$"},"sha256":{"type":"string","pattern":"^[0-9a-f]{64}$"}}},{"type":"object","additionalProperties":false,"required":["role","path","blob_sha","sha256"],"properties":{"role":{"const":"retained_authority_sources_schema"},"path":{"const":"specs/016-af-02-adversarial-test-strength/schemas/af02-retained-authority-sources-v1.schema.json"},"blob_sha":{"type":"string","pattern":"^[0-9a-f]{40}$"},"sha256":{"type":"string","pattern":"^[0-9a-f]{64}$"}}},{"type":"object","additionalProperties":false,"required":["role","path","blob_sha","sha256"],"properties":{"role":{"const":"waiver_policy"},"path":{"const":"specs/016-af-02-adversarial-test-strength/waiver-policy.json"},"blob_sha":{"type":"string","pattern":"^[0-9a-f]{40}$"},"sha256":{"type":"string","pattern":"^[0-9a-f]{64}$"}}},{"type":"object","additionalProperties":false,"required":["role","path","blob_sha","sha256"],"properties":{"role":{"const":"waiver_policy_schema"},"path":{"const":"specs/016-af-02-adversarial-test-strength/schemas/af02-waiver-policy-v1.schema.json"},"blob_sha":{"type":"string","pattern":"^[0-9a-f]{40}$"},"sha256":{"type":"string","pattern":"^[0-9a-f]{64}$"}}},{"type":"object","additionalProperties":false,"required":["role","path","blob_sha","sha256"],"properties":{"role":{"const":"required_check_policy"},"path":{"const":"specs/016-af-02-adversarial-test-strength/required-check-policy.json"},"blob_sha":{"type":"string","pattern":"^[0-9a-f]{40}$"},"sha256":{"type":"string","pattern":"^[0-9a-f]{64}$"}}},{"type":"object","additionalProperties":false,"required":["role","path","blob_sha","sha256"],"properties":{"role":{"const":"required_check_policy_schema"},"path":{"const":"specs/016-af-02-adversarial-test-strength/schemas/af02-required-check-policy-v1.schema.json"},"blob_sha":{"type":"string","pattern":"^[0-9a-f]{40}$"},"sha256":{"type":"string","pattern":"^[0-9a-f]{64}$"}}},{"type":"object","additionalProperties":false,"required":["role","path","blob_sha","sha256"],"properties":{"role":{"const":"required_check_provenance_schema"},"path":{"const":"specs/016-af-02-adversarial-test-strength/schemas/af02-required-check-provenance-v1.schema.json"},"blob_sha":{"type":"string","pattern":"^[0-9a-f]{40}$"},"sha256":{"type":"string","pattern":"^[0-9a-f]{64}$"}}},{"type":"object","additionalProperties":false,"required":["role","path","blob_sha","sha256"],"properties":{"role":{"const":"semantic_contract"},"path":{"const":"specs/016-af-02-adversarial-test-strength/semantic-contract.json"},"blob_sha":{"type":"string","pattern":"^[0-9a-f]{40}$"},"sha256":{"type":"string","pattern":"^[0-9a-f]{64}$"}}},{"type":"object","additionalProperties":false,"required":["role","path","blob_sha","sha256"],"properties":{"role":{"const":"semantic_contract_schema"},"path":{"const":"specs/016-af-02-adversarial-test-strength/schemas/af02-semantic-contract-v1.schema.json"},"blob_sha":{"type":"string","pattern":"^[0-9a-f]{40}$"},"sha256":{"type":"string","pattern":"^[0-9a-f]{64}$"}}},{"type":"object","additionalProperties":false,"required":["role","path","blob_sha","sha256"],"properties":{"role":{"const":"verifier_input_policy"},"path":{"const":"specs/016-af-02-adversarial-test-strength/verifier-input-policy.json"},"blob_sha":{"type":"string","pattern":"^[0-9a-f]{40}$"},"sha256":{"type":"string","pattern":"^[0-9a-f]{64}$"}}},{"type":"object","additionalProperties":false,"required":["role","path","blob_sha","sha256"],"properties":{"role":{"const":"verifier_input_policy_schema"},"path":{"const":"specs/016-af-02-adversarial-test-strength/schemas/af02-verifier-input-policy-v1.schema.json"},"blob_sha":{"type":"string","pattern":"^[0-9a-f]{40}$"},"sha256":{"type":"string","pattern":"^[0-9a-f]{64}$"}}},{"type":"object","additionalProperties":false,"required":["role","path","blob_sha","sha256"],"properties":{"role":{"const":"surface_policy_schema"},"path":{"const":"specs/016-af-02-adversarial-test-strength/schemas/af02-surface-policy-v1.schema.json"},"blob_sha":{"type":"string","pattern":"^[0-9a-f]{40}$"},"sha256":{"type":"string","pattern":"^[0-9a-f]{64}$"}}},{"type":"object","additionalProperties":false,"required":["role","path","blob_sha","sha256"],"properties":{"role":{"const":"resource_policy_schema"},"path":{"const":"specs/016-af-02-adversarial-test-strength/schemas/af02-resource-policy-v1.schema.json"},"blob_sha":{"type":"string","pattern":"^[0-9a-f]{40}$"},"sha256":{"type":"string","pattern":"^[0-9a-f]{64}$"}}},{"type":"object","additionalProperties":false,"required":["role","path","blob_sha","sha256"],"properties":{"role":{"const":"corpus_manifest_schema"},"path":{"const":"specs/016-af-02-adversarial-test-strength/schemas/af02-corpus-v1.schema.json"},"blob_sha":{"type":"string","pattern":"^[0-9a-f]{40}$"},"sha256":{"type":"string","pattern":"^[0-9a-f]{64}$"}}},{"type":"object","additionalProperties":false,"required":["role","path","blob_sha","sha256"],"properties":{"role":{"const":"coverage_policy_schema"},"path":{"const":"specs/016-af-02-adversarial-test-strength/schemas/af02-coverage-policy-v1.schema.json"},"blob_sha":{"type":"string","pattern":"^[0-9a-f]{40}$"},"sha256":{"type":"string","pattern":"^[0-9a-f]{64}$"}}},{"type":"object","additionalProperties":false,"required":["role","path","blob_sha","sha256"],"properties":{"role":{"const":"mutation_policy_schema"},"path":{"const":"specs/016-af-02-adversarial-test-strength/schemas/af02-mutation-policy-v1.schema.json"},"blob_sha":{"type":"string","pattern":"^[0-9a-f]{40}$"},"sha256":{"type":"string","pattern":"^[0-9a-f]{64}$"}}},{"type":"object","additionalProperties":false,"required":["role","path","blob_sha","sha256"],"properties":{"role":{"const":"enforcement_inventory_schema"},"path":{"const":"specs/016-af-02-adversarial-test-strength/schemas/af02-enforcement-inventory-v1.schema.json"},"blob_sha":{"type":"string","pattern":"^[0-9a-f]{40}$"},"sha256":{"type":"string","pattern":"^[0-9a-f]{64}$"}}}],"items":false},"extension_authority":{"type":"object","additionalProperties":false,"required":["retained_authority_sources_schema_sha256","waiver_policy_sha256","waiver_policy_schema_sha256","required_check_policy_sha256","required_check_policy_schema_sha256","required_check_provenance_schema_sha256","semantic_contract_sha256","semantic_contract_schema_sha256","verifier_input_policy_sha256","verifier_input_policy_schema_sha256","surface_policy_schema_sha256","resource_policy_schema_sha256","corpus_schema_sha256","coverage_policy_schema_sha256","mutation_policy_schema_sha256","enforcement_inventory_sha256","enforcement_inventory_schema_sha256"],"properties":{"retained_authority_sources_schema_sha256":{"type":"string","pattern":"^[0-9a-f]{64}$"},"waiver_policy_sha256":{"type":"string","pattern":"^[0-9a-f]{64}$"},"waiver_policy_schema_sha256":{"type":"string","pattern":"^[0-9a-f]{64}$"},"required_check_policy_sha256":{"type":"string","pattern":"^[0-9a-f]{64}$"},"required_check_policy_schema_sha256":{"type":"string","pattern":"^[0-9a-f]{64}$"},"required_check_provenance_schema_sha256":{"type":"string","pattern":"^[0-9a-f]{64}$"},"semantic_contract_sha256":{"type":"string","pattern":"^[0-9a-f]{64}$"},"semantic_contract_schema_sha256":{"type":"string","pattern":"^[0-9a-f]{64}$"},"verifier_input_policy_sha256":{"type":"string","pattern":"^[0-9a-f]{64}$"},"verifier_input_policy_schema_sha256":{"type":"string","pattern":"^[0-9a-f]{64}$"},"surface_policy_schema_sha256":{"type":"string","pattern":"^[0-9a-f]{64}$"},"resource_policy_schema_sha256":{"type":"string","pattern":"^[0-9a-f]{64}$"},"corpus_schema_sha256":{"type":"string","pattern":"^[0-9a-f]{64}$"},"coverage_policy_schema_sha256":{"type":"string","pattern":"^[0-9a-f]{64}$"},"mutation_policy_schema_sha256":{"type":"string","pattern":"^[0-9a-f]{64}$"},"enforcement_inventory_sha256":{"type":"string","pattern":"^[0-9a-f]{64}$"},"enforcement_inventory_schema_sha256":{"type":"string","pattern":"^[0-9a-f]{64}$"}}},"required_check_provenance":{"$ref":"af02-required-check-provenance-v1.schema.json"},"af02_adversarial_sha256":{"type":"string","pattern":"^[0-9a-f]{64}$"}}} \ No newline at end of file diff --git a/specs/016-af-02-adversarial-test-strength/schemas/af02-authority-baseline-v2.schema.json b/specs/016-af-02-adversarial-test-strength/schemas/af02-authority-baseline-v2.schema.json new file mode 100644 index 00000000..3a245654 --- /dev/null +++ b/specs/016-af-02-adversarial-test-strength/schemas/af02-authority-baseline-v2.schema.json @@ -0,0 +1,143 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://commandf.dev/schemas/af02-authority-baseline-v2.schema.json", + "title": "commandf.af02-authority-baseline/v2", + "type": "object", + "additionalProperties": false, + "required": ["schema","captured_from_main_sha","captured_from_main_tree","af01","cf06","cf10"], + "properties": { + "schema": {"const": "commandf.af02-authority-baseline/v2"}, + "captured_from_main_sha": {"$ref": "#/$defs/gitSha"}, + "captured_from_main_tree": {"$ref": "#/$defs/gitSha"}, + "af01": { + "type": "object", + "additionalProperties": false, + "required": ["assurance","review_governance"], + "properties": { + "assurance": {"$ref": "#/$defs/rulesetProjection"}, + "review_governance": {"$ref": "#/$defs/rulesetProjection"} + } + }, + "cf06": { + "type": "object", + "additionalProperties": false, + "required": ["project","release","source_commit","validator_cli_jar_sha256","r4_core_context","projection_sha256","source_files"], + "properties": { + "project": {"const": "hapifhir/org.hl7.fhir.core"}, + "release": {"const": "6.10.2"}, + "source_commit": {"const": "d06577dbc5c62c74a2a8823fbc4830a3024d5b0b"}, + "validator_cli_jar_sha256": {"const": "a3addadfa18dfa23146a0a243b6ede68eaad92157a5407738c468bb3d7e4ccd6"}, + "r4_core_context": {"const": "hl7.fhir.r4.core@4.0.1"}, + "projection_sha256": {"$ref": "#/$defs/sha256"}, + "source_files": { + "type": "array", + "minItems": 3, + "maxItems": 3, + "items": {"$ref": "#/$defs/sourceFile"} + } + } + }, + "cf10": { + "type": "object", + "additionalProperties": false, + "required": ["deltas","states","retained_pr","retained_head","retained_base","retained_run","retained_run_conclusion","retained_artifact_id","retained_artifact_name","retained_artifact_sha256","retained_manifest_blob_sha","retained_manifest_sha256","retained_donor_blob_sha","retained_donor_sha256","projection_sha256"], + "properties": { + "deltas": { + "type": "array", + "minItems": 3, + "maxItems": 3, + "prefixItems": [ + {"$ref": "#/$defs/deltaC001"}, + {"$ref": "#/$defs/deltaC002"}, + {"$ref": "#/$defs/deltaC003"} + ], + "items": false + }, + "states": { + "type": "array", + "minItems": 6, + "maxItems": 6, + "prefixItems": [ + {"$ref": "#/$defs/stateC001After"}, + {"$ref": "#/$defs/stateC001Before"}, + {"$ref": "#/$defs/stateC002After"}, + {"$ref": "#/$defs/stateC002Before"}, + {"$ref": "#/$defs/stateC003After"}, + {"$ref": "#/$defs/stateC003Before"} + ], + "items": false + }, + "retained_pr": {"const": 11}, + "retained_head": {"const": "5fe10d9859407272acf6649fc3e868d3eb2fbd12"}, + "retained_base": {"const": "5cb1a4c3445c0ebd86654cfb467a5e008e801c3e"}, + "retained_run": {"const": 31916124080}, + "retained_run_conclusion": {"const": "failure"}, + "retained_artifact_id": {"const": 9255732702}, + "retained_artifact_name": {"const": "cf10-real-corpus-evidence"}, + "retained_artifact_sha256": {"const": "9fdde985bb5abbe53ec2bce2dadc5f65c95557f8848c9af68755fc81a45af612"}, + "retained_manifest_blob_sha": {"const": "655949a8a30d67502dffd624a175d2e8e02b1d1f"}, + "retained_manifest_sha256": {"$ref": "#/$defs/sha256"}, + "retained_donor_blob_sha": {"const": "566b46f4e6f467a1ccae3ac810b31956309173b6"}, + "retained_donor_sha256": {"$ref": "#/$defs/sha256"}, + "projection_sha256": {"$ref": "#/$defs/sha256"} + } + } + }, + "$defs": { + "gitSha": {"type": "string", "pattern": "^[0-9a-f]{40}$"}, + "sha256": {"type": "string", "pattern": "^[0-9a-f]{64}$"}, + "rulesetProjection": { + "type": "object", + "additionalProperties": false, + "required": ["ruleset_id","semantic_sha256"], + "properties": { + "ruleset_id": {"type": "integer", "minimum": 1}, + "semantic_sha256": {"$ref": "#/$defs/sha256"} + } + }, + "sourceFile": { + "type": "object", + "additionalProperties": false, + "required": ["path","git_blob_sha","raw_sha256"], + "properties": { + "path": {"type": "string", "minLength": 1, "pattern": "^(?!/)(?!.*(?:^|/)\\.\\.(?:/|$)).+$"}, + "git_blob_sha": {"$ref": "#/$defs/gitSha"}, + "raw_sha256": {"$ref": "#/$defs/sha256"} + } + }, + "deltaBase": { + "type": "object", + "additionalProperties": false, + "required": ["id","package","before","after"], + "properties": { + "id": {"type": "string"}, + "package": {"type": "string"}, + "before": {"type": "string"}, + "after": {"type": "string"} + } + }, + "deltaC001": {"allOf": [{"$ref": "#/$defs/deltaBase"},{"properties":{"id":{"const":"C001"},"package":{"const":"hl7.fhir.us.core"},"before":{"const":"8.0.1"},"after":{"const":"9.0.0"}}}]}, + "deltaC002": {"allOf": [{"$ref": "#/$defs/deltaBase"},{"properties":{"id":{"const":"C002"},"package":{"const":"hl7.fhir.uv.ips"},"before":{"const":"1.1.0"},"after":{"const":"2.0.1"}}}]}, + "deltaC003": {"allOf": [{"$ref": "#/$defs/deltaBase"},{"properties":{"id":{"const":"C003"},"package":{"const":"hl7.fhir.us.mcode"},"before":{"const":"3.0.0"},"after":{"const":"4.0.0"}}}]}, + "stateBase": { + "type": "object", + "additionalProperties": false, + "required": ["state_id","case_id","side","package","version","archive_sha256","archive_bytes"], + "properties": { + "state_id": {"type": "string"}, + "case_id": {"type": "string"}, + "side": {"enum": ["before","after"]}, + "package": {"type": "string"}, + "version": {"type": "string"}, + "archive_sha256": {"$ref": "#/$defs/sha256"}, + "archive_bytes": {"type": "integer", "minimum": 1} + } + }, + "stateC001After": {"allOf":[{"$ref":"#/$defs/stateBase"},{"properties":{"state_id":{"const":"C001-after"},"case_id":{"const":"C001"},"side":{"const":"after"},"package":{"const":"hl7.fhir.us.core"},"version":{"const":"9.0.0"},"archive_sha256":{"const":"d7b54d2ec2a48cea94ffea5d939ad67a681f80b94d69594a08cebac36da9e059"},"archive_bytes":{"const":2749959}}}]}, + "stateC001Before": {"allOf":[{"$ref":"#/$defs/stateBase"},{"properties":{"state_id":{"const":"C001-before"},"case_id":{"const":"C001"},"side":{"const":"before"},"package":{"const":"hl7.fhir.us.core"},"version":{"const":"8.0.1"},"archive_sha256":{"const":"3c02eef48ef10617021bee95e58cbc66d596ceda8cada24b72000d33ad67c464"},"archive_bytes":{"const":2713046}}}]}, + "stateC002After": {"allOf":[{"$ref":"#/$defs/stateBase"},{"properties":{"state_id":{"const":"C002-after"},"case_id":{"const":"C002"},"side":{"const":"after"},"package":{"const":"hl7.fhir.uv.ips"},"version":{"const":"2.0.1"},"archive_sha256":{"const":"7183242b70fb2a9058aa3701fb607517a3c2fd0e3100d1d8c538d744c2adf799"},"archive_bytes":{"const":725312}}}]}, + "stateC002Before": {"allOf":[{"$ref":"#/$defs/stateBase"},{"properties":{"state_id":{"const":"C002-before"},"case_id":{"const":"C002"},"side":{"const":"before"},"package":{"const":"hl7.fhir.uv.ips"},"version":{"const":"1.1.0"},"archive_sha256":{"const":"403c4141101810e924f2928287985084819d8a5cc3a62e2b3840a557129840ef"},"archive_bytes":{"const":1065103}}}]}, + "stateC003After": {"allOf":[{"$ref":"#/$defs/stateBase"},{"properties":{"state_id":{"const":"C003-after"},"case_id":{"const":"C003"},"side":{"const":"after"},"package":{"const":"hl7.fhir.us.mcode"},"version":{"const":"4.0.0"},"archive_sha256":{"const":"e603283bafa508a3705ad022bce95bba1fbd0b8b3b87b978e7412813b7bc1778"},"archive_bytes":{"const":1003918}}}]}, + "stateC003Before": {"allOf":[{"$ref":"#/$defs/stateBase"},{"properties":{"state_id":{"const":"C003-before"},"case_id":{"const":"C003"},"side":{"const":"before"},"package":{"const":"hl7.fhir.us.mcode"},"version":{"const":"3.0.0"},"archive_sha256":{"const":"c94c91971747efeae760aa037d168e4df992cefb6dacece08217c464b9d39214"},"archive_bytes":{"const":1014084}}}]} + } +} diff --git a/specs/016-af-02-adversarial-test-strength/schemas/af02-corpus-v1.schema.json b/specs/016-af-02-adversarial-test-strength/schemas/af02-corpus-v1.schema.json new file mode 100644 index 00000000..7ef4591d --- /dev/null +++ b/specs/016-af-02-adversarial-test-strength/schemas/af02-corpus-v1.schema.json @@ -0,0 +1,21 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://commandf.dev/schemas/af02-corpus-v1.schema.json", + "title": "commandf.af02-corpus/v1", + "type": "object", + "additionalProperties": false, + "required": ["schema","source_sha","max_fixture_bytes","max_total_bytes","entries"], + "properties": { + "schema": {"const":"commandf.af02-corpus/v1"}, + "source_sha": {"type":"string","pattern":"^[0-9a-f]{40}$"}, + "max_fixture_bytes": {"const":262144}, + "max_total_bytes": {"const":8388608}, + "entries": {"type":"array","items":{"$ref":"#/$defs/entry"}} + }, + "$defs": { + "sha256":{"type":"string","pattern":"^[0-9a-f]{64}$"}, + "path":{"type":"string","minLength":1,"pattern":"^(?!/)(?!.*\\\\)(?!.*//)(?!.*(?:^|/)\\.(?:/|$))(?!.*(?:^|/)\\.\\.(?:/|$))[^\\u0000]+$"}, + "id":{"type":"string","minLength":1,"maxLength":160,"pattern":"^[A-Za-z0-9][A-Za-z0-9._:-]*$"}, + "entry":{"type":"object","additionalProperties":false,"required":["scenario_id","fixture_path","fixture_sha256","byte_length","provenance_class","expected_outcome","assertion_id","replay_id","discovery_origin","parent_scenario_id_or_null","minimization_tool_or_null","contains_phi"],"properties":{"scenario_id":{"$ref":"#/$defs/id"},"fixture_path":{"$ref":"#/$defs/path"},"fixture_sha256":{"$ref":"#/$defs/sha256"},"byte_length":{"type":"integer","minimum":0,"maximum":262144},"provenance_class":{"enum":["SYNTHETIC","PUBLIC_REDISTRIBUTABLE","GENERATED_FROM_SYNTHETIC","OPAQUE_FUZZ_ARTIFACT_SAFE"]},"expected_outcome":{"enum":["ACCEPT_CANONICAL","REJECT_INVALID","FAIL_CLOSED_LIMIT"]},"assertion_id":{"$ref":"#/$defs/id"},"replay_id":{"$ref":"#/$defs/id"},"discovery_origin":{"enum":["HAND_AUTHORED","FUZZ_DISCOVERY","PROPERTY_COUNTEREXAMPLE","MUTATION_REGRESSION"]},"parent_scenario_id_or_null":{"oneOf":[{"$ref":"#/$defs/id"},{"type":"null"}]},"minimization_tool_or_null":{"oneOf":[{"type":"string","minLength":1,"maxLength":160},{"type":"null"}]},"contains_phi":{"const":false}}} + } +} diff --git a/specs/016-af-02-adversarial-test-strength/schemas/af02-coverage-policy-v1.schema.json b/specs/016-af-02-adversarial-test-strength/schemas/af02-coverage-policy-v1.schema.json new file mode 100644 index 00000000..3d974278 --- /dev/null +++ b/specs/016-af-02-adversarial-test-strength/schemas/af02-coverage-policy-v1.schema.json @@ -0,0 +1 @@ +{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://commandf.dev/schemas/af02-coverage-policy-v1.schema.json","title":"commandf.af02-coverage-policy/v1","type":"object","additionalProperties":false,"required":["schema","lineage","source_sha","source_tree","platform","rust_version","llvm_tools_preview","tool_id","command_argv","source_roots","exclusion_policy_sha256","cargo_lock_blob_sha","cargo_manifest_blob_shas","replay_inputs_sha256","property_inputs_sha256","workspace_floor_percent","critical_surface_floors","rebaseline_rule"],"properties":{"schema":{"const":"commandf.af02-coverage-policy/v1"},"lineage":{"$ref":"#/$defs/lineage"},"source_sha":{"type":"string","pattern":"^[0-9a-f]{40}$"},"source_tree":{"type":"string","pattern":"^[0-9a-f]{40}$"},"platform":{"const":"linux-x86_64"},"rust_version":{"const":"1.97.1"},"llvm_tools_preview":{"const":true},"tool_id":{"const":"cargo-llvm-cov"},"command_argv":{"const":["cargo","llvm-cov","--workspace","--all-features","--locked","--json"]},"source_roots":{"const":["crates/**/src/**/*.rs","tools/**/src/**/*.rs"]},"exclusion_policy_sha256":{"type":"string","pattern":"^[0-9a-f]{64}$"},"cargo_lock_blob_sha":{"type":"string","pattern":"^[0-9a-f]{40}$"},"cargo_manifest_blob_shas":{"type":"array","minItems":1,"uniqueItems":true,"items":{"$ref":"#/$defs/pathBlob"}},"replay_inputs_sha256":{"type":"string","pattern":"^[0-9a-f]{64}$"},"property_inputs_sha256":{"type":"string","pattern":"^[0-9a-f]{64}$"},"workspace_floor_percent":{"type":"integer","minimum":0,"maximum":100},"critical_surface_floors":{"type":"array","minItems":1,"uniqueItems":true,"items":{"$ref":"#/$defs/surfaceFloor"}},"rebaseline_rule":{"const":"PRIOR_POLICY_ONLY_SEPARATE_PR"}},"$defs":{"lineage":{"type":"object","additionalProperties":false,"required":["mode","canonical_base_sha","canonical_base_tree","policy_path","predecessor_blob_sha","predecessor_sha256","change_is_policy_only","dependent_evidence_allowed_in_same_candidate","comparison_rule"],"properties":{"mode":{"enum":["BOOTSTRAP","REBASE"]},"canonical_base_sha":{"type":"string","pattern":"^[0-9a-f]{40}$"},"canonical_base_tree":{"type":"string","pattern":"^[0-9a-f]{40}$"},"policy_path":{"const":"specs/016-af-02-adversarial-test-strength/coverage-policy.json"},"predecessor_blob_sha":{"oneOf":[{"type":"string","pattern":"^[0-9a-f]{40}$"},{"type":"null"}]},"predecessor_sha256":{"oneOf":[{"type":"string","pattern":"^[0-9a-f]{64}$"},{"type":"null"}]},"change_is_policy_only":{"const":true},"dependent_evidence_allowed_in_same_candidate":{"const":false},"comparison_rule":{"const":"BASE_CONTROLLED_PREDECESSOR_OR_SINGLE_BOOTSTRAP"}},"allOf":[{"if":{"properties":{"mode":{"const":"BOOTSTRAP"}}},"then":{"properties":{"predecessor_blob_sha":{"type":"null"},"predecessor_sha256":{"type":"null"}}}},{"if":{"properties":{"mode":{"const":"REBASE"}}},"then":{"properties":{"predecessor_blob_sha":{"type":"string","pattern":"^[0-9a-f]{40}$"},"predecessor_sha256":{"type":"string","pattern":"^[0-9a-f]{64}$"}}}}]},"pathBlob":{"type":"object","additionalProperties":false,"required":["path","blob_sha"],"properties":{"path":{"type":"string","minLength":1,"pattern":"^(?!/)(?!.*\\\\)(?!.*//)(?!.*(?:^|/)\\.(?:/|$))(?!.*(?:^|/)\\.\\.(?:/|$))[^\\u0000]+$"},"blob_sha":{"type":"string","pattern":"^[0-9a-f]{40}$"}}},"surfaceFloor":{"type":"object","additionalProperties":false,"required":["surface_id","source_paths","floor_percent"],"properties":{"surface_id":{"type":"string","minLength":1,"maxLength":160,"pattern":"^[A-Za-z0-9][A-Za-z0-9._:-]*$"},"source_paths":{"type":"array","minItems":1,"items":{"type":"string","minLength":1,"pattern":"^(?!/)(?!.*\\\\)(?!.*//)(?!.*(?:^|/)\\.(?:/|$))(?!.*(?:^|/)\\.\\.(?:/|$))[^\\u0000]+$"},"uniqueItems":true},"floor_percent":{"type":"integer","minimum":0,"maximum":100}}}}} \ No newline at end of file diff --git a/specs/016-af-02-adversarial-test-strength/schemas/af02-enforcement-inventory-v1.schema.json b/specs/016-af-02-adversarial-test-strength/schemas/af02-enforcement-inventory-v1.schema.json new file mode 100644 index 00000000..19e6e591 --- /dev/null +++ b/specs/016-af-02-adversarial-test-strength/schemas/af02-enforcement-inventory-v1.schema.json @@ -0,0 +1 @@ +{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://commandf.dev/schemas/af02-enforcement-inventory-v1.schema.json","title":"commandf.af02-enforcement-inventory/v1","type":"object","additionalProperties":false,"required":["schema","policy_status","entries","closure_rule"],"properties":{"schema":{"const":"commandf.af02-enforcement-inventory/v1"},"policy_status":{"const":"PLANNING_FREEZE"},"entries":{"const":[{"role":"AF02_SCHEMA","required_from_stack":"A0","implementation_kind":"SCHEMA_SET","planned_path":"specs/016-af-02-adversarial-test-strength/schemas/","entrypoint":"validate-all"},{"role":"AUTHORITY_PROJECTOR","required_from_stack":"A0","implementation_kind":"RUST_MODULE","planned_path":"tools/af02-verifier/src/authority.rs","entrypoint":"project-authority"},{"role":"RETAINED_AUTHORITY_PROJECTOR","required_from_stack":"A0","implementation_kind":"RUST_MODULE","planned_path":"tools/af02-verifier/src/retained.rs","entrypoint":"project-retained"},{"role":"SURFACE_SCANNER","required_from_stack":"A0","implementation_kind":"RUST_MODULE","planned_path":"tools/af02-verifier/src/surface.rs","entrypoint":"scan-surface"},{"role":"SURFACE_POLICY_PARSER","required_from_stack":"A0","implementation_kind":"RUST_MODULE","planned_path":"tools/af02-verifier/src/surface.rs","entrypoint":"parse-surface-policy"},{"role":"RESOURCE_RUNNER","required_from_stack":"A0","implementation_kind":"RUST_MODULE","planned_path":"tools/af02-verifier/src/resource.rs","entrypoint":"run-bounded"},{"role":"RESOURCE_POLICY_PARSER","required_from_stack":"A0","implementation_kind":"RUST_MODULE","planned_path":"tools/af02-verifier/src/resource.rs","entrypoint":"parse-resource-policy"},{"role":"TOOL_ACQUISITION_VERIFIER","required_from_stack":"A0","implementation_kind":"RUST_MODULE","planned_path":"tools/af02-verifier/src/tool_lock.rs","entrypoint":"verify-tool-lock"},{"role":"CORPUS_MANIFEST_PARSER","required_from_stack":"A0","implementation_kind":"RUST_MODULE","planned_path":"tools/af02-verifier/src/corpus.rs","entrypoint":"parse-corpus"},{"role":"ASSERTION_REGISTRY_PARSER","required_from_stack":"A0","implementation_kind":"RUST_MODULE","planned_path":"tools/af02-verifier/src/corpus.rs","entrypoint":"parse-assertions"},{"role":"VERIFIER_INPUT_GUARD","required_from_stack":"A0","implementation_kind":"RUST_MODULE","planned_path":"tools/af02-verifier/src/input_guard.rs","entrypoint":"guard-inputs"},{"role":"BASE_POLICY_COMPARATOR","required_from_stack":"A0","implementation_kind":"RUST_MODULE","planned_path":"tools/af02-verifier/src/policy.rs","entrypoint":"compare-base-policy"},{"role":"SEMANTIC_CONTRACT_VERIFIER","required_from_stack":"A0","implementation_kind":"RUST_MODULE","planned_path":"tools/af02-verifier/src/semantic.rs","entrypoint":"verify-semantic-contract"},{"role":"REQUIRED_CHECK_PROVENANCE_VERIFIER","required_from_stack":"A0","implementation_kind":"RUST_MODULE","planned_path":"tools/af02-verifier/src/github_provenance.rs","entrypoint":"verify-required-checks"},{"role":"AF02_WORKFLOW","required_from_stack":"A0","implementation_kind":"WORKFLOW","planned_path":".github/workflows/af02-base-verifier.yml","entrypoint":"af02-base-verifier"},{"role":"AF02_ACTION_OR_SCRIPT","required_from_stack":"A0","implementation_kind":"SCRIPT","planned_path":".github/scripts/run_af02_base_verifier.sh","entrypoint":"run-af02-base-verifier"},{"role":"REPLAY_RUNNER","required_from_stack":"A1","implementation_kind":"RUST_MODULE","planned_path":"tools/af02-verifier/src/replay.rs","entrypoint":"run-replay"},{"role":"RESULT_NORMALIZER","required_from_stack":"A1","implementation_kind":"RUST_MODULE","planned_path":"tools/af02-verifier/src/replay.rs","entrypoint":"normalize-result"},{"role":"NEXTEST_RESULT_PARSER","required_from_stack":"B0","implementation_kind":"RUST_MODULE","planned_path":"tools/af02-verifier/src/nextest.rs","entrypoint":"parse-nextest"},{"role":"COVERAGE_REPORT_PARSER","required_from_stack":"B0","implementation_kind":"RUST_MODULE","planned_path":"tools/af02-verifier/src/coverage.rs","entrypoint":"parse-coverage"},{"role":"COVERAGE_POLICY_PARSER","required_from_stack":"B0","implementation_kind":"RUST_MODULE","planned_path":"tools/af02-verifier/src/coverage.rs","entrypoint":"parse-coverage-policy"},{"role":"MUTATION_INVENTORY_PARSER","required_from_stack":"C0","implementation_kind":"RUST_MODULE","planned_path":"tools/af02-verifier/src/mutation.rs","entrypoint":"parse-mutation-inventory"},{"role":"MUTATION_RESULT_PARSER","required_from_stack":"C0","implementation_kind":"RUST_MODULE","planned_path":"tools/af02-verifier/src/mutation.rs","entrypoint":"parse-mutation-results"},{"role":"MUTATION_POLICY_PARSER","required_from_stack":"C0","implementation_kind":"RUST_MODULE","planned_path":"tools/af02-verifier/src/mutation.rs","entrypoint":"parse-mutation-policy"},{"role":"WAIVER_POLICY_VERIFIER","required_from_stack":"C0","implementation_kind":"RUST_MODULE","planned_path":"tools/af02-verifier/src/waiver.rs","entrypoint":"verify-waivers"},{"role":"PROOF_BUILDER","required_from_stack":"C0","implementation_kind":"RUST_MODULE","planned_path":"tools/af02-verifier/src/proof.rs","entrypoint":"build-proof"},{"role":"PROOF_VERIFIER","required_from_stack":"C0","implementation_kind":"RUST_MODULE","planned_path":"tools/af02-verifier/src/proof.rs","entrypoint":"verify-proof"}]},"closure_rule":{"const":"EXACT_ROLE_SET_NO_DUPLICATES_ACTIVE_PATHS_MUST_RESOLVE_AT_OR_AFTER_REQUIRED_STACK"}}} \ No newline at end of file diff --git a/specs/016-af-02-adversarial-test-strength/schemas/af02-evidence-inventories-v1.schema.json b/specs/016-af-02-adversarial-test-strength/schemas/af02-evidence-inventories-v1.schema.json new file mode 100644 index 00000000..5e3cd919 --- /dev/null +++ b/specs/016-af-02-adversarial-test-strength/schemas/af02-evidence-inventories-v1.schema.json @@ -0,0 +1,159 @@ +{ + "$schema":"https://json-schema.org/draft/2020-12/schema", + "$id":"https://commandf.dev/schemas/af02-evidence-inventories-v1.schema.json", + "title":"AF-02 closed evidence inventory schemas", + "oneOf":[ + {"$ref":"#/$defs/sourceUniverse"}, + {"$ref":"#/$defs/assertionRegistry"}, + {"$ref":"#/$defs/replayResults"}, + {"$ref":"#/$defs/coverageInventory"}, + {"$ref":"#/$defs/mutationInventory"}, + {"$ref":"#/$defs/corpusFixtureInventory"}, + {"$ref":"#/$defs/propertyCounterexampleInventory"}, + {"$ref":"#/$defs/enforcementInventory"} + ], + "$defs":{ + "gitSha":{"type":"string","pattern":"^[0-9a-f]{40}$"}, + "sha256":{"type":"string","pattern":"^[0-9a-f]{64}$"}, + "path":{"type":"string","minLength":1,"pattern":"^(?!/)(?!.*(?:^|/)\\.\\.(?:/|$))(?!.*\\\\)(?!.*//).+$"}, + "id":{"type":"string","minLength":1,"maxLength":160,"pattern":"^[A-Za-z0-9][A-Za-z0-9._:-]*$"}, + "nonNegative":{"type":"integer","minimum":0}, + "positive":{"type":"integer","minimum":1}, + "sourceUniverse":{ + "type":"object","additionalProperties":false, + "required":["schema","source_sha","source_tree","exclusion_policy_sha256","roots","files"], + "properties":{ + "schema":{"const":"commandf.af02-source-universe/v1"}, + "source_sha":{"$ref":"#/$defs/gitSha"},"source_tree":{"$ref":"#/$defs/gitSha"},"exclusion_policy_sha256":{"$ref":"#/$defs/sha256"}, + "roots":{"const":["crates/**/src/**/*.rs","tools/**/src/**/*.rs"]}, + "files":{"type":"array","minItems":1,"items":{"type":"object","additionalProperties":false,"required":["path","blob_sha"],"properties":{"path":{"$ref":"#/$defs/path"},"blob_sha":{"$ref":"#/$defs/gitSha"}}}} + } + }, + "assertionRegistry":{ + "type":"object","additionalProperties":false, + "required":["schema","source_sha","corpus_manifest_sha256","surface_policy_sha256","entries"], + "properties":{ + "schema":{"const":"commandf.af02-assertion-registry/v1"},"source_sha":{"$ref":"#/$defs/gitSha"},"corpus_manifest_sha256":{"$ref":"#/$defs/sha256"},"surface_policy_sha256":{"$ref":"#/$defs/sha256"}, + "entries":{"type":"array","items":{"$ref":"#/$defs/assertionEntry"}} + } + }, + "assertionEntry":{ + "type":"object","additionalProperties":false, + "required":["assertion_id","scenario_id","surface_id","runner_kind","manifest_path","package_or_binary","cargo_target_or_null","test_name_or_null","argv","cwd_repo_relative","environment_allowlist","expected_outcome","result_parser_id","source_paths","config_sha256s"], + "properties":{ + "assertion_id":{"$ref":"#/$defs/id"},"scenario_id":{"$ref":"#/$defs/id"},"surface_id":{"$ref":"#/$defs/id"}, + "runner_kind":{"enum":["CARGO_TEST","AF02_REPLAY_BINARY"]},"manifest_path":{"$ref":"#/$defs/path"},"package_or_binary":{"type":"string","minLength":1}, + "cargo_target_or_null":{"oneOf":[{"type":"string","minLength":1},{"type":"null"}]},"test_name_or_null":{"oneOf":[{"type":"string","minLength":1},{"type":"null"}]}, + "argv":{"type":"array","minItems":1,"items":{"type":"string","maxLength":4096}},"cwd_repo_relative":{"$ref":"#/$defs/path"}, + "environment_allowlist":{"type":"object","propertyNames":{"pattern":"^[A-Z_][A-Z0-9_]*$"},"additionalProperties":{"type":"string","maxLength":4096}}, + "expected_outcome":{"enum":["ACCEPT_CANONICAL","REJECT_INVALID","FAIL_CLOSED_LIMIT"]},"result_parser_id":{"$ref":"#/$defs/id"}, + "source_paths":{"type":"array","minItems":1,"items":{"$ref":"#/$defs/path"},"uniqueItems":true},"config_sha256s":{"type":"array","items":{"$ref":"#/$defs/sha256"},"uniqueItems":true} + }, + "allOf":[ + {"if":{"properties":{"runner_kind":{"const":"CARGO_TEST"}}},"then":{"properties":{"cargo_target_or_null":{"type":"string","minLength":1},"test_name_or_null":{"type":"string","minLength":1}}}}, + {"if":{"properties":{"runner_kind":{"const":"AF02_REPLAY_BINARY"}}},"then":{"properties":{"cargo_target_or_null":{"type":"null"},"test_name_or_null":{"type":"null"}}}} + ] + }, + "replayResults":{ + "type":"object","additionalProperties":false, + "required":["schema","source_sha","assertion_registry_sha256","entries"], + "properties":{ + "schema":{"const":"commandf.af02-replay-results/v1"},"source_sha":{"$ref":"#/$defs/gitSha"},"assertion_registry_sha256":{"$ref":"#/$defs/sha256"}, + "entries":{"type":"array","items":{"type":"object","additionalProperties":false,"required":["assertion_id","scenario_id","runner_kind","process_exit_code","normalized_outcome","raw_stdout_sha256","raw_stderr_sha256","structured_result_sha256_or_null"],"properties":{"assertion_id":{"$ref":"#/$defs/id"},"scenario_id":{"$ref":"#/$defs/id"},"runner_kind":{"enum":["CARGO_TEST","AF02_REPLAY_BINARY"]},"process_exit_code":{"type":"integer","minimum":0,"maximum":255},"normalized_outcome":{"enum":["ACCEPT_CANONICAL","REJECT_INVALID","FAIL_CLOSED_LIMIT","UNEXPECTED_ACCEPTANCE","INVARIANT_VIOLATION","ORACLE_DIVERGENCE","PANIC_OR_ABORT","HARNESS_TIMEOUT","HARNESS_MEMORY_LIMIT","HARNESS_FILESYSTEM_LIMIT","HARNESS_PROCESS_LIMIT","HARNESS_INTERNAL_ERROR"]},"raw_stdout_sha256":{"$ref":"#/$defs/sha256"},"raw_stderr_sha256":{"$ref":"#/$defs/sha256"},"structured_result_sha256_or_null":{"oneOf":[{"$ref":"#/$defs/sha256"},{"type":"null"}]}}}} + } + }, + "coverageInventory":{ + "type":"object","additionalProperties":false, + "required":["schema","source_sha","source_universe_sha256","descriptor_sha256","exclusion_policy_sha256","files","critical_surfaces"], + "properties":{ + "schema":{"const":"commandf.af02-coverage-inventory/v1"},"source_sha":{"$ref":"#/$defs/gitSha"},"source_universe_sha256":{"$ref":"#/$defs/sha256"},"descriptor_sha256":{"$ref":"#/$defs/sha256"},"exclusion_policy_sha256":{"$ref":"#/$defs/sha256"}, + "files":{"type":"array","minItems":1,"items":{"type":"object","additionalProperties":false,"required":["path","covered_lines","total_lines"],"properties":{"path":{"$ref":"#/$defs/path"},"covered_lines":{"$ref":"#/$defs/nonNegative"},"total_lines":{"$ref":"#/$defs/nonNegative"}}}}, + "critical_surfaces":{"type":"array","items":{"type":"object","additionalProperties":false,"required":["surface_id","source_paths","covered_lines","total_lines","floor_percent"],"properties":{"surface_id":{"$ref":"#/$defs/id"},"source_paths":{"type":"array","minItems":1,"items":{"$ref":"#/$defs/path"},"uniqueItems":true},"covered_lines":{"$ref":"#/$defs/nonNegative"},"total_lines":{"$ref":"#/$defs/positive"},"floor_percent":{"type":"integer","minimum":0,"maximum":100}}}} + } + }, + "mutationInventory":{ + "type":"object","additionalProperties":false, + "required":["schema","source_sha","tool_lock_entry_sha256","mutation_policy_sha256","exclusion_policy_sha256","targeted_source_paths","entries","results"], + "properties":{ + "schema":{"const":"commandf.af02-mutation-inventory/v1"},"source_sha":{"$ref":"#/$defs/gitSha"},"tool_lock_entry_sha256":{"$ref":"#/$defs/sha256"},"mutation_policy_sha256":{"$ref":"#/$defs/sha256"},"exclusion_policy_sha256":{"$ref":"#/$defs/sha256"}, + "targeted_source_paths":{"type":"array","minItems":1,"items":{"$ref":"#/$defs/path"},"uniqueItems":true}, + "entries":{"type":"array","items":{"$ref":"#/$defs/mutantEntry"}},"results":{"type":"array","items":{"$ref":"#/$defs/mutantResult"}} + } + }, + "mutantEntry":{ + "type":"object","additionalProperties":false, + "required":["mutant_id","source_path","source_blob_sha","start_line","start_column","end_line","end_column","enclosing_function_or_null","mutation_description","mutant_diff_sha256","disposition","exclusion_id_or_null"], + "properties":{"mutant_id":{"$ref":"#/$defs/sha256"},"source_path":{"$ref":"#/$defs/path"},"source_blob_sha":{"$ref":"#/$defs/gitSha"},"start_line":{"$ref":"#/$defs/positive"},"start_column":{"$ref":"#/$defs/nonNegative"},"end_line":{"$ref":"#/$defs/positive"},"end_column":{"$ref":"#/$defs/nonNegative"},"enclosing_function_or_null":{"oneOf":[{"type":"string","minLength":1},{"type":"null"}]},"mutation_description":{"type":"string","minLength":1},"mutant_diff_sha256":{"$ref":"#/$defs/sha256"},"disposition":{"enum":["REQUIRED","EXCLUDED"]},"exclusion_id_or_null":{"oneOf":[{"type":"string","pattern":"^MUT-X[0-9]{4}$"},{"type":"null"}]}}, + "allOf":[{"if":{"properties":{"disposition":{"const":"REQUIRED"}}},"then":{"properties":{"exclusion_id_or_null":{"type":"null"}}}},{"if":{"properties":{"disposition":{"const":"EXCLUDED"}}},"then":{"properties":{"exclusion_id_or_null":{"type":"string","pattern":"^MUT-X[0-9]{4}$"}}}}] + }, + "mutantResult":{ + "type":"object","additionalProperties":false, + "required":["mutant_id","result_class","attempt_count","diagnosis_sha256_or_null","waiver_id_or_null"], + "properties":{"mutant_id":{"$ref":"#/$defs/sha256"},"result_class":{"enum":["KILLED","SURVIVED","TIMEOUT","UNVIABLE_OR_BUILD_FAILURE","WAIVED_EQUIVALENT_OR_OUT_OF_SCOPE"]},"attempt_count":{"$ref":"#/$defs/positive"},"diagnosis_sha256_or_null":{"oneOf":[{"$ref":"#/$defs/sha256"},{"type":"null"}]},"waiver_id_or_null":{"oneOf":[{"type":"string","minLength":1},{"type":"null"}]}} + }, + "corpusFixtureInventory":{ + "type":"object","additionalProperties":false, + "required":["schema","source_sha","corpus_manifest_sha256","entries","total_fixture_bytes"], + "properties":{"schema":{"const":"commandf.af02-corpus-fixture-inventory/v1"},"source_sha":{"$ref":"#/$defs/gitSha"},"corpus_manifest_sha256":{"$ref":"#/$defs/sha256"},"entries":{"type":"array","items":{"type":"object","additionalProperties":false,"required":["scenario_id","path","sha256","byte_length","provenance_class","assertion_id"],"properties":{"scenario_id":{"$ref":"#/$defs/id"},"path":{"$ref":"#/$defs/path"},"sha256":{"$ref":"#/$defs/sha256"},"byte_length":{"type":"integer","minimum":0,"maximum":262144},"provenance_class":{"enum":["SYNTHETIC","PUBLIC_REDISTRIBUTABLE","GENERATED_FROM_SYNTHETIC","OPAQUE_FUZZ_ARTIFACT_SAFE"]},"assertion_id":{"$ref":"#/$defs/id"}}}},"total_fixture_bytes":{"type":"integer","minimum":0,"maximum":8388608}} + }, + "propertyCounterexampleInventory":{ + "type":"object","additionalProperties":false, + "required":["schema","source_sha","property_config_sha256","entries"], + "properties":{"schema":{"const":"commandf.af02-property-counterexample-inventory/v1"},"source_sha":{"$ref":"#/$defs/gitSha"},"property_config_sha256":{"$ref":"#/$defs/sha256"},"entries":{"type":"array","items":{"type":"object","additionalProperties":false,"required":["property_id","counterexample_id","raw_sha256","minimized_sha256","status","promoted_scenario_id_or_null"],"properties":{"property_id":{"$ref":"#/$defs/id"},"counterexample_id":{"$ref":"#/$defs/id"},"raw_sha256":{"$ref":"#/$defs/sha256"},"minimized_sha256":{"$ref":"#/$defs/sha256"},"status":{"enum":["PROMOTED_REGRESSION","OPEN_DEFECT"]},"promoted_scenario_id_or_null":{"oneOf":[{"$ref":"#/$defs/id"},{"type":"null"}]}}}}} + }, + "enforcementInventory":{ + "type":"object","additionalProperties":false, + "required":["schema","policy_base_sha","entries"], + "properties":{ + "schema":{"const":"commandf.af02-enforcement-inventory/v1"}, + "policy_base_sha":{"$ref":"#/$defs/gitSha"}, + "entries":{ + "type":"array", + "minItems":27, + "maxItems":27, + "items":{ + "type":"object","additionalProperties":false, + "required":["role","path","blob_sha_at_policy_base","language_or_format","entry_symbol_or_job","owned_test_paths"], + "properties":{ + "role":{"enum":["AF02_SCHEMA","AUTHORITY_PROJECTOR","RETAINED_AUTHORITY_PROJECTOR","SURFACE_SCANNER","SURFACE_POLICY_PARSER","RESOURCE_RUNNER","RESOURCE_POLICY_PARSER","TOOL_ACQUISITION_VERIFIER","CORPUS_MANIFEST_PARSER","ASSERTION_REGISTRY_PARSER","VERIFIER_INPUT_GUARD","BASE_POLICY_COMPARATOR","SEMANTIC_CONTRACT_VERIFIER","REQUIRED_CHECK_PROVENANCE_VERIFIER","AF02_WORKFLOW","AF02_ACTION_OR_SCRIPT","REPLAY_RUNNER","RESULT_NORMALIZER","NEXTEST_RESULT_PARSER","COVERAGE_REPORT_PARSER","COVERAGE_POLICY_PARSER","MUTATION_INVENTORY_PARSER","MUTATION_RESULT_PARSER","MUTATION_POLICY_PARSER","WAIVER_POLICY_VERIFIER","PROOF_BUILDER","PROOF_VERIFIER"]}, + "path":{"$ref":"#/$defs/path"}, + "blob_sha_at_policy_base":{"$ref":"#/$defs/gitSha"}, + "language_or_format":{"type":"string","minLength":1}, + "entry_symbol_or_job":{"type":"string","minLength":1}, + "owned_test_paths":{"type":"array","minItems":1,"items":{"$ref":"#/$defs/path"},"uniqueItems":true} + } + }, + "allOf":[ + {"contains":{"properties":{"role":{"const":"AF02_SCHEMA"}},"required":["role"]},"minContains":1,"maxContains":1}, + {"contains":{"properties":{"role":{"const":"AUTHORITY_PROJECTOR"}},"required":["role"]},"minContains":1,"maxContains":1}, + {"contains":{"properties":{"role":{"const":"RETAINED_AUTHORITY_PROJECTOR"}},"required":["role"]},"minContains":1,"maxContains":1}, + {"contains":{"properties":{"role":{"const":"SURFACE_SCANNER"}},"required":["role"]},"minContains":1,"maxContains":1}, + {"contains":{"properties":{"role":{"const":"SURFACE_POLICY_PARSER"}},"required":["role"]},"minContains":1,"maxContains":1}, + {"contains":{"properties":{"role":{"const":"RESOURCE_RUNNER"}},"required":["role"]},"minContains":1,"maxContains":1}, + {"contains":{"properties":{"role":{"const":"RESOURCE_POLICY_PARSER"}},"required":["role"]},"minContains":1,"maxContains":1}, + {"contains":{"properties":{"role":{"const":"TOOL_ACQUISITION_VERIFIER"}},"required":["role"]},"minContains":1,"maxContains":1}, + {"contains":{"properties":{"role":{"const":"CORPUS_MANIFEST_PARSER"}},"required":["role"]},"minContains":1,"maxContains":1}, + {"contains":{"properties":{"role":{"const":"ASSERTION_REGISTRY_PARSER"}},"required":["role"]},"minContains":1,"maxContains":1}, + {"contains":{"properties":{"role":{"const":"VERIFIER_INPUT_GUARD"}},"required":["role"]},"minContains":1,"maxContains":1}, + {"contains":{"properties":{"role":{"const":"BASE_POLICY_COMPARATOR"}},"required":["role"]},"minContains":1,"maxContains":1}, + {"contains":{"properties":{"role":{"const":"SEMANTIC_CONTRACT_VERIFIER"}},"required":["role"]},"minContains":1,"maxContains":1}, + {"contains":{"properties":{"role":{"const":"REQUIRED_CHECK_PROVENANCE_VERIFIER"}},"required":["role"]},"minContains":1,"maxContains":1}, + {"contains":{"properties":{"role":{"const":"AF02_WORKFLOW"}},"required":["role"]},"minContains":1,"maxContains":1}, + {"contains":{"properties":{"role":{"const":"AF02_ACTION_OR_SCRIPT"}},"required":["role"]},"minContains":1,"maxContains":1}, + {"contains":{"properties":{"role":{"const":"REPLAY_RUNNER"}},"required":["role"]},"minContains":1,"maxContains":1}, + {"contains":{"properties":{"role":{"const":"RESULT_NORMALIZER"}},"required":["role"]},"minContains":1,"maxContains":1}, + {"contains":{"properties":{"role":{"const":"NEXTEST_RESULT_PARSER"}},"required":["role"]},"minContains":1,"maxContains":1}, + {"contains":{"properties":{"role":{"const":"COVERAGE_REPORT_PARSER"}},"required":["role"]},"minContains":1,"maxContains":1}, + {"contains":{"properties":{"role":{"const":"COVERAGE_POLICY_PARSER"}},"required":["role"]},"minContains":1,"maxContains":1}, + {"contains":{"properties":{"role":{"const":"MUTATION_INVENTORY_PARSER"}},"required":["role"]},"minContains":1,"maxContains":1}, + {"contains":{"properties":{"role":{"const":"MUTATION_RESULT_PARSER"}},"required":["role"]},"minContains":1,"maxContains":1}, + {"contains":{"properties":{"role":{"const":"MUTATION_POLICY_PARSER"}},"required":["role"]},"minContains":1,"maxContains":1}, + {"contains":{"properties":{"role":{"const":"WAIVER_POLICY_VERIFIER"}},"required":["role"]},"minContains":1,"maxContains":1}, + {"contains":{"properties":{"role":{"const":"PROOF_BUILDER"}},"required":["role"]},"minContains":1,"maxContains":1}, + {"contains":{"properties":{"role":{"const":"PROOF_VERIFIER"}},"required":["role"]},"minContains":1,"maxContains":1} + ] + } + } + } + } +} diff --git a/specs/016-af-02-adversarial-test-strength/schemas/af02-exclusion-policy-v1.schema.json b/specs/016-af-02-adversarial-test-strength/schemas/af02-exclusion-policy-v1.schema.json new file mode 100644 index 00000000..d41b1c6e --- /dev/null +++ b/specs/016-af-02-adversarial-test-strength/schemas/af02-exclusion-policy-v1.schema.json @@ -0,0 +1,57 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://commandf.dev/schemas/af02-exclusion-policy-v1.schema.json", + "title": "commandf.af02-exclusion-policy/v1", + "type": "object", + "additionalProperties": false, + "required": ["schema","policy_base_sha","policy_base_tree","production_source_exclusions","mutation_exclusions","rules"], + "properties": { + "schema":{"const":"commandf.af02-exclusion-policy/v1"}, + "policy_base_sha":{"type":"string","pattern":"^[0-9a-f]{40}$"}, + "policy_base_tree":{"type":"string","pattern":"^[0-9a-f]{40}$"}, + "production_source_exclusions":{"type":"array","items":{"$ref":"#/$defs/sourceExclusion"}}, + "mutation_exclusions":{"type":"array","items":{"$ref":"#/$defs/mutationExclusion"}}, + "rules": { + "type":"object","additionalProperties":false, + "required":["surface_and_coverage_share_production_source_exclusions","new_exclusion_requires_prior_canonical_policy_change","same_candidate_exclusion_cannot_make_dependent_evidence_green","post_result_exclusion_creation_prohibited","unlisted_exclusion_prohibited"], + "properties": { + "surface_and_coverage_share_production_source_exclusions":{"const":true}, + "new_exclusion_requires_prior_canonical_policy_change":{"const":true}, + "same_candidate_exclusion_cannot_make_dependent_evidence_green":{"const":true}, + "post_result_exclusion_creation_prohibited":{"const":true}, + "unlisted_exclusion_prohibited":{"const":true} + } + } + }, + "$defs": { + "gitSha":{"type":"string","pattern":"^[0-9a-f]{40}$"}, + "sha256":{"type":"string","pattern":"^[0-9a-f]{64}$"}, + "path":{"type":"string","minLength":1,"pattern":"^(?!/)(?!.*(?:^|/)\\.\\.(?:/|$))(?!.*\\\\).+$"}, + "sourceExclusion": { + "type":"object","additionalProperties":false, + "required":["exclusion_id","path","reason","owner","introduced_policy_sha","review_reference","removal_condition"], + "properties": { + "exclusion_id":{"type":"string","pattern":"^SRC-X[0-9]{4}$"}, + "path":{"$ref":"#/$defs/path"}, + "reason":{"type":"string","minLength":10}, + "owner":{"type":"string","minLength":1}, + "introduced_policy_sha":{"$ref":"#/$defs/gitSha"}, + "review_reference":{"type":"string","minLength":1}, + "removal_condition":{"type":"string","minLength":1} + } + }, + "mutationExclusion": { + "type":"object","additionalProperties":false, + "required":["exclusion_id","matcher_sha256","reason","owner","introduced_policy_sha","review_reference","removal_condition"], + "properties": { + "exclusion_id":{"type":"string","pattern":"^MUT-X[0-9]{4}$"}, + "matcher_sha256":{"$ref":"#/$defs/sha256"}, + "reason":{"type":"string","minLength":10}, + "owner":{"type":"string","minLength":1}, + "introduced_policy_sha":{"$ref":"#/$defs/gitSha"}, + "review_reference":{"type":"string","minLength":1}, + "removal_condition":{"type":"string","minLength":1} + } + } + } +} diff --git a/specs/016-af-02-adversarial-test-strength/schemas/af02-mutation-policy-v1.schema.json b/specs/016-af-02-adversarial-test-strength/schemas/af02-mutation-policy-v1.schema.json new file mode 100644 index 00000000..b345f57b --- /dev/null +++ b/specs/016-af-02-adversarial-test-strength/schemas/af02-mutation-policy-v1.schema.json @@ -0,0 +1 @@ +{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://commandf.dev/schemas/af02-mutation-policy-v1.schema.json","title":"commandf.af02-mutation-policy/v1","type":"object","additionalProperties":false,"required":["schema","lineage","source_sha","source_tree","tool_id","tool_lock_entry_sha256","command_argv","target_source_paths","exclusion_policy_sha256","test_command_argv","timeout_seconds","retry_limit","diagnosis_required_for","waiver_policy_sha256","selection_rule","post_list_selection_allowed","green_result_classes"],"properties":{"schema":{"const":"commandf.af02-mutation-policy/v1"},"lineage":{"$ref":"#/$defs/lineage"},"source_sha":{"type":"string","pattern":"^[0-9a-f]{40}$"},"source_tree":{"type":"string","pattern":"^[0-9a-f]{40}$"},"tool_id":{"const":"cargo-mutants"},"tool_lock_entry_sha256":{"type":"string","pattern":"^[0-9a-f]{64}$"},"command_argv":{"type":"array","minItems":2,"maxItems":64,"items":{"type":"string","minLength":1,"maxLength":4096}},"target_source_paths":{"type":"array","minItems":1,"uniqueItems":true,"items":{"type":"string","minLength":1,"pattern":"^(?!/)(?!.*\\\\)(?!.*//)(?!.*(?:^|/)\\.(?:/|$))(?!.*(?:^|/)\\.\\.(?:/|$))[^\\u0000]+$"}},"exclusion_policy_sha256":{"type":"string","pattern":"^[0-9a-f]{64}$"},"test_command_argv":{"type":"array","minItems":2,"maxItems":64,"items":{"type":"string","minLength":1,"maxLength":4096}},"timeout_seconds":{"type":"integer","minimum":1,"maximum":3600},"retry_limit":{"type":"integer","minimum":1,"maximum":3},"diagnosis_required_for":{"const":["TIMEOUT","UNVIABLE_OR_BUILD_FAILURE"]},"waiver_policy_sha256":{"type":"string","pattern":"^[0-9a-f]{64}$"},"selection_rule":{"const":"ALL_LISTED_IN_TARGET_MINUS_PREFROZEN_EXCLUSIONS"},"post_list_selection_allowed":{"const":false},"green_result_classes":{"const":["KILLED","WAIVED_EQUIVALENT_OR_OUT_OF_SCOPE"]}},"$defs":{"lineage":{"type":"object","additionalProperties":false,"required":["mode","canonical_base_sha","canonical_base_tree","policy_path","predecessor_blob_sha","predecessor_sha256","change_is_policy_only","dependent_evidence_allowed_in_same_candidate","comparison_rule"],"properties":{"mode":{"enum":["BOOTSTRAP","REBASE"]},"canonical_base_sha":{"type":"string","pattern":"^[0-9a-f]{40}$"},"canonical_base_tree":{"type":"string","pattern":"^[0-9a-f]{40}$"},"policy_path":{"const":"specs/016-af-02-adversarial-test-strength/mutation-policy.json"},"predecessor_blob_sha":{"oneOf":[{"type":"string","pattern":"^[0-9a-f]{40}$"},{"type":"null"}]},"predecessor_sha256":{"oneOf":[{"type":"string","pattern":"^[0-9a-f]{64}$"},{"type":"null"}]},"change_is_policy_only":{"const":true},"dependent_evidence_allowed_in_same_candidate":{"const":false},"comparison_rule":{"const":"BASE_CONTROLLED_PREDECESSOR_OR_SINGLE_BOOTSTRAP"}},"allOf":[{"if":{"properties":{"mode":{"const":"BOOTSTRAP"}}},"then":{"properties":{"predecessor_blob_sha":{"type":"null"},"predecessor_sha256":{"type":"null"}}}},{"if":{"properties":{"mode":{"const":"REBASE"}}},"then":{"properties":{"predecessor_blob_sha":{"type":"string","pattern":"^[0-9a-f]{40}$"},"predecessor_sha256":{"type":"string","pattern":"^[0-9a-f]{64}$"}}}}]}}} \ No newline at end of file diff --git a/specs/016-af-02-adversarial-test-strength/schemas/af02-required-check-policy-v1.schema.json b/specs/016-af-02-adversarial-test-strength/schemas/af02-required-check-policy-v1.schema.json new file mode 100644 index 00000000..3036ba3c --- /dev/null +++ b/specs/016-af-02-adversarial-test-strength/schemas/af02-required-check-policy-v1.schema.json @@ -0,0 +1,6 @@ +{ + "$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://commandf.dev/schemas/af02-required-check-policy-v1.schema.json","title":"commandf.af02-required-check-policy/v1","type":"object","additionalProperties":false, + "required":["schema","repository","app","event","checks"], + "properties":{"schema":{"const":"commandf.af02-required-check-policy/v1"},"repository":{"const":"TheHalfMoon/commandF"},"app":{"type":"object","additionalProperties":false,"required":["id","slug","owner"],"properties":{"id":{"const":15368},"slug":{"const":"github-actions"},"owner":{"const":"github"}}},"event":{"const":"pull_request"},"checks":{"type":"array","minItems":3,"maxItems":3,"prefixItems":[{"$ref":"#/$defs/assurance"},{"$ref":"#/$defs/rust"},{"$ref":"#/$defs/scorecard"}],"items":false}}, + "$defs":{"gitSha":{"type":"string","pattern":"^[0-9a-f]{40}$"},"base":{"type":"object","additionalProperties":false,"required":["context","workflow_id","workflow_path","workflow_blob_sha","job_name"],"properties":{"context":{"type":"string"},"workflow_id":{"type":"integer","minimum":1},"workflow_path":{"type":"string","pattern":"^\\.github/workflows/[A-Za-z0-9._-]+\\.ya?ml$"},"workflow_blob_sha":{"$ref":"#/$defs/gitSha"},"job_name":{"type":"string","minLength":1}}},"assurance":{"allOf":[{"$ref":"#/$defs/base"},{"properties":{"context":{"const":"assurance-proof"},"workflow_id":{"const":343599979},"workflow_path":{"const":".github/workflows/af01-assurance-proof.yml"},"workflow_blob_sha":{"const":"f41045416803fac9ed22aeacf0e38c0fc2a6289f"},"job_name":{"const":"assurance-proof"}}}]},"rust":{"allOf":[{"$ref":"#/$defs/base"},{"properties":{"context":{"const":"rust"},"workflow_id":{"const":333259855},"workflow_path":{"const":".github/workflows/ci.yml"},"workflow_blob_sha":{"const":"41f33c1aa0f458363cc92bbc206df4fe203b32ef"},"job_name":{"const":"rust"}}}]},"scorecard":{"allOf":[{"$ref":"#/$defs/base"},{"properties":{"context":{"const":"scorecard"},"workflow_id":{"const":343592713},"workflow_path":{"const":".github/workflows/af01-scorecard.yml"},"workflow_blob_sha":{"const":"69aa7d808d7b13b3a7cac21a71a09b55c432794b"},"job_name":{"const":"scorecard"}}}]}} +} diff --git a/specs/016-af-02-adversarial-test-strength/schemas/af02-required-check-provenance-v1.schema.json b/specs/016-af-02-adversarial-test-strength/schemas/af02-required-check-provenance-v1.schema.json new file mode 100644 index 00000000..1daaeefd --- /dev/null +++ b/specs/016-af-02-adversarial-test-strength/schemas/af02-required-check-provenance-v1.schema.json @@ -0,0 +1 @@ +{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://commandf.dev/schemas/af02-required-check-provenance-v1.schema.json","title":"commandf.af02-required-check-provenance/v1","type":"object","additionalProperties":false,"required":["schema","repository","head_sha","base_sha","policy_sha256","checks"],"properties":{"schema":{"const":"commandf.af02-required-check-provenance/v1"},"repository":{"const":"TheHalfMoon/commandF"},"head_sha":{"type":"string","pattern":"^[0-9a-f]{40}$"},"base_sha":{"type":"string","pattern":"^[0-9a-f]{40}$"},"policy_sha256":{"type":"string","pattern":"^[0-9a-f]{64}$"},"checks":{"type":"object","additionalProperties":false,"required":["assurance-proof","rust","scorecard"],"properties":{"assurance-proof":{"type":"object","additionalProperties":false,"required":["integration_id","app_slug","app_owner","check_run_ref","check_suite_ref","workflow_id","workflow_run_ref","run_attempt","workflow_path","workflow_blob_sha_at_canonical_base","job_name","job_ref","event","conclusion"],"properties":{"integration_id":{"const":15368},"app_slug":{"const":"github-actions"},"app_owner":{"const":"github"},"check_run_ref":{"type":"string","pattern":"^assurance\\-proof:[1-9][0-9]*$"},"check_suite_ref":{"type":"string","pattern":"^assurance\\-proof:[1-9][0-9]*$"},"workflow_id":{"const":343599979},"workflow_run_ref":{"type":"string","pattern":"^assurance\\-proof:[1-9][0-9]*$"},"run_attempt":{"type":"integer","minimum":1},"workflow_path":{"const":".github/workflows/af01-assurance-proof.yml"},"workflow_blob_sha_at_canonical_base":{"const":"f41045416803fac9ed22aeacf0e38c0fc2a6289f"},"job_name":{"const":"assurance-proof"},"job_ref":{"type":"string","pattern":"^assurance\\-proof:[1-9][0-9]*$"},"event":{"const":"pull_request"},"conclusion":{"const":"success"}}},"rust":{"type":"object","additionalProperties":false,"required":["integration_id","app_slug","app_owner","check_run_ref","check_suite_ref","workflow_id","workflow_run_ref","run_attempt","workflow_path","workflow_blob_sha_at_canonical_base","job_name","job_ref","event","conclusion"],"properties":{"integration_id":{"const":15368},"app_slug":{"const":"github-actions"},"app_owner":{"const":"github"},"check_run_ref":{"type":"string","pattern":"^rust:[1-9][0-9]*$"},"check_suite_ref":{"type":"string","pattern":"^rust:[1-9][0-9]*$"},"workflow_id":{"const":333259855},"workflow_run_ref":{"type":"string","pattern":"^rust:[1-9][0-9]*$"},"run_attempt":{"type":"integer","minimum":1},"workflow_path":{"const":".github/workflows/ci.yml"},"workflow_blob_sha_at_canonical_base":{"const":"41f33c1aa0f458363cc92bbc206df4fe203b32ef"},"job_name":{"const":"rust"},"job_ref":{"type":"string","pattern":"^rust:[1-9][0-9]*$"},"event":{"const":"pull_request"},"conclusion":{"const":"success"}}},"scorecard":{"type":"object","additionalProperties":false,"required":["integration_id","app_slug","app_owner","check_run_ref","check_suite_ref","workflow_id","workflow_run_ref","run_attempt","workflow_path","workflow_blob_sha_at_canonical_base","job_name","job_ref","event","conclusion"],"properties":{"integration_id":{"const":15368},"app_slug":{"const":"github-actions"},"app_owner":{"const":"github"},"check_run_ref":{"type":"string","pattern":"^scorecard:[1-9][0-9]*$"},"check_suite_ref":{"type":"string","pattern":"^scorecard:[1-9][0-9]*$"},"workflow_id":{"const":343592713},"workflow_run_ref":{"type":"string","pattern":"^scorecard:[1-9][0-9]*$"},"run_attempt":{"type":"integer","minimum":1},"workflow_path":{"const":".github/workflows/af01-scorecard.yml"},"workflow_blob_sha_at_canonical_base":{"const":"69aa7d808d7b13b3a7cac21a71a09b55c432794b"},"job_name":{"const":"scorecard"},"job_ref":{"type":"string","pattern":"^scorecard:[1-9][0-9]*$"},"event":{"const":"pull_request"},"conclusion":{"const":"success"}}}}}}} \ No newline at end of file diff --git a/specs/016-af-02-adversarial-test-strength/schemas/af02-resource-policy-v1.schema.json b/specs/016-af-02-adversarial-test-strength/schemas/af02-resource-policy-v1.schema.json new file mode 100644 index 00000000..afdf4639 --- /dev/null +++ b/specs/016-af-02-adversarial-test-strength/schemas/af02-resource-policy-v1.schema.json @@ -0,0 +1 @@ +{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://commandf.dev/schemas/af02-resource-policy-v1.schema.json","title":"commandf.af02-resource-policy/v1","type":"object","additionalProperties":false,"required":["schema","lineage","runner_image_digest","machine","campaign_wall_seconds","max_executions_or_zero_if_time_bounded","per_input_timeout_seconds","max_input_bytes","process_memory_mib","cpu_count","pids_limit","tmpfs_mib","max_decompressed_or_generated_bytes","max_temporary_files","subprocess_timeout_seconds","max_single_artifact_bytes","max_total_artifact_bytes","max_committed_corpus_bytes","artifact_retention_days","offline_required","network_mode"],"properties":{"schema":{"const":"commandf.af02-resource-policy/v1"},"lineage":{"$ref":"#/$defs/lineage"},"runner_image_digest":{"const":"sha256:9146b0f62e1939989aa96fc8d89699a43c5635bf212819235a773e1a9e71a98f"},"machine":{"const":"x86_64"},"campaign_wall_seconds":{"type":"integer","minimum":1,"maximum":3600},"max_executions_or_zero_if_time_bounded":{"type":"integer","minimum":0,"maximum":100000000},"per_input_timeout_seconds":{"type":"integer","minimum":1,"maximum":60},"max_input_bytes":{"type":"integer","minimum":1,"maximum":262144},"process_memory_mib":{"type":"integer","minimum":64,"maximum":4096},"cpu_count":{"type":"integer","minimum":1,"maximum":8},"pids_limit":{"type":"integer","minimum":32,"maximum":1024},"tmpfs_mib":{"type":"integer","minimum":64,"maximum":2048},"max_decompressed_or_generated_bytes":{"type":"integer","minimum":1,"maximum":67108864},"max_temporary_files":{"type":"integer","minimum":1,"maximum":10000},"subprocess_timeout_seconds":{"type":"integer","minimum":1,"maximum":600},"max_single_artifact_bytes":{"type":"integer","minimum":1,"maximum":16777216},"max_total_artifact_bytes":{"type":"integer","minimum":1,"maximum":134217728},"max_committed_corpus_bytes":{"const":8388608},"artifact_retention_days":{"type":"integer","minimum":1,"maximum":30},"offline_required":{"const":true},"network_mode":{"const":"none"}},"$defs":{"lineage":{"type":"object","additionalProperties":false,"required":["mode","canonical_base_sha","canonical_base_tree","policy_path","predecessor_blob_sha","predecessor_sha256","change_is_policy_only","dependent_evidence_allowed_in_same_candidate","comparison_rule"],"properties":{"mode":{"enum":["BOOTSTRAP","REBASE"]},"canonical_base_sha":{"type":"string","pattern":"^[0-9a-f]{40}$"},"canonical_base_tree":{"type":"string","pattern":"^[0-9a-f]{40}$"},"policy_path":{"const":"specs/016-af-02-adversarial-test-strength/resource-policy.json"},"predecessor_blob_sha":{"oneOf":[{"type":"string","pattern":"^[0-9a-f]{40}$"},{"type":"null"}]},"predecessor_sha256":{"oneOf":[{"type":"string","pattern":"^[0-9a-f]{64}$"},{"type":"null"}]},"change_is_policy_only":{"const":true},"dependent_evidence_allowed_in_same_candidate":{"const":false},"comparison_rule":{"const":"BASE_CONTROLLED_PREDECESSOR_OR_SINGLE_BOOTSTRAP"}},"allOf":[{"if":{"properties":{"mode":{"const":"BOOTSTRAP"}}},"then":{"properties":{"predecessor_blob_sha":{"type":"null"},"predecessor_sha256":{"type":"null"}}}},{"if":{"properties":{"mode":{"const":"REBASE"}}},"then":{"properties":{"predecessor_blob_sha":{"type":"string","pattern":"^[0-9a-f]{40}$"},"predecessor_sha256":{"type":"string","pattern":"^[0-9a-f]{64}$"}}}}]}}} \ No newline at end of file diff --git a/specs/016-af-02-adversarial-test-strength/schemas/af02-retained-authority-sources-v1.schema.json b/specs/016-af-02-adversarial-test-strength/schemas/af02-retained-authority-sources-v1.schema.json new file mode 100644 index 00000000..7d0daced --- /dev/null +++ b/specs/016-af-02-adversarial-test-strength/schemas/af02-retained-authority-sources-v1.schema.json @@ -0,0 +1 @@ +{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://commandf.dev/schemas/af02-retained-authority-sources-v1.schema.json","title":"commandf.af02-retained-authority-sources/v1","type":"object","additionalProperties":false,"required":["schema","repository","planning_base","cf10","reconstruction"],"properties":{"schema":{"const":"commandf.af02-retained-authority-sources/v1"},"repository":{"const":{"owner":"TheHalfMoon","name":"commandF","full_name":"TheHalfMoon/commandF"}},"planning_base":{"const":{"sha":"2b4033e237a5c74f3c45c12fbc7e7bfdc88067b1","tree":"804ce63c15edb501574bd4aba9a9aadc5bfb07f3"}},"cf10":{"const":{"pull_request":{"number":11,"node_id_numeric":4284052835,"head_ref":"feat/cf-10-real-ig-delta-corpus","base_ref":"main"},"retained_head":"5fe10d9859407272acf6649fc3e868d3eb2fbd12","retained_base":"5cb1a4c3445c0ebd86654cfb467a5e008e801c3e","manifest":{"path":"corpus/real-ig/v1/corpus.json","git_blob_sha":"655949a8a30d67502dffd624a175d2e8e02b1d1f"},"donor":{"path":"donors/cf-10-real-ig-delta-corpus.yaml","git_blob_sha":"566b46f4e6f467a1ccae3ac810b31956309173b6"},"workflow_run":{"id":31916124080,"name":"cf10-real-corpus","path":".github/workflows/cf10-real-corpus.yml","event":"pull_request","workflow_id":335093310,"run_number":45,"run_attempt":1,"check_suite_id":86559814682,"head_sha":"5fe10d9859407272acf6649fc3e868d3eb2fbd12","base_sha":"5cb1a4c3445c0ebd86654cfb467a5e008e801c3e","conclusion":"failure","pull_request_number":11,"pull_request_head_sha":"5fe10d9859407272acf6649fc3e868d3eb2fbd12","pull_request_base_sha":"5cb1a4c3445c0ebd86654cfb467a5e008e801c3e"},"artifact":{"id":9255732702,"name":"cf10-real-corpus-evidence","sha256":"9fdde985bb5abbe53ec2bce2dadc5f65c95557f8848c9af68755fc81a45af612","workflow_run_id":31916124080}}},"reconstruction":{"const":{"supplied_urls_are_authority":false,"api_urls_reconstructed_from_structured_fields":true,"git_blob_verified_before_parse":true,"raw_sha256_computed_after_git_identity":true,"retained_failure_preserved":true}}}} \ No newline at end of file diff --git a/specs/016-af-02-adversarial-test-strength/schemas/af02-semantic-contract-v1.schema.json b/specs/016-af-02-adversarial-test-strength/schemas/af02-semantic-contract-v1.schema.json new file mode 100644 index 00000000..24d49d9a --- /dev/null +++ b/specs/016-af-02-adversarial-test-strength/schemas/af02-semantic-contract-v1.schema.json @@ -0,0 +1 @@ +{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://commandf.dev/schemas/af02-semantic-contract-v1.schema.json","title":"commandf.af02-semantic-contract/v1","type":"object","additionalProperties":false,"required":["schema","verifier","algorithms","negative_fixture_ids"],"properties":{"schema":{"const":"commandf.af02-semantic-contract/v1"},"verifier":{"const":{"package":"commandf-af02-verifier","manifest_path":"tools/af02-verifier/Cargo.toml","binary_path":"tools/af02-verifier/src/main.rs","entrypoint":"verify-pr","rust_version":"1.97.1","offline_required":true,"candidate_code_execution_allowed":false}},"algorithms":{"const":[{"id":"CORE_SCHEMA_VALIDATION","version":1,"inputs":["core proof object","proof_core_schema retrieval URI"],"failure_condition":"Resolve and validate the full core object against the retained closed core schema; empty or partially shaped deterministic content fails."},{"id":"PROOF_ENVELOPE_CLOSURE","version":1,"inputs":["outer proof schema","core schema","extension contract files"],"failure_condition":"Fail unless the full core validates, all extension roles occur exactly once in fixed order and path, and no extension path duplicates any core contract path."},{"id":"SEMANTIC_CONTRACT_SELF_CHECK","version":1,"inputs":["semantic_contract","semantic_contract_schema"],"failure_condition":"Fail unless algorithms and negative fixture IDs equal the exact schema-frozen arrays byte-for-semantic-value."},{"id":"POLICY_PREDECESSOR_COMPARISON","version":1,"inputs":["candidate policy","canonical PR base tree","candidate diff"],"failure_condition":"For BOOTSTRAP require the policy path absent at canonical base; for REBASE require predecessor blob and digest equal the canonical-base file. Any changed policy must be policy-only and cannot carry dependent evidence in the same candidate."},{"id":"CANONICAL_SORT_UNIQUE","version":1,"inputs":["schema-defined arrays and object-key inventories"],"failure_condition":"Fail on wrong order, duplicate semantic key, duplicate id, duplicate path, or ambiguous normalization."},{"id":"SURFACE_CATEGORY_WITNESS_CLOSURE","version":1,"inputs":["surface_policy","Git source tree","scanner output"],"failure_condition":"Fail unless all six categories have matcher, critical-surface, and live Git-blob witness coverage; matcher/surface/witness IDs are unique and every reference resolves."},{"id":"ASSERTION_REPLAY_BIJECTION","version":1,"inputs":["corpus_manifest","assertion_registry","replay_results"],"failure_condition":"Fail unless scenario_id, assertion_id and fixture path are individually unique and scenario/assertion membership is exactly one-to-one across all artifacts."},{"id":"SOURCE_BLOB_RECONSTRUCTION","version":1,"inputs":["source_universe","Git tree"],"failure_condition":"Fail unless every path resolves to exactly one recorded regular-file blob and every eligible tracked source appears once."},{"id":"COVERAGE_ACCOUNTING","version":1,"inputs":["coverage_policy","coverage_inventory","source_universe","surface_policy"],"failure_condition":"Fail on missing, unknown, duplicate, overlapping, or arithmetically inconsistent production or critical-surface coverage, or policy lineage mismatch."},{"id":"MUTATION_MEMBERSHIP","version":1,"inputs":["mutation_policy","mutation_inventory","exclusion_policy"],"failure_condition":"Fail unless every listed in-target mutant has exactly one required or precanonical excluded disposition and result membership equals required membership."},{"id":"WAIVER_CANONICAL_ANCESTRY","version":1,"inputs":["waiver_policy","mutation_inventory","canonical_base_sha"],"failure_condition":"Fail unless each waiver resolves uniquely, binds the same mutant/path/class, and was canonical before the candidate."},{"id":"REQUIRED_CHECK_GITHUB_PROVENANCE","version":1,"inputs":["required_check_policy","required_check_provenance","GitHub check/workflow/job APIs"],"failure_condition":"Fail unless the three keyed contexts are unique, exact-head, successful, app-bound, workflow/job-bound and canonical-base workflow-blob-bound."},{"id":"REQUIRED_CHECK_CROSS_BINDING","version":1,"inputs":["required_check_provenance"],"failure_condition":"Parse context-prefixed GitHub refs, require three distinct numeric IDs within each ID domain, and bind every API result to the single top-level head_sha/base_sha."},{"id":"RETAINED_LOCATOR_RECONSTRUCTION","version":1,"inputs":["retained_authority_sources","GitHub PR/commit/blob/run/artifact APIs"],"failure_condition":"Construct all API locations from owner/name/ref/path/id fields; supplied URLs are absent and therefore never authority."},{"id":"RETAINED_PR_RUN_BINDING","version":1,"inputs":["retained_authority_sources","GitHub workflow run"],"failure_condition":"Fail unless event=pull_request, workflow_id=335093310, run_attempt=1, check_suite_id=86559814682, pull_requests contains PR 11, and run/artifact/head/base identities all agree."},{"id":"CONTRACT_DIGEST_RECONSTRUCTION","version":1,"inputs":["core contract files","extension contract files","Git tree"],"failure_condition":"Fail unless every required role appears exactly once, all paths are globally unique, and Git blob plus raw SHA-256 match source bytes."},{"id":"EXTENSION_AUTHORITY_DIGEST_BINDING","version":1,"inputs":["core contract files","extension contract files","extension_authority"],"failure_condition":"Fail unless every extension_authority digest equals the raw SHA-256 of its mapped contract role. enforcement_inventory_sha256 maps to the core role enforcement_inventory; enforcement_inventory_schema_sha256 maps to the extension role enforcement_inventory_schema. Missing, duplicate, cross-role, or mismatched mappings fail."},{"id":"PATH_NOFOLLOW_CONTAINMENT","version":1,"inputs":["repository paths","output paths"],"failure_condition":"Fail on non-portable path, traversal, symlink component, wrong owner/link count, or containment escape."},{"id":"COUNTER_EQUALITIES","version":1,"inputs":["proof counters","raw inventories"],"failure_condition":"Fail on overflow, negative values, prohibited zero denominators, or any count/equality mismatch."},{"id":"POLICY_INVENTORY_BINDING","version":1,"inputs":["surface/resource/corpus/coverage/mutation policies","evidence inventories"],"failure_condition":"Fail unless policy digests, lineage, schema ids, target sets, limits, exclusions, commands and inventory source identities agree exactly."},{"id":"INVENTORY_KEY_MEMBERSHIP","version":1,"inputs":["all proof-critical inventories"],"failure_condition":"Enforce exact per-inventory semantic keys: unique source path; unique assertion_id and scenario_id; unique replay assertion/scenario; unique coverage path and surface_id; unique mutant_id and exact result membership; unique corpus scenario/assertion/path; unique enforcement role/path."},{"id":"CANDIDATE_INPUT_LIMITS","version":1,"inputs":["verifier_input_policy","candidate authority files"],"failure_condition":"Apply byte/file/record/depth limits before semantic parsing; any limit violation fails with a classified reject or parent-enforced kill."},{"id":"INPUT_PROCESS_ENFORCEMENT","version":1,"inputs":["verifier_input_policy","parent process evidence","cgroup v2 snapshot","verifier binary","Cargo.lock"],"failure_condition":"Fail unless a dedicated unprivileged verifier subprocess is identified by binary SHA and lock blob, parent wall timeout and cgroup memory/PID limits are active, network is none, root is read-only, stdout/stderr observed byte counts and exceeded flags satisfy the policy ceilings exactly with neither stream exceeded, and termination is one allowed class."},{"id":"ENFORCEMENT_INVENTORY_CLOSURE","version":1,"inputs":["enforcement_inventory","canonical base tree","current AF-02 stack"],"failure_condition":"Fail unless the inventory equals the exact schema-frozen role set with unique roles; reject unknown or duplicate roles. For every role whose required_from_stack is at or before the current stack, planned_path and entrypoint must resolve to the canonical-base implementation/schema/workflow authority; future-stack unresolved paths remain non-green only when their activation stack begins."},{"id":"FINAL_ENVELOPE_HASH","version":1,"inputs":["core deterministic","extension_contract_files","extension_authority","required_check_provenance"],"failure_condition":"Fail unless independently canonicalized deterministic envelope hashes exactly to outer af02_adversarial_sha256; stochastic observations never affect this digest."}]},"negative_fixture_ids":{"const":["CORE_SCHEMA_ALIAS_COLLISION","CORE_EMPTY_DETERMINISTIC","EXTENSION_DUPLICATE_ROLE","EXTENSION_DUPLICATE_PATH","EXTENSION_AUTHORITY_DIGEST_MISMATCH","POLICY_BOOTSTRAP_WHEN_PREDECESSOR_EXISTS","POLICY_REBASE_MISSING_PREDECESSOR","POLICY_REBASE_WRONG_PREDECESSOR_BLOB","POLICY_REBASE_WRONG_PREDECESSOR_DIGEST","POLICY_CHANGE_WITH_DEPENDENT_EVIDENCE","EMPTY_SURFACE_MATCHERS","SURFACE_MISSING_CATEGORY","SURFACE_DUPLICATE_MATCHER_ID","SURFACE_DUPLICATE_SURFACE_ID","SURFACE_DUPLICATE_WITNESS_ID","SURFACE_STALE_WITNESS","SURFACE_UNMATCHED_KNOWN_BOUNDARY","EMPTY_TOOL_LOCK","OMITTED_REQUIRED_TOOL","UNEXPECTED_TOOL","SUBSTITUTED_TOOL_ID","WRONG_EXECUTABLE_DIGEST","FABRICATED_WAIVER_ID","WAIVER_WRONG_MUTANT","WAIVER_NOT_PRECANONICAL","CHECK_WRONG_APP","CHECK_WRONG_REPOSITORY","CHECK_WRONG_WORKFLOW_ID","CHECK_WRONG_WORKFLOW_BLOB","CHECK_WRONG_JOB","CHECK_WRONG_HEAD","CHECK_DUPLICATE_CHECK_RUN_ID","CHECK_DUPLICATE_WORKFLOW_RUN_ID","CHECK_DUPLICATE_JOB_ID","RETAINED_WRONG_EVENT","RETAINED_WRONG_WORKFLOW_ID","RETAINED_WRONG_RUN_ATTEMPT","RETAINED_WRONG_CHECK_SUITE","RETAINED_WRONG_PR_ASSOCIATION","RETAINED_WRONG_RUN_HEAD","RETAINED_WRONG_ARTIFACT","UNSORTED_SOURCE_UNIVERSE","DUPLICATE_SOURCE_PATH","ASSERTION_REPLAY_MISSING","ASSERTION_REPLAY_DUPLICATE","CORPUS_DUPLICATE_FIXTURE_PATH","COVERAGE_MISSING_PATH","COVERAGE_DUPLICATE_PATH","COVERAGE_SURFACE_OVERLAP","MUTATION_RESULT_MISSING","MUTATION_EXTRA_RESULT","POLICY_INVENTORY_DIGEST_MISMATCH","INPUT_OVERSIZE","INPUT_TOO_DEEP","INPUT_TOO_MANY_RECORDS","YAML_ALIAS","YAML_CUSTOM_TAG","INPUT_PARSER_WRONG_BINARY","INPUT_PARSER_WRONG_LOCK_BLOB","INPUT_PARSER_NO_CGROUP","INPUT_PARSER_WALL_TIMEOUT_NOT_ENFORCED","INPUT_PARSER_MEMORY_LIMIT_NOT_ENFORCED","INPUT_PARSER_OUTPUT_EVIDENCE_MISSING","INPUT_PARSER_STDOUT_LIMIT_EXCEEDED","INPUT_PARSER_STDERR_LIMIT_EXCEEDED","INPUT_PARSER_OUTPUT_FLAG_MISMATCH","INPUT_PARSER_UNCLASSIFIED_TERMINATION","PATH_SYMLINK_ESCAPE","ENFORCEMENT_MISSING_ROLE","ENFORCEMENT_DUPLICATE_ROLE","ENFORCEMENT_UNCLASSIFIED_ROLE","ENFORCEMENT_ACTIVE_PATH_MISSING"]}}} \ No newline at end of file diff --git a/specs/016-af-02-adversarial-test-strength/schemas/af02-surface-policy-v1.schema.json b/specs/016-af-02-adversarial-test-strength/schemas/af02-surface-policy-v1.schema.json new file mode 100644 index 00000000..ac27737d --- /dev/null +++ b/specs/016-af-02-adversarial-test-strength/schemas/af02-surface-policy-v1.schema.json @@ -0,0 +1 @@ +{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://commandf.dev/schemas/af02-surface-policy-v1.schema.json","title":"commandf.af02-surface-policy/v1","type":"object","additionalProperties":false,"required":["schema","lineage","source_sha","source_tree","source_roots","exclusion_policy_sha256","scanner_tool_id","boundary_categories","matchers","critical_surfaces","known_boundary_witnesses","finding_exclusions"],"properties":{"schema":{"const":"commandf.af02-surface-policy/v1"},"lineage":{"$ref":"#/$defs/lineage"},"source_sha":{"type":"string","pattern":"^[0-9a-f]{40}$"},"source_tree":{"type":"string","pattern":"^[0-9a-f]{40}$"},"source_roots":{"const":["crates/**/src/**/*.rs","tools/**/src/**/*.rs"]},"exclusion_policy_sha256":{"type":"string","pattern":"^[0-9a-f]{64}$"},"scanner_tool_id":{"const":"syn-af02-scanner"},"boundary_categories":{"const":["ARCHIVE_OR_COMPRESSION","CACHE_OR_PERSISTENCE","FILESYSTEM","NETWORK_OR_ACQUISITION","SERDE_OR_TEXT_PARSE","SUBPROCESS"]},"matchers":{"type":"array","minItems":6,"uniqueItems":true,"items":{"$ref":"#/$defs/matcher"}},"critical_surfaces":{"type":"array","minItems":6,"uniqueItems":true,"items":{"$ref":"#/$defs/surface"}},"known_boundary_witnesses":{"type":"array","minItems":6,"uniqueItems":true,"items":{"$ref":"#/$defs/witness"}},"finding_exclusions":{"type":"array","uniqueItems":true,"items":{"$ref":"#/$defs/findingExclusion"}}},"allOf":[{"properties":{"matchers":{"contains":{"type":"object","properties":{"category":{"const":"ARCHIVE_OR_COMPRESSION"}},"required":["category"]},"minContains":1}}},{"properties":{"critical_surfaces":{"contains":{"type":"object","properties":{"category":{"const":"ARCHIVE_OR_COMPRESSION"}},"required":["category"]},"minContains":1}}},{"properties":{"known_boundary_witnesses":{"contains":{"type":"object","properties":{"category":{"const":"ARCHIVE_OR_COMPRESSION"}},"required":["category"]},"minContains":1}}},{"properties":{"matchers":{"contains":{"type":"object","properties":{"category":{"const":"CACHE_OR_PERSISTENCE"}},"required":["category"]},"minContains":1}}},{"properties":{"critical_surfaces":{"contains":{"type":"object","properties":{"category":{"const":"CACHE_OR_PERSISTENCE"}},"required":["category"]},"minContains":1}}},{"properties":{"known_boundary_witnesses":{"contains":{"type":"object","properties":{"category":{"const":"CACHE_OR_PERSISTENCE"}},"required":["category"]},"minContains":1}}},{"properties":{"matchers":{"contains":{"type":"object","properties":{"category":{"const":"FILESYSTEM"}},"required":["category"]},"minContains":1}}},{"properties":{"critical_surfaces":{"contains":{"type":"object","properties":{"category":{"const":"FILESYSTEM"}},"required":["category"]},"minContains":1}}},{"properties":{"known_boundary_witnesses":{"contains":{"type":"object","properties":{"category":{"const":"FILESYSTEM"}},"required":["category"]},"minContains":1}}},{"properties":{"matchers":{"contains":{"type":"object","properties":{"category":{"const":"NETWORK_OR_ACQUISITION"}},"required":["category"]},"minContains":1}}},{"properties":{"critical_surfaces":{"contains":{"type":"object","properties":{"category":{"const":"NETWORK_OR_ACQUISITION"}},"required":["category"]},"minContains":1}}},{"properties":{"known_boundary_witnesses":{"contains":{"type":"object","properties":{"category":{"const":"NETWORK_OR_ACQUISITION"}},"required":["category"]},"minContains":1}}},{"properties":{"matchers":{"contains":{"type":"object","properties":{"category":{"const":"SERDE_OR_TEXT_PARSE"}},"required":["category"]},"minContains":1}}},{"properties":{"critical_surfaces":{"contains":{"type":"object","properties":{"category":{"const":"SERDE_OR_TEXT_PARSE"}},"required":["category"]},"minContains":1}}},{"properties":{"known_boundary_witnesses":{"contains":{"type":"object","properties":{"category":{"const":"SERDE_OR_TEXT_PARSE"}},"required":["category"]},"minContains":1}}},{"properties":{"matchers":{"contains":{"type":"object","properties":{"category":{"const":"SUBPROCESS"}},"required":["category"]},"minContains":1}}},{"properties":{"critical_surfaces":{"contains":{"type":"object","properties":{"category":{"const":"SUBPROCESS"}},"required":["category"]},"minContains":1}}},{"properties":{"known_boundary_witnesses":{"contains":{"type":"object","properties":{"category":{"const":"SUBPROCESS"}},"required":["category"]},"minContains":1}}}],"$defs":{"lineage":{"type":"object","additionalProperties":false,"required":["mode","canonical_base_sha","canonical_base_tree","policy_path","predecessor_blob_sha","predecessor_sha256","change_is_policy_only","dependent_evidence_allowed_in_same_candidate","comparison_rule"],"properties":{"mode":{"enum":["BOOTSTRAP","REBASE"]},"canonical_base_sha":{"type":"string","pattern":"^[0-9a-f]{40}$"},"canonical_base_tree":{"type":"string","pattern":"^[0-9a-f]{40}$"},"policy_path":{"const":"specs/016-af-02-adversarial-test-strength/surface-policy.json"},"predecessor_blob_sha":{"oneOf":[{"type":"string","pattern":"^[0-9a-f]{40}$"},{"type":"null"}]},"predecessor_sha256":{"oneOf":[{"type":"string","pattern":"^[0-9a-f]{64}$"},{"type":"null"}]},"change_is_policy_only":{"const":true},"dependent_evidence_allowed_in_same_candidate":{"const":false},"comparison_rule":{"const":"BASE_CONTROLLED_PREDECESSOR_OR_SINGLE_BOOTSTRAP"}},"allOf":[{"if":{"properties":{"mode":{"const":"BOOTSTRAP"}}},"then":{"properties":{"predecessor_blob_sha":{"type":"null"},"predecessor_sha256":{"type":"null"}}}},{"if":{"properties":{"mode":{"const":"REBASE"}}},"then":{"properties":{"predecessor_blob_sha":{"type":"string","pattern":"^[0-9a-f]{40}$"},"predecessor_sha256":{"type":"string","pattern":"^[0-9a-f]{64}$"}}}}]},"gitSha":{"type":"string","pattern":"^[0-9a-f]{40}$"},"path":{"type":"string","minLength":1,"pattern":"^(?!/)(?!.*\\\\)(?!.*//)(?!.*(?:^|/)\\.(?:/|$))(?!.*(?:^|/)\\.\\.(?:/|$))[^\\u0000]+$"},"id":{"type":"string","minLength":1,"maxLength":160,"pattern":"^[A-Za-z0-9][A-Za-z0-9._:-]*$"},"category":{"enum":["ARCHIVE_OR_COMPRESSION","CACHE_OR_PERSISTENCE","FILESYSTEM","NETWORK_OR_ACQUISITION","SERDE_OR_TEXT_PARSE","SUBPROCESS"]},"matcher":{"type":"object","additionalProperties":false,"required":["matcher_id","category","kind","callee_or_method","import_roots","receiver_constructor_or_null"],"properties":{"matcher_id":{"$ref":"#/$defs/id"},"category":{"$ref":"#/$defs/category"},"kind":{"enum":["PATH_CALL","METHOD_CALL","MACRO_TOKEN","TYPE_CONSTRUCTOR"]},"callee_or_method":{"type":"string","minLength":1,"maxLength":256},"import_roots":{"type":"array","items":{"type":"string","minLength":1,"maxLength":256},"uniqueItems":true},"receiver_constructor_or_null":{"oneOf":[{"type":"string","minLength":1,"maxLength":256},{"type":"null"}]}}},"surface":{"type":"object","additionalProperties":false,"required":["surface_id","category","matcher_ids","source_paths"],"properties":{"surface_id":{"$ref":"#/$defs/id"},"category":{"$ref":"#/$defs/category"},"matcher_ids":{"type":"array","minItems":1,"items":{"$ref":"#/$defs/id"},"uniqueItems":true},"source_paths":{"type":"array","minItems":1,"items":{"$ref":"#/$defs/path"},"uniqueItems":true}}},"witness":{"type":"object","additionalProperties":false,"required":["witness_id","category","matcher_id","source_path","source_blob_sha","symbol_or_span"],"properties":{"witness_id":{"$ref":"#/$defs/id"},"category":{"$ref":"#/$defs/category"},"matcher_id":{"$ref":"#/$defs/id"},"source_path":{"$ref":"#/$defs/path"},"source_blob_sha":{"$ref":"#/$defs/gitSha"},"symbol_or_span":{"type":"string","minLength":1,"maxLength":512}}},"findingExclusion":{"type":"object","additionalProperties":false,"required":["exclusion_id","matcher_id","source_path","reason","introduced_policy_sha"],"properties":{"exclusion_id":{"type":"string","pattern":"^SURF-X[0-9]{4}$"},"matcher_id":{"$ref":"#/$defs/id"},"source_path":{"$ref":"#/$defs/path"},"reason":{"type":"string","minLength":20,"maxLength":2048},"introduced_policy_sha":{"$ref":"#/$defs/gitSha"}}}}} \ No newline at end of file diff --git a/specs/016-af-02-adversarial-test-strength/schemas/af02-tool-lock-v1.schema.json b/specs/016-af-02-adversarial-test-strength/schemas/af02-tool-lock-v1.schema.json new file mode 100644 index 00000000..83a5d61d --- /dev/null +++ b/specs/016-af-02-adversarial-test-strength/schemas/af02-tool-lock-v1.schema.json @@ -0,0 +1,55 @@ +{ + "$schema":"https://json-schema.org/draft/2020-12/schema", + "$id":"https://commandf.dev/schemas/af02-tool-lock-v1.schema.json", + "title":"commandf.af02-tool-lock/v1", + "type":"object", + "additionalProperties":false, + "required":["schema","tool_policy_sha256","source_sha","entries"], + "properties":{ + "schema":{"const":"commandf.af02-tool-lock/v1"}, + "tool_policy_sha256":{"$ref":"#/$defs/sha256"}, + "source_sha":{"$ref":"#/$defs/gitSha"}, + "entries":{ + "type":"array","minItems":8,"maxItems":8, + "prefixItems":[ + {"$ref":"#/$defs/arbitrary"}, + {"$ref":"#/$defs/cargoFuzz"}, + {"$ref":"#/$defs/cargoLlvmCov"}, + {"$ref":"#/$defs/cargoMutants"}, + {"$ref":"#/$defs/cargoNextest"}, + {"$ref":"#/$defs/libfuzzerSys"}, + {"$ref":"#/$defs/proptest"}, + {"$ref":"#/$defs/synScanner"} + ], + "items":false + } + }, + "$defs":{ + "gitSha":{"type":"string","pattern":"^[0-9a-f]{40}$"}, + "sha256":{"type":"string","pattern":"^[0-9a-f]{64}$"}, + "exec":{ + "type":"object","additionalProperties":false, + "required":["kind","id","version","upstream_repository","upstream_commit","acquisition_mode","source_lock_sha256","installed_executable","installed_executable_sha256","version_output_sha256","build_rustc","build_cargo","build_target","features"], + "properties":{ + "kind":{"const":"executable"},"id":{"type":"string"},"version":{"type":"string"},"upstream_repository":{"type":"string"},"upstream_commit":{"$ref":"#/$defs/gitSha"}, + "acquisition_mode":{"const":"LOCKED_GIT_REV_SOURCE_BUILD"},"source_lock_sha256":{"$ref":"#/$defs/sha256"},"installed_executable":{"type":"string","minLength":1}, + "installed_executable_sha256":{"$ref":"#/$defs/sha256"},"version_output_sha256":{"$ref":"#/$defs/sha256"},"build_rustc":{"type":"string","minLength":1},"build_cargo":{"type":"string","minLength":1},"build_target":{"const":"x86_64-unknown-linux-gnu"},"features":{"type":"array","items":{"type":"string"},"uniqueItems":true} + } + }, + "registry":{ + "type":"object","additionalProperties":false, + "required":["kind","id","package","version","registry","registry_checksum_sha256","default_features","features"], + "properties":{ + "kind":{"const":"registry_package"},"id":{"type":"string"},"package":{"type":"string"},"version":{"type":"string"},"registry":{"const":"crates.io"},"registry_checksum_sha256":{"$ref":"#/$defs/sha256"},"default_features":{"type":"boolean"},"features":{"type":"array","items":{"type":"string"},"uniqueItems":true} + } + }, + "arbitrary":{"allOf":[{"$ref":"#/$defs/registry"},{"properties":{"id":{"const":"arbitrary"},"package":{"const":"arbitrary"},"version":{"const":"1.4.2"},"default_features":{"const":true},"features":{"const":["derive"]}}}]}, + "cargoFuzz":{"allOf":[{"$ref":"#/$defs/exec"},{"properties":{"id":{"const":"cargo-fuzz"},"version":{"const":"0.13.2"},"upstream_repository":{"const":"https://github.com/rust-fuzz/cargo-fuzz"},"upstream_commit":{"const":"984c861c8dfea28055254c5f1d2659ab2cd63f76"},"features":{"const":[]}}}]}, + "cargoLlvmCov":{"allOf":[{"$ref":"#/$defs/exec"},{"properties":{"id":{"const":"cargo-llvm-cov"},"version":{"const":"0.9.0"},"upstream_repository":{"const":"https://github.com/taiki-e/cargo-llvm-cov"},"upstream_commit":{"const":"be59056988acd54c7f984b7c85643daea3711b29"},"features":{"const":[]}}}]}, + "cargoMutants":{"allOf":[{"$ref":"#/$defs/exec"},{"properties":{"id":{"const":"cargo-mutants"},"version":{"const":"27.1.0"},"upstream_repository":{"const":"https://github.com/sourcefrog/cargo-mutants"},"upstream_commit":{"const":"8ab1dc786a1f61a4e370416cc6c68b81a704e917"},"features":{"const":[]}}}]}, + "cargoNextest":{"allOf":[{"$ref":"#/$defs/exec"},{"properties":{"id":{"const":"cargo-nextest"},"version":{"const":"0.9.143"},"upstream_repository":{"const":"https://github.com/nextest-rs/nextest"},"upstream_commit":{"const":"60fa45f638ffc3f35e74afa65737f45fcd32db2a"},"features":{"const":[]}}}]}, + "libfuzzerSys":{"allOf":[{"$ref":"#/$defs/registry"},{"properties":{"id":{"const":"libfuzzer-sys"},"package":{"const":"libfuzzer-sys"},"version":{"const":"0.4.13"},"default_features":{"const":true},"features":{"const":[]}}}]}, + "proptest":{"allOf":[{"$ref":"#/$defs/registry"},{"properties":{"id":{"const":"proptest"},"package":{"const":"proptest"},"version":{"const":"1.11.0"},"default_features":{"const":true},"features":{"const":[]}}}]}, + "synScanner":{"allOf":[{"$ref":"#/$defs/registry"},{"properties":{"id":{"const":"syn-af02-scanner"},"package":{"const":"syn"},"version":{"const":"3.0.3"},"registry_checksum_sha256":{"const":"53e9bae58849f64dfa4f5d5ae372c8341f7305f82a3868709269343628b659a3"},"default_features":{"const":true},"features":{"const":["full","visit"]}}}]} + } +} diff --git a/specs/016-af-02-adversarial-test-strength/schemas/af02-tool-policy-v1.schema.json b/specs/016-af-02-adversarial-test-strength/schemas/af02-tool-policy-v1.schema.json new file mode 100644 index 00000000..5de0bf22 --- /dev/null +++ b/specs/016-af-02-adversarial-test-strength/schemas/af02-tool-policy-v1.schema.json @@ -0,0 +1,75 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://commandf.dev/schemas/af02-tool-policy-v1.schema.json", + "title": "commandf.af02-tool-policy/v1", + "type": "object", + "additionalProperties": false, + "required": ["schema","policy_base_sha","policy_base_tree","required_final_entry_ids","entries","toolchains","activation_rule","final_rule"], + "properties": { + "schema": {"const": "commandf.af02-tool-policy/v1"}, + "policy_base_sha": {"$ref": "#/$defs/gitSha"}, + "policy_base_tree": {"$ref": "#/$defs/gitSha"}, + "required_final_entry_ids": { + "const": ["arbitrary","cargo-fuzz","cargo-llvm-cov","cargo-mutants","cargo-nextest","libfuzzer-sys","proptest","syn-af02-scanner"] + }, + "entries": { + "type": "array", + "minItems": 8, + "maxItems": 8, + "prefixItems": [ + {"$ref":"#/$defs/arbitrary"}, + {"$ref":"#/$defs/cargoFuzz"}, + {"$ref":"#/$defs/cargoLlvmCov"}, + {"$ref":"#/$defs/cargoMutants"}, + {"$ref":"#/$defs/cargoNextest"}, + {"$ref":"#/$defs/libfuzzerSys"}, + {"$ref":"#/$defs/proptest"}, + {"$ref":"#/$defs/synScanner"} + ], + "items": false + }, + "toolchains": { + "type":"object","additionalProperties":false, + "required":["product_stable","fuzz_only_nightly","target"], + "properties": { + "product_stable":{"const":"1.97.1"}, + "fuzz_only_nightly":{"const":"nightly-2026-08-25"}, + "target":{"const":"x86_64-unknown-linux-gnu"} + } + }, + "activation_rule":{"type":"string","minLength":1}, + "final_rule":{"type":"string","minLength":1} + }, + "$defs": { + "gitSha":{"type":"string","pattern":"^[0-9a-f]{40}$"}, + "sha256OrNull":{"oneOf":[{"type":"string","pattern":"^[0-9a-f]{64}$"},{"type":"null"}]}, + "registryBase": { + "type":"object","additionalProperties":false, + "required":["id","kind","activation_stack","package","version","registry","default_features","features","registry_checksum_sha256_or_null","checksum_freeze_rule"], + "properties": { + "id":{"type":"string"},"kind":{"const":"registry_package"},"activation_stack":{"enum":["A0","A1","B0","C0"]}, + "package":{"type":"string"},"version":{"type":"string"},"registry":{"const":"crates.io"},"default_features":{"type":"boolean"}, + "features":{"type":"array","items":{"type":"string"},"uniqueItems":true}, + "registry_checksum_sha256_or_null":{"$ref":"#/$defs/sha256OrNull"},"checksum_freeze_rule":{"type":"string","minLength":1} + } + }, + "execBase": { + "type":"object","additionalProperties":false, + "required":["id","kind","activation_stack","version","upstream_repository","upstream_commit","acquisition_mode","build_target","features"], + "properties": { + "id":{"type":"string"},"kind":{"const":"executable"},"activation_stack":{"enum":["A1","B0","C0"]},"version":{"type":"string"}, + "upstream_repository":{"type":"string","pattern":"^https://github\\.com/[^/]+/[^/]+$"},"upstream_commit":{"$ref":"#/$defs/gitSha"}, + "acquisition_mode":{"const":"LOCKED_GIT_REV_SOURCE_BUILD"},"build_target":{"const":"x86_64-unknown-linux-gnu"}, + "features":{"type":"array","items":{"type":"string"},"uniqueItems":true} + } + }, + "arbitrary":{"allOf":[{"$ref":"#/$defs/registryBase"},{"properties":{"id":{"const":"arbitrary"},"activation_stack":{"const":"A1"},"package":{"const":"arbitrary"},"version":{"const":"1.4.2"},"default_features":{"const":true},"features":{"const":["derive"]}}}]}, + "libfuzzerSys":{"allOf":[{"$ref":"#/$defs/registryBase"},{"properties":{"id":{"const":"libfuzzer-sys"},"activation_stack":{"const":"A1"},"package":{"const":"libfuzzer-sys"},"version":{"const":"0.4.13"},"default_features":{"const":true},"features":{"const":[]}}}]}, + "proptest":{"allOf":[{"$ref":"#/$defs/registryBase"},{"properties":{"id":{"const":"proptest"},"activation_stack":{"const":"A1"},"package":{"const":"proptest"},"version":{"const":"1.11.0"},"default_features":{"const":true},"features":{"const":[]}}}]}, + "synScanner":{"allOf":[{"$ref":"#/$defs/registryBase"},{"properties":{"id":{"const":"syn-af02-scanner"},"activation_stack":{"const":"A0"},"package":{"const":"syn"},"version":{"const":"3.0.3"},"default_features":{"const":true},"features":{"const":["full","visit"]},"registry_checksum_sha256_or_null":{"const":"53e9bae58849f64dfa4f5d5ae372c8341f7305f82a3868709269343628b659a3"}}}]}, + "cargoFuzz":{"allOf":[{"$ref":"#/$defs/execBase"},{"properties":{"id":{"const":"cargo-fuzz"},"activation_stack":{"const":"A1"},"version":{"const":"0.13.2"},"upstream_repository":{"const":"https://github.com/rust-fuzz/cargo-fuzz"},"upstream_commit":{"const":"984c861c8dfea28055254c5f1d2659ab2cd63f76"},"features":{"const":[]}}}]}, + "cargoLlvmCov":{"allOf":[{"$ref":"#/$defs/execBase"},{"properties":{"id":{"const":"cargo-llvm-cov"},"activation_stack":{"const":"B0"},"version":{"const":"0.9.0"},"upstream_repository":{"const":"https://github.com/taiki-e/cargo-llvm-cov"},"upstream_commit":{"const":"be59056988acd54c7f984b7c85643daea3711b29"},"features":{"const":[]}}}]}, + "cargoMutants":{"allOf":[{"$ref":"#/$defs/execBase"},{"properties":{"id":{"const":"cargo-mutants"},"activation_stack":{"const":"C0"},"version":{"const":"27.1.0"},"upstream_repository":{"const":"https://github.com/sourcefrog/cargo-mutants"},"upstream_commit":{"const":"8ab1dc786a1f61a4e370416cc6c68b81a704e917"},"features":{"const":[]}}}]}, + "cargoNextest":{"allOf":[{"$ref":"#/$defs/execBase"},{"properties":{"id":{"const":"cargo-nextest"},"activation_stack":{"const":"B0"},"version":{"const":"0.9.143"},"upstream_repository":{"const":"https://github.com/nextest-rs/nextest"},"upstream_commit":{"const":"60fa45f638ffc3f35e74afa65737f45fcd32db2a"},"features":{"const":[]}}}]} + } +} diff --git a/specs/016-af-02-adversarial-test-strength/schemas/af02-verifier-input-policy-v1.schema.json b/specs/016-af-02-adversarial-test-strength/schemas/af02-verifier-input-policy-v1.schema.json new file mode 100644 index 00000000..27eb0e9c --- /dev/null +++ b/specs/016-af-02-adversarial-test-strength/schemas/af02-verifier-input-policy-v1.schema.json @@ -0,0 +1 @@ +{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://commandf.dev/schemas/af02-verifier-input-policy-v1.schema.json","title":"commandf.af02-verifier-input-policy/v1","type":"object","additionalProperties":false,"required":["schema","preparse","json","yaml","aggregate","parser_runtime","enforcement_evidence"],"properties":{"schema":{"const":"commandf.af02-verifier-input-policy/v1"},"preparse":{"const":{"max_single_file_bytes":1048576,"regular_file_required":true,"symlinks_allowed":false,"containment_required":true,"byte_limit_before_parse":true}},"json":{"const":{"utf8_required":true,"bom_allowed":false,"max_depth":32,"max_object_properties":512,"max_array_items":20000,"max_string_bytes":262144,"max_number_digits":20}},"yaml":{"const":{"safe_loader_required":true,"custom_tags_allowed":false,"aliases_allowed":false,"merge_keys_allowed":false,"max_depth":24,"max_sequence_items":10000,"max_scalar_bytes":262144}},"aggregate":{"const":{"max_candidate_authority_bytes":16777216,"max_candidate_authority_files":128,"max_total_records":50000,"parser_wall_seconds":20,"parser_memory_mib":512}},"parser_runtime":{"const":{"process_mode":"DEDICATED_UNPRIVILEGED_SUBPROCESS","manifest_path":"tools/af02-verifier/Cargo.toml","binary_path":"target/af02-verifier/release/commandf-af02-verifier","entrypoint":"verify-pr","rust_version":"1.97.1","dependency_lock_path":"Cargo.lock","binary_sha256_required":true,"dependency_lock_blob_sha_required":true,"parent_enforces_wall_timeout":true,"cgroup_v2_memory_enforcement_required":true,"pids_limit":64,"network_mode":"none","read_only_root":true,"no_new_privileges":true,"stdout_byte_ceiling":1048576,"stderr_byte_ceiling":1048576}},"enforcement_evidence":{"const":{"policy_sha256_required":true,"process_identity_sha256_required":true,"binary_sha256_required":true,"dependency_lock_blob_sha_required":true,"cgroup_snapshot_sha256_required":true,"termination_class_required":true,"bounded_stdout_stderr_required":true,"stream_output_evidence_schema":{"type":"object","additionalProperties":false,"required":["stdout_observed_bytes","stderr_observed_bytes","stdout_ceiling_exceeded","stderr_ceiling_exceeded"],"properties":{"stdout_observed_bytes":{"type":"integer","minimum":0},"stderr_observed_bytes":{"type":"integer","minimum":0},"stdout_ceiling_exceeded":{"type":"boolean"},"stderr_ceiling_exceeded":{"type":"boolean"}}},"stream_ceiling_comparison_rule":"EXCEEDED_IFF_OBSERVED_BYTES_GT_CEILING","allowed_termination_classes":["CLEAN_EXIT","SCHEMA_REJECT","SEMANTIC_REJECT","WALL_TIMEOUT_KILL","MEMORY_LIMIT_KILL","PID_LIMIT_KILL","PARSER_CRASH"]}}}} \ No newline at end of file diff --git a/specs/016-af-02-adversarial-test-strength/schemas/af02-waiver-policy-v1.schema.json b/specs/016-af-02-adversarial-test-strength/schemas/af02-waiver-policy-v1.schema.json new file mode 100644 index 00000000..fe1bc35c --- /dev/null +++ b/specs/016-af-02-adversarial-test-strength/schemas/af02-waiver-policy-v1.schema.json @@ -0,0 +1,34 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://commandf.dev/schemas/af02-waiver-policy-v1.schema.json", + "title": "commandf.af02-waiver-policy/v1", + "type": "object", + "additionalProperties": false, + "required": ["schema", "policy_base_sha", "waivers"], + "properties": { + "schema": {"const": "commandf.af02-waiver-policy/v1"}, + "policy_base_sha": {"$ref": "#/$defs/gitSha"}, + "waivers": {"type": "array", "items": {"$ref": "#/$defs/waiver"}} + }, + "$defs": { + "gitSha": {"type": "string", "pattern": "^[0-9a-f]{40}$"}, + "sha256": {"type": "string", "pattern": "^[0-9a-f]{64}$"}, + "path": {"type": "string", "minLength": 1, "pattern": "^(?!/)(?!.*\\\\)(?!.*//)(?!.*(?:^|/)\\.(?:/|$))(?!.*(?:^|/)\\.\\.(?:/|$))[^\\u0000]+$"}, + "waiver": { + "type": "object", + "additionalProperties": false, + "required": ["waiver_id","mutant_id","allowed_result_class","target_source_path","rationale","evidence_sha256","introduced_by_pr","introduced_policy_sha","review_url"], + "properties": { + "waiver_id": {"type": "string", "pattern": "^AF02-W[0-9]{4}$"}, + "mutant_id": {"$ref": "#/$defs/sha256"}, + "allowed_result_class": {"const": "WAIVED_EQUIVALENT_OR_OUT_OF_SCOPE"}, + "target_source_path": {"$ref": "#/$defs/path"}, + "rationale": {"type": "string", "minLength": 20, "maxLength": 4096}, + "evidence_sha256": {"$ref": "#/$defs/sha256"}, + "introduced_by_pr": {"type": "integer", "minimum": 1}, + "introduced_policy_sha": {"$ref": "#/$defs/gitSha"}, + "review_url": {"type": "string", "pattern": "^https://github\\.com/TheHalfMoon/commandF/pull/[1-9][0-9]*$"} + } + } + } +} diff --git a/specs/016-af-02-adversarial-test-strength/semantic-contract.json b/specs/016-af-02-adversarial-test-strength/semantic-contract.json new file mode 100644 index 00000000..6e075c20 --- /dev/null +++ b/specs/016-af-02-adversarial-test-strength/semantic-contract.json @@ -0,0 +1 @@ +{"schema":"commandf.af02-semantic-contract/v1","verifier":{"package":"commandf-af02-verifier","manifest_path":"tools/af02-verifier/Cargo.toml","binary_path":"tools/af02-verifier/src/main.rs","entrypoint":"verify-pr","rust_version":"1.97.1","offline_required":true,"candidate_code_execution_allowed":false},"algorithms":[{"id":"CORE_SCHEMA_VALIDATION","version":1,"inputs":["core proof object","proof_core_schema retrieval URI"],"failure_condition":"Resolve and validate the full core object against the retained closed core schema; empty or partially shaped deterministic content fails."},{"id":"PROOF_ENVELOPE_CLOSURE","version":1,"inputs":["outer proof schema","core schema","extension contract files"],"failure_condition":"Fail unless the full core validates, all extension roles occur exactly once in fixed order and path, and no extension path duplicates any core contract path."},{"id":"SEMANTIC_CONTRACT_SELF_CHECK","version":1,"inputs":["semantic_contract","semantic_contract_schema"],"failure_condition":"Fail unless algorithms and negative fixture IDs equal the exact schema-frozen arrays byte-for-semantic-value."},{"id":"POLICY_PREDECESSOR_COMPARISON","version":1,"inputs":["candidate policy","canonical PR base tree","candidate diff"],"failure_condition":"For BOOTSTRAP require the policy path absent at canonical base; for REBASE require predecessor blob and digest equal the canonical-base file. Any changed policy must be policy-only and cannot carry dependent evidence in the same candidate."},{"id":"CANONICAL_SORT_UNIQUE","version":1,"inputs":["schema-defined arrays and object-key inventories"],"failure_condition":"Fail on wrong order, duplicate semantic key, duplicate id, duplicate path, or ambiguous normalization."},{"id":"SURFACE_CATEGORY_WITNESS_CLOSURE","version":1,"inputs":["surface_policy","Git source tree","scanner output"],"failure_condition":"Fail unless all six categories have matcher, critical-surface, and live Git-blob witness coverage; matcher/surface/witness IDs are unique and every reference resolves."},{"id":"ASSERTION_REPLAY_BIJECTION","version":1,"inputs":["corpus_manifest","assertion_registry","replay_results"],"failure_condition":"Fail unless scenario_id, assertion_id and fixture path are individually unique and scenario/assertion membership is exactly one-to-one across all artifacts."},{"id":"SOURCE_BLOB_RECONSTRUCTION","version":1,"inputs":["source_universe","Git tree"],"failure_condition":"Fail unless every path resolves to exactly one recorded regular-file blob and every eligible tracked source appears once."},{"id":"COVERAGE_ACCOUNTING","version":1,"inputs":["coverage_policy","coverage_inventory","source_universe","surface_policy"],"failure_condition":"Fail on missing, unknown, duplicate, overlapping, or arithmetically inconsistent production or critical-surface coverage, or policy lineage mismatch."},{"id":"MUTATION_MEMBERSHIP","version":1,"inputs":["mutation_policy","mutation_inventory","exclusion_policy"],"failure_condition":"Fail unless every listed in-target mutant has exactly one required or precanonical excluded disposition and result membership equals required membership."},{"id":"WAIVER_CANONICAL_ANCESTRY","version":1,"inputs":["waiver_policy","mutation_inventory","canonical_base_sha"],"failure_condition":"Fail unless each waiver resolves uniquely, binds the same mutant/path/class, and was canonical before the candidate."},{"id":"REQUIRED_CHECK_GITHUB_PROVENANCE","version":1,"inputs":["required_check_policy","required_check_provenance","GitHub check/workflow/job APIs"],"failure_condition":"Fail unless the three keyed contexts are unique, exact-head, successful, app-bound, workflow/job-bound and canonical-base workflow-blob-bound."},{"id":"REQUIRED_CHECK_CROSS_BINDING","version":1,"inputs":["required_check_provenance"],"failure_condition":"Parse context-prefixed GitHub refs, require three distinct numeric IDs within each ID domain, and bind every API result to the single top-level head_sha/base_sha."},{"id":"RETAINED_LOCATOR_RECONSTRUCTION","version":1,"inputs":["retained_authority_sources","GitHub PR/commit/blob/run/artifact APIs"],"failure_condition":"Construct all API locations from owner/name/ref/path/id fields; supplied URLs are absent and therefore never authority."},{"id":"RETAINED_PR_RUN_BINDING","version":1,"inputs":["retained_authority_sources","GitHub workflow run"],"failure_condition":"Fail unless event=pull_request, workflow_id=335093310, run_attempt=1, check_suite_id=86559814682, pull_requests contains PR 11, and run/artifact/head/base identities all agree."},{"id":"CONTRACT_DIGEST_RECONSTRUCTION","version":1,"inputs":["core contract files","extension contract files","Git tree"],"failure_condition":"Fail unless every required role appears exactly once, all paths are globally unique, and Git blob plus raw SHA-256 match source bytes."},{"id":"EXTENSION_AUTHORITY_DIGEST_BINDING","version":1,"inputs":["core contract files","extension contract files","extension_authority"],"failure_condition":"Fail unless every extension_authority digest equals the raw SHA-256 of its mapped contract role. enforcement_inventory_sha256 maps to the core role enforcement_inventory; enforcement_inventory_schema_sha256 maps to the extension role enforcement_inventory_schema. Missing, duplicate, cross-role, or mismatched mappings fail."},{"id":"PATH_NOFOLLOW_CONTAINMENT","version":1,"inputs":["repository paths","output paths"],"failure_condition":"Fail on non-portable path, traversal, symlink component, wrong owner/link count, or containment escape."},{"id":"COUNTER_EQUALITIES","version":1,"inputs":["proof counters","raw inventories"],"failure_condition":"Fail on overflow, negative values, prohibited zero denominators, or any count/equality mismatch."},{"id":"POLICY_INVENTORY_BINDING","version":1,"inputs":["surface/resource/corpus/coverage/mutation policies","evidence inventories"],"failure_condition":"Fail unless policy digests, lineage, schema ids, target sets, limits, exclusions, commands and inventory source identities agree exactly."},{"id":"INVENTORY_KEY_MEMBERSHIP","version":1,"inputs":["all proof-critical inventories"],"failure_condition":"Enforce exact per-inventory semantic keys: unique source path; unique assertion_id and scenario_id; unique replay assertion/scenario; unique coverage path and surface_id; unique mutant_id and exact result membership; unique corpus scenario/assertion/path; unique enforcement role/path."},{"id":"CANDIDATE_INPUT_LIMITS","version":1,"inputs":["verifier_input_policy","candidate authority files"],"failure_condition":"Apply byte/file/record/depth limits before semantic parsing; any limit violation fails with a classified reject or parent-enforced kill."},{"id":"INPUT_PROCESS_ENFORCEMENT","version":1,"inputs":["verifier_input_policy","parent process evidence","cgroup v2 snapshot","verifier binary","Cargo.lock"],"failure_condition":"Fail unless a dedicated unprivileged verifier subprocess is identified by binary SHA and lock blob, parent wall timeout and cgroup memory/PID limits are active, network is none, root is read-only, stdout/stderr observed byte counts and exceeded flags satisfy the policy ceilings exactly with neither stream exceeded, and termination is one allowed class."},{"id":"ENFORCEMENT_INVENTORY_CLOSURE","version":1,"inputs":["enforcement_inventory","canonical base tree","current AF-02 stack"],"failure_condition":"Fail unless the inventory equals the exact schema-frozen role set with unique roles; reject unknown or duplicate roles. For every role whose required_from_stack is at or before the current stack, planned_path and entrypoint must resolve to the canonical-base implementation/schema/workflow authority; future-stack unresolved paths remain non-green only when their activation stack begins."},{"id":"FINAL_ENVELOPE_HASH","version":1,"inputs":["core deterministic","extension_contract_files","extension_authority","required_check_provenance"],"failure_condition":"Fail unless independently canonicalized deterministic envelope hashes exactly to outer af02_adversarial_sha256; stochastic observations never affect this digest."}],"negative_fixture_ids":["CORE_SCHEMA_ALIAS_COLLISION","CORE_EMPTY_DETERMINISTIC","EXTENSION_DUPLICATE_ROLE","EXTENSION_DUPLICATE_PATH","EXTENSION_AUTHORITY_DIGEST_MISMATCH","POLICY_BOOTSTRAP_WHEN_PREDECESSOR_EXISTS","POLICY_REBASE_MISSING_PREDECESSOR","POLICY_REBASE_WRONG_PREDECESSOR_BLOB","POLICY_REBASE_WRONG_PREDECESSOR_DIGEST","POLICY_CHANGE_WITH_DEPENDENT_EVIDENCE","EMPTY_SURFACE_MATCHERS","SURFACE_MISSING_CATEGORY","SURFACE_DUPLICATE_MATCHER_ID","SURFACE_DUPLICATE_SURFACE_ID","SURFACE_DUPLICATE_WITNESS_ID","SURFACE_STALE_WITNESS","SURFACE_UNMATCHED_KNOWN_BOUNDARY","EMPTY_TOOL_LOCK","OMITTED_REQUIRED_TOOL","UNEXPECTED_TOOL","SUBSTITUTED_TOOL_ID","WRONG_EXECUTABLE_DIGEST","FABRICATED_WAIVER_ID","WAIVER_WRONG_MUTANT","WAIVER_NOT_PRECANONICAL","CHECK_WRONG_APP","CHECK_WRONG_REPOSITORY","CHECK_WRONG_WORKFLOW_ID","CHECK_WRONG_WORKFLOW_BLOB","CHECK_WRONG_JOB","CHECK_WRONG_HEAD","CHECK_DUPLICATE_CHECK_RUN_ID","CHECK_DUPLICATE_WORKFLOW_RUN_ID","CHECK_DUPLICATE_JOB_ID","RETAINED_WRONG_EVENT","RETAINED_WRONG_WORKFLOW_ID","RETAINED_WRONG_RUN_ATTEMPT","RETAINED_WRONG_CHECK_SUITE","RETAINED_WRONG_PR_ASSOCIATION","RETAINED_WRONG_RUN_HEAD","RETAINED_WRONG_ARTIFACT","UNSORTED_SOURCE_UNIVERSE","DUPLICATE_SOURCE_PATH","ASSERTION_REPLAY_MISSING","ASSERTION_REPLAY_DUPLICATE","CORPUS_DUPLICATE_FIXTURE_PATH","COVERAGE_MISSING_PATH","COVERAGE_DUPLICATE_PATH","COVERAGE_SURFACE_OVERLAP","MUTATION_RESULT_MISSING","MUTATION_EXTRA_RESULT","POLICY_INVENTORY_DIGEST_MISMATCH","INPUT_OVERSIZE","INPUT_TOO_DEEP","INPUT_TOO_MANY_RECORDS","YAML_ALIAS","YAML_CUSTOM_TAG","INPUT_PARSER_WRONG_BINARY","INPUT_PARSER_WRONG_LOCK_BLOB","INPUT_PARSER_NO_CGROUP","INPUT_PARSER_WALL_TIMEOUT_NOT_ENFORCED","INPUT_PARSER_MEMORY_LIMIT_NOT_ENFORCED","INPUT_PARSER_OUTPUT_EVIDENCE_MISSING","INPUT_PARSER_STDOUT_LIMIT_EXCEEDED","INPUT_PARSER_STDERR_LIMIT_EXCEEDED","INPUT_PARSER_OUTPUT_FLAG_MISMATCH","INPUT_PARSER_UNCLASSIFIED_TERMINATION","PATH_SYMLINK_ESCAPE","ENFORCEMENT_MISSING_ROLE","ENFORCEMENT_DUPLICATE_ROLE","ENFORCEMENT_UNCLASSIFIED_ROLE","ENFORCEMENT_ACTIVE_PATH_MISSING"]} \ No newline at end of file diff --git a/specs/016-af-02-adversarial-test-strength/spec.md b/specs/016-af-02-adversarial-test-strength/spec.md new file mode 100644 index 00000000..98622279 --- /dev/null +++ b/specs/016-af-02-adversarial-test-strength/spec.md @@ -0,0 +1,304 @@ +# AF-02 Specification — Adversarial Test Strength + +Status: PLANNING_CANDIDATE + +## Identity + +AF-02 is the second commandF Assurance Foundation unit. It measures whether commandF's existing deterministic product core fails safely under generated, malformed, mutated, adversarial, reordered, and retained-evidence inputs. + +Spec Kit directory `016` is a planning sequence only. It does not rename or consume product identity `CF-16`. + +Canonical planning base: + +```text +main: 2b4033e237a5c74f3c45c12fbc7e7bfdc88067b1 +tree: 804ce63c15edb501574bd4aba9a9aadc5bfb07f3 +AF-01: CLOSED_CANONICAL +CF-13: CLOSED_CANONICAL +``` + +AF-02 does not authorize a CF-06 production-oracle change, a CF-10 corpus reinterpretation, or CF-14/15/16 implementation. + +## Normative authority and precedence + +AF-02 implementation and review MUST use this exact authority order: + +1. canonical repository constitution/governance and `AGENTS.md`; +2. `verification-protocol.md` plus the machine-readable schemas under `schemas/`; +3. `evidence-contracts.md` for requirements not replaced by the closed protocol/schemas; +4. this `spec.md`; +5. `plan.md`; +6. `tasks.md`; +7. `consistency.md` and donor/provenance records. + +`verification-protocol.md` is therefore part of the normative AF-02 authority set, not an optional addendum. + +The earlier illustrative `commandf.af02-authority-baseline/v1` shape in `evidence-contracts.md` is **deprecated planning history** and MUST NOT be implemented. The single closed authority-baseline schema is: + +```text +schemas/af02-authority-baseline-v2.schema.json +schema id: commandf.af02-authority-baseline/v2 +``` + +The single closed proof schema is: + +```text +schemas/af02-adversarial-proof-v1.schema.json +schema id: commandf.af02-adversarial-proof/v1 +``` + +Where prose and a machine-readable schema disagree on type, required field, enum, pattern, cardinality, or unknown-field handling, the machine-readable schema is authoritative and the inconsistency fails planning/implementation qualification until reconciled. + +## User problem + +commandF already has deterministic example-based tests, fail-closed validators, real-FHIR smoke paths, oracle reconciliation, exact-head CI, and the canonical AF-01 trusted-development baseline. Those controls prove known scenarios and development-path integrity. They do not yet prove test adequacy against plausible defects and hostile input families. + +A dangerous gap can produce: + +- false compatible/non-breaking results; +- non-deterministic reports or fingerprints; +- acceptance of malformed or non-canonical retained evidence; +- path traversal or source escape; +- graph/reference ambiguity; +- retry-pass flakiness presented as green; +- logic mutations not detected by tests; +- producer-authored evidence that verifies itself; +- an assurance-policy change that weakens the verifier which judges the same change. + +## Required outcome + +AF-02 may close only after commandF has an independently executable adversarial evidence plane that: + +1. deterministically discovers and classifies the required input/trust boundaries; +2. fuzzes raw and structured inputs with bounded, offline execution; +3. proves explicit properties with shrinking and retained reproducer identity; +4. promotes every discovered defect into deterministic regression evidence; +5. measures every mutation listed inside the frozen critical mutation scope, except exact previously canonical exclusions; +6. records coverage against a Git-derived production source universe and pre-frozen measurement descriptor; +7. treats retry-pass as failure; +8. verifies evidence with a base-controlled verifier rather than trusting candidate summaries; +9. preserves AF-01, CF-06, CF-10, and product semantics. + +## Functional requirements + +### FR-001 — deterministic adversarial surface inventory + +AF-02 MUST maintain a machine-checkable surface policy over the exact Git-tracked Rust source universe defined by `verification-protocol.md`. + +The scanner MUST cover parser/deserializer, archive/compression, filesystem/path, network/acquisition, cache/persistence, and subprocess boundaries under both: + +```text +crates/**/src/**/*.rs +tools/**/src/**/*.rs +``` + +Every scanner finding has exactly one disposition: critical surface or reviewed exclusion. Unclassified discoveries and stale policy entries fail closed. Newly introduced matching boundaries fail until classified. + +### FR-002 — isolated fuzz workspace and exact tool identity + +Use a dedicated fuzz workspace isolated from normal product runtime dependencies. + +Frozen initial identities: + +```text +cargo-fuzz: 0.13.2 +upstream: 984c861c8dfea28055254c5f1d2659ab2cd63f76 +libfuzzer-sys: =0.4.13 +arbitrary: =1.4.2 +fuzz compiler: nightly-2026-08-25 +normal product Rust: 1.97.1 +``` + +Tool acquisition, source/release digest, installed executable SHA-256, compiler/target/features, registry checksums, and version output MUST be retained according to the tool-lock contract. Nightly is fuzz-only and cannot change product compatibility claims. + +### FR-003 — raw and structure-aware fuzzing + +Raw-byte fuzzing is required where malformed bytes are the security boundary, including archive/compression and JSON parsing. + +Structured generation is required where raw bytes would mostly exercise trivial rejection, including Lockfile V2 graphs, canonical references, source-map paths/ranges, report/suppression/fingerprint combinations, and graph permutations. + +Each target MUST execute under the exact resource/offline protocol. Missing or ambiguous runtime isolation is incomplete evidence, not PASS. + +### FR-004 — independent cross-path/property models + +Where independent models are practical, AF-02 MUST compare product behavior with a separately expressed model rather than calling the same implementation twice. + +Initial model families include: + +- Lockfile V2 graph validity/canonicalization; +- archive manifest inventory/count/order; +- portable-path containment and rejection; +- canonical-reference parsing/resolution outcomes; +- graph set/order invariants; +- quality-gate/fingerprint/suppression set and truth-table behavior; +- constructor/serializer/retained-validator agreement where paths are independently meaningful. + +Unknown divergence fails until minimized and understood. + +### FR-005 — property testing + +Adopt: + +```text +proptest = "=1.11.0" +``` + +Property configuration, case count, shrinking behavior, and model registry MUST be checked in before qualification. A counterexample MUST be retained as a deterministic reproducer before its defect can close. + +### FR-006 — regression corpus and assertion binding + +Every fuzz crash, invariant failure, unexpected acceptance, hostile-input timeout attributable to the input, or property counterexample MUST be minimized and promoted to the deterministic corpus before the fix closes. + +Corpus entries MUST use synthetic or publicly redistributable non-PHI data. Default individual payload maximum is `256 KiB`; aggregate committed AF-02 corpus maximum is `8 MiB` unless a dedicated policy PR changes it first. + +Every scenario MUST have exactly one assertion-registry entry and every assertion entry MUST map to exactly one scenario. Replay target, argv, parser identity, source/config digests, expected normalized outcome, fixture SHA-256, and raw replay result are machine-checkable. + +### FR-007 — no-PHI/provenance gate + +No PHI or patient-derived data may enter AF-02 source, corpora, artifacts, logs, or crash reports. Public artifacts with unclear redistribution terms are metadata-only until rights are established. Opaque crash artifacts are not uploaded unless provenance scanning classifies them safe. + +### FR-008 — flaky-as-failure + +Adopt: + +```text +cargo-nextest: 0.9.143 +upstream: 60fa45f638ffc3f35e74afa65737f45fcd32db2a +``` + +The canonical AF-02 invocation MUST include both: + +```text +--retries 2 +--flaky-result fail +``` + +Repository profile `ci` MUST also specify retries 2 and flaky-result fail. The deterministic isolated retry-pass fixture and JUnit/process-exit provenance protocol are frozen in `verification-protocol.md`. A test that fails then passes on retry remains a failed AF-02 run. + +Canonical `cargo test --workspace --all-features --locked` remains mandatory and nextest is additive. + +### FR-009 — coverage measurement + +Adopt: + +```text +cargo-llvm-cov: 0.9.0 +upstream: be59056988acd54c7f984b7c85643daea3711b29 +``` + +Before observing percentages, freeze the measurement descriptor: source/tree, compiler/tool binary, exact command, Cargo inputs, replay/property/test inputs, source-universe definition, and exact exclusions. + +Coverage source authority is the Git tree, not the report producer. The authoritative line universe includes tracked Rust under both `crates/**/src/**` and `tools/**/src/**`, minus only exact previously canonical non-product exclusions. Missing, unknown, duplicate-normalized, or zero-total critical paths fail closed. + +Floors are derived from measured integer covered/total values. A floor, source-scope, command, test selection, or exclusion change cannot self-green in the same candidate. + +### FR-010 — targeted mutation adequacy with complete in-scope selection + +Adopt: + +```text +cargo-mutants: 27.1.0 +upstream: 8ab1dc786a1f61a4e370416cc6c68b81a704e917 +``` + +Stack C0 freezes exact target source paths and exact reviewed exclusions **before mutation execution**. The pinned cargo-mutants JSON listing is then authoritative: + +> Every listed mutant whose source path is inside the frozen target scope is REQUIRED unless it matches exactly one previously canonical exact exclusion. + +There is no top-N, percentage, operator preference, manual “important mutant” choice, or post-result selection. + +Every required result MUST close as `KILLED` or a previously canonical narrow waiver. `TIMEOUT`, `UNVIABLE_OR_BUILD_FAILURE`, `SURVIVED`, and unclassified results are non-green until the required bounded retry/diagnosis and closure rules are satisfied. + +### FR-011 — deterministic versus stochastic evidence + +Deterministic qualification includes fixed corpus replay, property configuration/outcomes, nextest policy evidence, coverage, the frozen mutation inventory/results, canonical cargo test, authority projections, and required checks. + +Stochastic fuzz discovery records bounded observations only. “No crash for N minutes” is never a correctness proof and never enters the deterministic proof digest. + +### FR-012 — bounded CI topology + +AF-02 separates: + +1. deterministic PR qualification; +2. scheduled/manual bounded fuzz discovery; +3. targeted mutation execution; +4. final proof verification; +5. the base-controlled acceptance-authority verifier gate. + +Every lane has explicit timeout/resource/artifact limits and least GitHub token permissions. + +Heavy checks do not automatically become main required checks. Any live ruleset change follows the AF-01 topology/read-back process. + +### FR-013 — independent base-verifier anchor + +After Stack A0 becomes canonical, candidate-controlled workflow code MUST NOT be the only authority deciding whether a policy/verifier/enforcement change is acceptable. + +The canonical design is a repository-owned `pull_request_target` base-verifier gate executing from canonical base workflow code with read-only permissions. It MUST: + +- run the verifier from immutable canonical-base blob identities; +- obtain base and candidate trees into separate directories; +- never execute candidate code in the privileged/base-controlled job; +- treat candidate material only as data/evidence; +- trigger on every policy/schema/verifier/scanner/parser/result/workflow/enforcement-inventory path; +- record base workflow/verifier/enforcement-inventory blob SHAs and exact base/head identities; +- fail closed if base verifier cannot run or parse evidence. + +Before A0 merge, the new gate must demonstrate universal terminal topology. If it is promoted into live required checks, the ruleset update/read-back occurs only after the check exists successfully on the exact A0 head. + +### FR-014 — exact proof artifact + +The final proof MUST validate against: + +```text +schemas/af02-adversarial-proof-v1.schema.json +``` + +and the semantic invariants in `verification-protocol.md`. + +The independent verifier reconstructs the deterministic proof object from raw evidence and computes: + +```text +AF02_ADVERSARIAL_SHA256=<64 lowercase hex> +``` + +Producer-authored green summaries are not authority. Schema digest, raw evidence digests, source/tool identities, authority projections, corpus/assertions, nextest, coverage, mutation, cargo-test, and required-check provenance are bound into proof evidence. + +### FR-015 — product and assurance non-regression + +AF-02 MUST NOT weaken or reinterpret CF-03/04/05/06/07/09/10/11/12/13 semantics or AF-01 workflow/dependency/source-control policy. Minimal internal test seams are allowed only when public behavior/API remains unchanged and semantic regressions pass. + +### FR-016 — reviewer truth + +Every AF-02 planning/design/implementation stack requests CodeRabbit and Qodo when available. Reviewer timeout, quota, summary-only output, or unavailable service is recorded as such and never called PASS. Findings are dispositioned against the exact current head. + +## Non-functional requirements + +### NFR-001 — determinism + +Canonical product output, corpus replay, property assertions, coverage accounting, mutation policy parsing, authority projections, and deterministic proof construction are reproducible from retained exact inputs. + +### NFR-002 — fail closed + +Missing required evidence, stale/unclassified boundary, invalid schema, unknown mutation outcome, missing replay, missing critical coverage, authority drift, verifier ambiguity, or incomplete resource/offline proof fails qualification. + +### NFR-003 — bounded resources + +Routine adversarial jobs stay within the checked-in `commandf.af02-resource-policy/v1` limits. A stress test outside those limits is a separate bounded scenario and cannot silently redefine normal qualification. + +### NFR-004 — no hidden retries + +Retries diagnose; they do not manufacture green. + +### NFR-005 — no PHI + +Synthetic/public conformance metadata only. + +### NFR-006 — exact provenance + +Every external tool, registry package, retained authority source, corpus fixture, workflow result, and proof artifact has an exact immutable identity appropriate to its channel. + +## Planning closure rule + +This package becomes canonical only when T006 completes on one exact final planning head: existing CI green, exact required-context provenance proven, Qodo and CodeRabbit findings dispositioned, merge guarded by expected head, and canonical post-merge main/tree plus live AF-01 rulesets re-read. + +Only then is Stack A0 design freeze authorized. No fuzz/property/mutation implementation is authorized directly by this planning PR. diff --git a/specs/016-af-02-adversarial-test-strength/tasks.md b/specs/016-af-02-adversarial-test-strength/tasks.md new file mode 100644 index 00000000..0ffe056b --- /dev/null +++ b/specs/016-af-02-adversarial-test-strength/tasks.md @@ -0,0 +1,112 @@ +# AF-02 Tasks — Adversarial Test Strength + +Status: PLANNING_CANDIDATE + +## Task-state rules + +- `[ ]` means not proven complete on canonical repository evidence. +- No task inherits stale-head CI/reviewer evidence. +- No force-push, rebase, or destructive history rewrite. +- No PASS/MERGED/CLOSED_CANONICAL claim without exact-head and post-merge evidence. +- `verification-protocol.md`, checked-in policies, and schemas are normative. `evidence-contracts.md` applies only where not superseded. +- `commandf.af02-authority-baseline/v1` is prohibited; use v2. +- Final proof schema remains `commandf.af02-adversarial-proof/v1`, now an envelope over the preserved proof-core schema plus 17 extension contract roles (42 total contract files: 25 core + 17 extension); the preserved core already contains `enforcement_inventory`. + +## Planning gate + +- [ ] **T001** Re-read canonical `main` SHA/tree and confirm AF-01 is `CLOSED_CANONICAL`. +- [ ] **T002** Confirm planning diff changes no product source, workflow, Cargo input, dependency, live ruleset, CF-06 pin, CF-10 corpus, or product behavior. +- [ ] **T003** Reconcile `spec.md`, `verification-protocol.md`, machine policies/schemas, `evidence-contracts.md`, `plan.md`, `tasks.md`, `consistency.md`, and donor provenance under one precedence rule. +- [ ] **T004** Reconstruct AF-01/CF-06/CF-10 expected authority from live/canonical/retained sources; validate `retained-authority-sources.json` against its closed schema. +- [ ] **T005** Qualify one exact final planning head: all path-applicable workflows green; required contexts unique and proven through `required-check-policy.json` plus `af02-required-check-provenance-v1`; fresh Qodo/CodeRabbit truth; zero unresolved substantive findings. +- [ ] **T006** Merge with expected-head guard; re-read canonical post-merge `main`/tree and both live AF-01 rulesets. Only then set `AF-02 PLANNING: CANONICAL` and authorize Stack A0 only. + +## Stack A0 — design freeze and base-controlled verifier + +A0 contains policy/schema/verifier infrastructure and tests only. New fuzz/property/coverage/mutation outcomes cannot prove A0 itself. + +- [ ] **T010** Add authority baseline v2 and verifier reconstruction for AF-01 live rulesets, CF-06 canonical-base sources, and CF-10 retained sources. +- [ ] **T011** Validate retained CF-10 locators with `af02-retained-authority-sources-v1.schema.json`; reconstruct URLs/objects rather than trusting candidate locator strings. +- [ ] **T012** Add `commandf.af02-surface-policy/v1` validated by `af02-surface-policy-v1.schema.json` and deterministic `syn=3.0.3` AST discovery over both Rust source roots. +- [ ] **T013** Prove exact source-universe membership and every discovery has one critical-surface or reviewed-exclusion disposition; zero stale/unclassified entries. +- [ ] **T014** Add `commandf.af02-resource-policy/v1` validated by `af02-resource-policy-v1.schema.json`. +- [ ] **T015** Implement the digest-pinned Linux OCI runner with network none, read-only source/root, bounded CPU/memory/PID/tmpfs/output and negative network/write probes. +- [ ] **T016** Freeze immutable tool acquisition/lock evidence; no registry package activates with a null checksum. +- [ ] **T017** Freeze independent property/model registry. +- [ ] **T018** Add `commandf.af02-corpus/v1`, assertion registry and no-PHI/provenance rules; validate corpus with `af02-corpus-v1.schema.json`. +- [ ] **T019** Add `waiver-policy.json` parser and ancestry verifier; start with zero waivers; same-candidate waiver cannot self-green. +- [ ] **T020** Add `required-check-policy.json` and exact GitHub provenance verifier using `af02-required-check-provenance-v1.schema.json`; app id alone is insufficient. +- [ ] **T021** Implement every algorithm and negative fixture named by `semantic-contract.json`; own tests must map algorithm/fixture ids to verifier code. +- [ ] **T022** Enforce `verifier-input-policy.json` before parsing untrusted candidate authority; bounded file/aggregate/depth/record/time/memory; YAML aliases/tags/merge keys prohibited. +- [ ] **T023** Add enforcement inventory covering projector/scanner/policy parsers/runners/check provenance/waiver/retained locator/input-limit/proof/workflow/schema authority. +- [ ] **T024** Add canonical-base `pull_request_target` verifier gate with read-only permissions, separate base/candidate trees, candidate-as-data-only and no candidate code execution. +- [ ] **T025** Prove base workflow/verifier/schema/inventory blob identity, path-trigger universality and fail-closed behavior for unparseable/unknown authority. +- [ ] **T026** Add anti-forgery negative tests: skip/rename/base-ref swap/candidate verifier substitution/candidate execution/parser exhaustion/symlink/path escape. +- [ ] **T027** Exact-head A0 CI/security/oracle/assurance + fresh Qodo/CodeRabbit + zero substantive threads. +- [ ] **T028** Guarded merge A0; re-read main/rulesets/base-verifier topology; authorize A1 only. + +## Stack A1 — fuzz/property/replay + +- [ ] **T030** Create isolated fuzz workspace pinned to cargo-fuzz 0.13.2, libfuzzer-sys 0.4.13, arbitrary 1.4.2 and nightly-2026-08-25 without product-toolchain leakage. +- [ ] **T031** Implement bounded archive/package raw fuzzing through existing product seams. +- [ ] **T032** Implement Lockfile raw/structured fuzz/property targets and independent model checks. +- [ ] **T033** Implement report/check/gate, graph/reference and source-map/path adversarial properties. +- [ ] **T034** Run deterministic property configurations; retain model/config/case counts and minimized counterexamples. +- [ ] **T035** Enforce A0 resource/offline policy for build/replay/property paths; resource/harness failures remain separate. +- [ ] **T036** Promote every discovered defect/counterexample to minimized deterministic corpus + assertion entry before closure. +- [ ] **T037** Prove corpus/assertion/replay bijection, no PHI/provenance violation, per-fixture <=256 KiB and aggregate <=8 MiB. +- [ ] **T038** Exact-head A1 qualification/review; guarded merge; re-read main before B0. + +## Stack B0 — nextest/coverage design freeze + +- [ ] **T050** Freeze cargo-nextest 0.9.143, retries=2, flaky-result=fail and deterministic isolated retry-pass fixture/JUnit process envelope. +- [ ] **T051** Freeze nextest state-file/no-follow/output-mount parser predicates and negative fixtures. +- [ ] **T052** Freeze `commandf.af02-coverage-policy/v1` validated by `af02-coverage-policy-v1.schema.json` before observing percentages. +- [ ] **T053** Freeze coverage source universe equal to surface universe, exact command/Cargo/replay/property inputs and canonical-base exclusions. +- [ ] **T054** Add policy-schema/semantic negative tests for units/ranges/duplicate paths/missing paths/unknown scope/same-candidate weakening. +- [ ] **T055** Exact-head B0 qualification/review; guarded merge; re-read main before B1. + +## Stack B1 — nextest/coverage execution + +- [ ] **T060** Run canonical `cargo test --workspace --all-features --locked`. +- [ ] **T061** Run ordinary nextest and isolated retry-pass fixture; retry-pass remains non-zero failed AF-02 evidence. +- [ ] **T062** Run frozen cargo-llvm-cov descriptor; parse every production source exactly once including zero-hit files. +- [ ] **T063** Derive workspace/critical-surface floors with checked integer arithmetic; no missing/unknown/duplicate/out-of-scope source. +- [ ] **T064** Prove anti-gaming: command/test/scope/exclusion/floor/policy weakening cannot self-green. +- [ ] **T065** Exact-head B1 qualification/review; guarded merge; re-read main before C0. + +## Stack C0 — mutation/proof design freeze + +- [ ] **T070** Freeze `commandf.af02-mutation-policy/v1` validated by `af02-mutation-policy-v1.schema.json` before mutant listing. +- [ ] **T071** Freeze target paths, cargo-mutants identity/argv/test/timeout/retry/diagnosis, exclusion-policy digest and waiver-policy digest. +- [ ] **T072** Derive required set as all listed in-target mutants minus exact pre-frozen exclusions; no post-list selection. +- [ ] **T073** Freeze mutation result classes; TIMEOUT/UNVIABLE require retry+diagnosis and remain non-green. +- [ ] **T074** Validate waiver-policy schema and canonical-ancestry/mutant-binding negative tests. +- [ ] **T075** Validate final proof envelope, preserved proof-core, 17 extension roles (42 total contract files; `enforcement_inventory` remains a core role), required-check provenance and final deterministic hashing. +- [ ] **T076** Prove every proof-critical policy instance validates against its planning-frozen schema before dependent evidence. +- [ ] **T077** Exact-head C0 qualification/review; guarded merge; re-read main before C1. + +## Stack C1 — mutation execution and final proof + +- [ ] **T080** Execute every required mutant from frozen inventory. +- [ ] **T081** Close every required result as KILLED or a previously canonical exact waiver; zero survivor/timeout/unviable/unclassified required outcomes. +- [ ] **T082** Run bounded stochastic fuzz campaigns only as stochastic observations; no-crash is not correctness PASS. +- [ ] **T083** Reconstruct AF-01/CF-06/CF-10 authority and compare with baseline v2. +- [ ] **T084** Reconstruct proof from raw evidence; validate proof-core + extension schemas, semantic contract and cross-object invariants; independently compute final `AF02_ADVERSARIAL_SHA256`. +- [ ] **T085** Prove exact-head required-check GitHub provenance from API truth and canonical-base workflow blobs. +- [ ] **T086** Full existing CI/security/oracle/assurance/non-regression gates + fresh Qodo/CodeRabbit. +- [ ] **T087** Guarded merge C1 and post-merge main/live-policy read-back. + +## Final convergence + +- [ ] **T090** Reconcile repository/CI/settings/process/document drift. +- [ ] **T091** Prove AF-01 invariants unchanged or separately strengthened; CF-06 identity unchanged; CF-10 failed production interpretation unchanged. +- [ ] **T092** Prove no PHI, no unresolved mutation result, no coverage/source omission, no retry-pass green, no verifier self-forgery and no parser-limit bypass. +- [ ] **T093** Record final source/tree, runs/checks/artifacts, required-check provenance, proof digest, tool locks, corpus, coverage, mutation/waivers, stochastic observations, reviewer dispositions and live ruleset read-back. +- [ ] **T094** Final exact-head external review and existing CI reconciliation. +- [ ] **T095** Guarded convergence merge and post-merge main/tree/live-ruleset read-back. +- [ ] **T096** Mark `AF02_CLOSED_CANONICAL` only when every dependency is proven; otherwise record the precise blocker without weakening the contract. + +## Continuation rule + +When AF-02 becomes `CLOSED_CANONICAL`, immediately re-read canonical roadmap/specs/tasks and begin the next genuinely eligible project unit. diff --git a/specs/016-af-02-adversarial-test-strength/tool-policy.json b/specs/016-af-02-adversarial-test-strength/tool-policy.json new file mode 100644 index 00000000..ce9579c7 --- /dev/null +++ b/specs/016-af-02-adversarial-test-strength/tool-policy.json @@ -0,0 +1,116 @@ +{ + "schema": "commandf.af02-tool-policy/v1", + "policy_base_sha": "2b4033e237a5c74f3c45c12fbc7e7bfdc88067b1", + "policy_base_tree": "804ce63c15edb501574bd4aba9a9aadc5bfb07f3", + "required_final_entry_ids": [ + "arbitrary", + "cargo-fuzz", + "cargo-llvm-cov", + "cargo-mutants", + "cargo-nextest", + "libfuzzer-sys", + "proptest", + "syn-af02-scanner" + ], + "entries": [ + { + "id": "arbitrary", + "kind": "registry_package", + "activation_stack": "A1", + "package": "arbitrary", + "version": "1.4.2", + "registry": "crates.io", + "default_features": true, + "features": ["derive"], + "registry_checksum_sha256_or_null": null, + "checksum_freeze_rule": "MUST_BE_CANONICAL_BEFORE_A1_EXECUTION" + }, + { + "id": "cargo-fuzz", + "kind": "executable", + "activation_stack": "A1", + "version": "0.13.2", + "upstream_repository": "https://github.com/rust-fuzz/cargo-fuzz", + "upstream_commit": "984c861c8dfea28055254c5f1d2659ab2cd63f76", + "acquisition_mode": "LOCKED_GIT_REV_SOURCE_BUILD", + "build_target": "x86_64-unknown-linux-gnu", + "features": [] + }, + { + "id": "cargo-llvm-cov", + "kind": "executable", + "activation_stack": "B0", + "version": "0.9.0", + "upstream_repository": "https://github.com/taiki-e/cargo-llvm-cov", + "upstream_commit": "be59056988acd54c7f984b7c85643daea3711b29", + "acquisition_mode": "LOCKED_GIT_REV_SOURCE_BUILD", + "build_target": "x86_64-unknown-linux-gnu", + "features": [] + }, + { + "id": "cargo-mutants", + "kind": "executable", + "activation_stack": "C0", + "version": "27.1.0", + "upstream_repository": "https://github.com/sourcefrog/cargo-mutants", + "upstream_commit": "8ab1dc786a1f61a4e370416cc6c68b81a704e917", + "acquisition_mode": "LOCKED_GIT_REV_SOURCE_BUILD", + "build_target": "x86_64-unknown-linux-gnu", + "features": [] + }, + { + "id": "cargo-nextest", + "kind": "executable", + "activation_stack": "B0", + "version": "0.9.143", + "upstream_repository": "https://github.com/nextest-rs/nextest", + "upstream_commit": "60fa45f638ffc3f35e74afa65737f45fcd32db2a", + "acquisition_mode": "LOCKED_GIT_REV_SOURCE_BUILD", + "build_target": "x86_64-unknown-linux-gnu", + "features": [] + }, + { + "id": "libfuzzer-sys", + "kind": "registry_package", + "activation_stack": "A1", + "package": "libfuzzer-sys", + "version": "0.4.13", + "registry": "crates.io", + "default_features": true, + "features": [], + "registry_checksum_sha256_or_null": null, + "checksum_freeze_rule": "MUST_BE_CANONICAL_BEFORE_A1_EXECUTION" + }, + { + "id": "proptest", + "kind": "registry_package", + "activation_stack": "A1", + "package": "proptest", + "version": "1.11.0", + "registry": "crates.io", + "default_features": true, + "features": [], + "registry_checksum_sha256_or_null": null, + "checksum_freeze_rule": "MUST_BE_CANONICAL_BEFORE_A1_EXECUTION" + }, + { + "id": "syn-af02-scanner", + "kind": "registry_package", + "activation_stack": "A0", + "package": "syn", + "version": "3.0.3", + "registry": "crates.io", + "default_features": true, + "features": ["full", "visit"], + "registry_checksum_sha256_or_null": "53e9bae58849f64dfa4f5d5ae372c8341f7305f82a3868709269343628b659a3", + "checksum_freeze_rule": "FROZEN_FROM_CANONICAL_BASE_CARGO_LOCK" + } + ], + "toolchains": { + "product_stable": "1.97.1", + "fuzz_only_nightly": "nightly-2026-08-25", + "target": "x86_64-unknown-linux-gnu" + }, + "activation_rule": "An entry becomes mandatory in every qualifying tool lock at and after its activation stack. Before first use, every null registry checksum must be replaced by the exact registry checksum in a dedicated design-freeze policy change that is canonical before dependent execution.", + "final_rule": "C1/final AF-02 proof MUST contain exactly all eight required_final_entry_ids and no others." +} diff --git a/specs/016-af-02-adversarial-test-strength/verification-protocol.md b/specs/016-af-02-adversarial-test-strength/verification-protocol.md new file mode 100644 index 00000000..d2ce887a --- /dev/null +++ b/specs/016-af-02-adversarial-test-strength/verification-protocol.md @@ -0,0 +1,223 @@ +# AF-02 Closed Verification Protocol + +Status: PLANNING_CANDIDATE + +This file is normative and has higher AF-02 precedence than `evidence-contracts.md`, `spec.md`, `plan.md`, `tasks.md`, `consistency.md`, and donor/provenance prose. Machine-readable schemas and checked-in policy instances are co-authoritative for structure and fixed policy values. Any disagreement fails qualification. + +Canonical planning base: + +```text +main: 2b4033e237a5c74f3c45c12fbc7e7bfdc88067b1 +tree: 804ce63c15edb501574bd4aba9a9aadc5bfb07f3 +AF-01: CLOSED_CANONICAL +``` + +## 1. Planning and temporal closure + +T005/T006 are temporal gates and cannot be embedded into the commit whose future CI/review/merge they prove. + +Planning closes only when one unchanged exact head: +1. passes every path-applicable workflow; +2. has unique successful `assurance-proof`, `rust`, and `scorecard` check-runs on that exact head; +3. proves those checks against `required-check-policy.json`, including GitHub Actions app id 15368, repository, workflow id/path/base blob, job, run, attempt, head/base and conclusion; +4. receives fresh Qodo and CodeRabbit review when available, with zero unresolved substantive findings; +5. merges with an expected-head guard; and +6. survives post-merge `main`/tree plus both AF-01 live-ruleset read-backs. + +Only step 6 closes T006 and authorizes Stack A0. Any head mutation makes earlier-head qualification stale. + +## 2. Canonical JSON and deterministic hashing + +All machine AF-02 JSON uses UTF-8 without BOM, no floats, compact separators, lowercase JSON literals, recursively UTF-8-byte-sorted object keys, schema-defined array order and no trailing newline. SHA-256 is lowercase hex over exact canonical bytes. + +Unknown fields, missing fields, wrong type/range/pattern/cardinality/order, duplicate semantic keys, invalid path normalization, source disagreement or digest mismatch fail before hashing. + +`schemas/af02-adversarial-proof-v1.schema.json` is the sole final proof schema. It is an envelope over the preserved pre-amendment structural proof schema copied byte-for-byte to: + +```text +schemas/af02-adversarial-proof-core-v1.schema.json +``` + +The core retains the original 25 contract roles and deterministic/stochastic structure. The core already contains the `enforcement_inventory` contract role. The envelope therefore adds exactly 17 ordered extension roles and MUST NOT repeat that instance role: + +```text +proof_core_schema +retained_authority_sources_schema +waiver_policy +waiver_policy_schema +required_check_policy +required_check_policy_schema +required_check_provenance_schema +semantic_contract +semantic_contract_schema +verifier_input_policy +verifier_input_policy_schema +surface_policy_schema +resource_policy_schema +corpus_manifest_schema +coverage_policy_schema +mutation_policy_schema +enforcement_inventory_schema +``` + +Thus final proof binds 42 distinct contract files across the core and extension sets. Paths and roles are unique across both sets. `extension_authority.enforcement_inventory_sha256` MUST equal the raw SHA-256 of the core contract file whose role is `enforcement_inventory`; `extension_authority.enforcement_inventory_schema_sha256` MUST equal the raw SHA-256 of the extension contract file whose role is `enforcement_inventory_schema`. The semantic verifier applies the same exact digest cross-binding to every extension-authority field and its corresponding contract role. + +`core.af02_adversarial_sha256` retains the historical core deterministic digest. The authoritative final `af02_adversarial_sha256` hashes the independently reconstructed deterministic envelope consisting of: +- `core.deterministic`; +- `extension_contract_files`; +- `extension_authority`; and +- `required_check_provenance`. + +`core.stochastic_observations` is excluded from the final deterministic digest. A producer-computed digest is compared only after independent reconstruction. + +## 3. Preserved authority: AF-01, CF-06 and CF-10 + +### AF-01 + +Live authority is read from: + +```text +GET /repos/TheHalfMoon/commandF/rulesets/21652953 +GET /repos/TheHalfMoon/commandF/rulesets/21652974 +``` + +The assurance ruleset must remain active on `refs/heads/main`, with no bypass actors, deletion/non-fast-forward protection, and exactly `assurance-proof`, `rust`, `scorecard`, each integration id 15368. The review-governance ruleset must remain active, merge-only, code-owner/review-thread/last-push protected, with only RepositoryRole actor 5 in `pull_request` bypass mode. + +Candidate edits cannot establish live authority. + +### CF-06 + +The verifier reconstructs production-oracle identity from canonical-base: + +```text +crates/commandf-pkg/src/oracle_model.rs +donors/hl7-fhir-validator-6.10.2.yaml +.github/workflows/cf06-oracle.yml +``` + +Required identity remains HAPI FHIR `6.10.2`, source commit `d06577dbc5c62c74a2a8823fbc4830a3024d5b0b`, validator digest `a3addadfa18dfa23146a0a243b6ede68eaad92157a5407738c468bb3d7e4ccd6`, and `hl7.fhir.r4.core@4.0.1`. + +### CF-10 + +`retained-authority-sources.json` must validate against `schemas/af02-retained-authority-sources-v1.schema.json` before any locator is used. The verifier reconstructs allowed GitHub URLs from fields instead of trusting supplied URLs, then verifies retained commit/blob/run/artifact identities. + +Required retained truth remains PR 11, head `5fe10d9859407272acf6649fc3e868d3eb2fbd12`, base `5cb1a4c3445c0ebd86654cfb467a5e008e801c3e`, manifest blob `655949a8a30d67502dffd624a175d2e8e02b1d1f`, donor blob `566b46f4e6f467a1ccae3ac810b31956309173b6`, run `31916124080` conclusion `failure`, and artifact `9255732702` / `cf10-real-corpus-evidence` / digest `9fdde985bb5abbe53ec2bce2dadc5f65c95557f8848c9af68755fc81a45af612`. + +AF-02 never relabels the retained CF-10 failed production gate as PASS. + +## 4. Closed machine authority + +The obsolete `commandf.af02-authority-baseline/v1` is non-implementable. The closed baseline remains `commandf.af02-authority-baseline/v2`. + +The following planning contracts are mandatory inputs: + +```text +tool-policy.json +exclusion-policy.json +waiver-policy.json +required-check-policy.json +semantic-contract.json +verifier-input-policy.json +enforcement-inventory.json + +schemas/af02-authority-baseline-v2.schema.json +schemas/af02-adversarial-proof-v1.schema.json +schemas/af02-adversarial-proof-core-v1.schema.json +schemas/af02-tool-policy-v1.schema.json +schemas/af02-tool-lock-v1.schema.json +schemas/af02-exclusion-policy-v1.schema.json +schemas/af02-evidence-inventories-v1.schema.json +schemas/af02-waiver-policy-v1.schema.json +schemas/af02-required-check-policy-v1.schema.json +schemas/af02-required-check-provenance-v1.schema.json +schemas/af02-retained-authority-sources-v1.schema.json +schemas/af02-semantic-contract-v1.schema.json +schemas/af02-verifier-input-policy-v1.schema.json +schemas/af02-surface-policy-v1.schema.json +schemas/af02-resource-policy-v1.schema.json +schemas/af02-corpus-v1.schema.json +schemas/af02-coverage-policy-v1.schema.json +schemas/af02-mutation-policy-v1.schema.json +schemas/af02-enforcement-inventory-v1.schema.json +``` + +Every schema uses fail-closed unknown-field behavior for its object contracts. Repository semantic validation remains mandatory where JSON Schema cannot express cross-object relations. + +## 5. Waiver authority + +`waiver-policy.json` validates against `schemas/af02-waiver-policy-v1.schema.json`. It starts with no waivers. + +A mutation result with `WAIVED_EQUIVALENT_OR_OUT_OF_SCOPE` is green only when the base verifier resolves exactly one `AF02-W####` entry whose mutant id, source path, allowed result class, evidence digest and canonical ancestry match the mutation result and frozen mutation inventory. + +`introduced_policy_sha` must already be an ancestor of the candidate canonical base. A waiver introduced by the same candidate cannot make that candidate green. Fabricated, duplicate, stale, cross-mutant or non-ancestor waivers fail. + +## 6. Required-check provenance + +`required-check-policy.json` and `schemas/af02-required-check-policy-v1.schema.json` freeze expected repository, GitHub Actions app, workflow ids/paths, canonical-base workflow blobs and job names. + +Runtime evidence validates against `schemas/af02-required-check-provenance-v1.schema.json`. + +For each context the verifier queries GitHub and proves exactly one matching check-run, repository `TheHalfMoon/commandF`, exact head/base, success, app id 15368/slug `github-actions`/owner `github`, expected workflow id/path/base blob, workflow run id/attempt, exact job name/id and `pull_request` event. App id alone is insufficient. + +## 7. Semantic verifier and untrusted candidate parsing + +`semantic-contract.json` validates against `schemas/af02-semantic-contract-v1.schema.json` and freezes verifier package/path/entrypoint plus named algorithm versions and negative-fixture ids. + +The base verifier must implement every listed algorithm exactly once and own tests for each algorithm and negative fixture. Missing algorithm/test identity is non-green. + +`verifier-input-policy.json` validates against `schemas/af02-verifier-input-policy-v1.schema.json`. Candidate files are untrusted data. Before semantic parsing the base gate enforces regular-file/no-symlink/containment and byte limits. JSON/YAML parsing enforces bounded depth, strings, properties/sequences/records and aggregate file/byte counts. YAML aliases, merge keys and custom tags are prohibited. Parser wall time and memory are bounded. Parent enforcement applies separate stdout/stderr byte ceilings; retained process evidence records observed bytes and per-stream overflow classification. Limit breach is explicit failure, never `NOT_APPLICABLE`. + +## 8. Policy schemas before dependent execution + +The following policy instance schemas are frozen during planning and MUST validate their instances before a dependent stack executes: + +```text +commandf.af02-surface-policy/v1 -> schemas/af02-surface-policy-v1.schema.json +commandf.af02-resource-policy/v1 -> schemas/af02-resource-policy-v1.schema.json +commandf.af02-corpus/v1 -> schemas/af02-corpus-v1.schema.json +commandf.af02-coverage-policy/v1 -> schemas/af02-coverage-policy-v1.schema.json +commandf.af02-mutation-policy/v1 -> schemas/af02-mutation-policy-v1.schema.json +commandf.af02-enforcement-inventory/v1 -> schemas/af02-enforcement-inventory-v1.schema.json +``` + +The base verifier validates each instance before accepting its digest. Same-candidate weakening cannot self-green dependent evidence. + +Surface and coverage consume the same Git-derived tracked Rust universe under `crates/**/src/**/*.rs` and `tools/**/src/**/*.rs` minus canonical-base source exclusions only. + +Mutation selection is exactly every cargo-mutants-listed mutant inside frozen target paths minus exact pre-frozen exclusions. No top-N, percentage, operator preference or post-result selection exists. + +Coverage descriptor/floors, mutation target/timeout/waiver bindings, corpus limits/provenance and resource units/ranges are schema-bound before observations. Enforcement role membership and activation-stack closure are schema/semantic-contract bound before a role becomes qualification authority. + +## 9. Tool identity and execution isolation + +`tool-policy.json` remains expected-set authority. Final tool lock contains exactly `arbitrary`, `cargo-fuzz`, `cargo-llvm-cov`, `cargo-mutants`, `cargo-nextest`, `libfuzzer-sys`, `proptest`, and `syn-af02-scanner`. + +No null registry checksum may remain once that tool's activation stack begins. Executable acquisition records immutable source identity and installed executable digest. + +Canonical deterministic execution uses the pinned Linux Rust OCI image from the resource schema, network none, read-only root/source, dedicated writable output, CPU/memory/PID/tmpfs limits and negative network/write probes. Missing enforcement evidence is incomplete, never PASS. + +## 10. Base-controlled anti-forgery gate + +A0 is the only bootstrap unit permitted to introduce the initial AF-02 verifier and base gate. A0 may use policy/schema/verifier infrastructure and tests only; no dependent fuzz/property/coverage/mutation outcome proves A0 itself. + +After A0 canonicalization, the `pull_request_target` base gate runs canonical-base workflow/verifier/schema blobs with read-only permissions; separates base and candidate trees with credentials disabled; never sources/imports/builds/executes candidate code; parses candidate authority only under the input-limit policy; derives base/head from GitHub event/API data; classifies acceptance-authority paths itself; records base workflow/verifier/schema/enforcement-inventory blobs; cannot be disabled by candidate path filters; and fails if the base verifier cannot parse or classify the candidate. + +An incompatible verifier/schema strengthening is a dedicated policy/verifier PR canonicalized before dependent work. + +## 11. Deterministic evidence rules + +The existing evidence inventory schema plus the semantic contract jointly enforce sorted/unique source universe and exact Git blob reconstruction; corpus/assertion/replay bijection; no PHI and bounded corpus sizes; independently normalized replay outcomes; nextest first-fail/retry-pass with forced flaky failure and non-zero process exit; exact Git-derived coverage membership and integer floor arithmetic; complete mutation inventory/result membership; waiver ancestry and mutant binding; canonical cargo-test counter equality; policy/inventory/digest cross-links; exact enforcement-role membership and activation closure; and path containment/no-follow rules. + +Schema validation alone is never sufficient for cross-object semantics. + +## 12. Stochastic observations + +Fuzz campaigns are observational only. Allowed classes remain `NO_CRASH_OBSERVED_WITHIN_BOUND`, `DEFECT_DISCOVERED`, `INCOMPLETE_RESOURCE_OR_HARNESS_FAILURE`, and `CANCELLED_OR_SUPERSEDED`. + +“No crash observed” is not correctness PASS. Any discovered defect must be minimized into deterministic replay evidence before the relevant implementation stack can close. + +## 13. Planning-review closure target + +This planning PR grants no implementation authority before T006. + +It is mergeable only after one exact final head has green path-applicable CI, unique/provenant required checks, fresh reviewer truth, and zero unresolved substantive findings. Merge uses expected-head protection. Post-merge main/tree and both live AF-01 rulesets are re-read before Stack A0 begins. diff --git a/specs/016-af-02-adversarial-test-strength/verifier-input-policy.json b/specs/016-af-02-adversarial-test-strength/verifier-input-policy.json new file mode 100644 index 00000000..38d89f30 --- /dev/null +++ b/specs/016-af-02-adversarial-test-strength/verifier-input-policy.json @@ -0,0 +1 @@ +{"schema":"commandf.af02-verifier-input-policy/v1","preparse":{"max_single_file_bytes":1048576,"regular_file_required":true,"symlinks_allowed":false,"containment_required":true,"byte_limit_before_parse":true},"json":{"utf8_required":true,"bom_allowed":false,"max_depth":32,"max_object_properties":512,"max_array_items":20000,"max_string_bytes":262144,"max_number_digits":20},"yaml":{"safe_loader_required":true,"custom_tags_allowed":false,"aliases_allowed":false,"merge_keys_allowed":false,"max_depth":24,"max_sequence_items":10000,"max_scalar_bytes":262144},"aggregate":{"max_candidate_authority_bytes":16777216,"max_candidate_authority_files":128,"max_total_records":50000,"parser_wall_seconds":20,"parser_memory_mib":512},"parser_runtime":{"process_mode":"DEDICATED_UNPRIVILEGED_SUBPROCESS","manifest_path":"tools/af02-verifier/Cargo.toml","binary_path":"target/af02-verifier/release/commandf-af02-verifier","entrypoint":"verify-pr","rust_version":"1.97.1","dependency_lock_path":"Cargo.lock","binary_sha256_required":true,"dependency_lock_blob_sha_required":true,"parent_enforces_wall_timeout":true,"cgroup_v2_memory_enforcement_required":true,"pids_limit":64,"network_mode":"none","read_only_root":true,"no_new_privileges":true,"stdout_byte_ceiling":1048576,"stderr_byte_ceiling":1048576},"enforcement_evidence":{"policy_sha256_required":true,"process_identity_sha256_required":true,"binary_sha256_required":true,"dependency_lock_blob_sha_required":true,"cgroup_snapshot_sha256_required":true,"termination_class_required":true,"bounded_stdout_stderr_required":true,"stream_output_evidence_schema":{"type":"object","additionalProperties":false,"required":["stdout_observed_bytes","stderr_observed_bytes","stdout_ceiling_exceeded","stderr_ceiling_exceeded"],"properties":{"stdout_observed_bytes":{"type":"integer","minimum":0},"stderr_observed_bytes":{"type":"integer","minimum":0},"stdout_ceiling_exceeded":{"type":"boolean"},"stderr_ceiling_exceeded":{"type":"boolean"}}},"stream_ceiling_comparison_rule":"EXCEEDED_IFF_OBSERVED_BYTES_GT_CEILING","allowed_termination_classes":["CLEAN_EXIT","SCHEMA_REJECT","SEMANTIC_REJECT","WALL_TIMEOUT_KILL","MEMORY_LIMIT_KILL","PID_LIMIT_KILL","PARSER_CRASH"]}} \ No newline at end of file diff --git a/specs/016-af-02-adversarial-test-strength/waiver-policy.json b/specs/016-af-02-adversarial-test-strength/waiver-policy.json new file mode 100644 index 00000000..ab03d236 --- /dev/null +++ b/specs/016-af-02-adversarial-test-strength/waiver-policy.json @@ -0,0 +1,5 @@ +{ + "schema": "commandf.af02-waiver-policy/v1", + "policy_base_sha": "2b4033e237a5c74f3c45c12fbc7e7bfdc88067b1", + "waivers": [] +}