Repository navigation
[cargo-anneal] Add Receipt v3 ForeignEntryContract and verify.rs wiring - #591
Conversation
38cb035 to
0f59386
Compare
|
🤖 Exact-HEAD verification receipt for PR 2 ( PR State: Strictly Draft (
Human review surface
Verification (
|
|
🤖 Exact-HEAD verification receipt for PR 2 ( PR State: Strictly Draft ( Review Hardening Incorporated
Human review surface (
Verification (
|
0f59386 to
2fb9d54
Compare
joshlf
left a comment
There was a problem hiding this comment.
Authored by an AI agent acting on joshlf's behalf.
Gate 2 Independent Cross-Family Review — FINDINGS (tier2a_core_tcb, Round 1)
- Identity:
multi:01ff20e13ed8a2b3e0ff3ef598355e92255f7f8a:2fb9d54b3c1b59caad2f11230947a5c2f2519fff(base=01ff20e13ed8,head=2fb9d54b3c1b,tree=0cded65e7aa8) - Separation:
author_family=agentvs.reviewer_family=multi - Coverage: 23 inspected, 0 inapplicable, 0 blocked (of 23 changed file(s))
| Seat | Family | Role | Status | Verdict | Findings | Latency |
|---|---|---|---|---|---|---|
seat1 |
claude-frontier-thinking |
tcb_and_api_critic |
completed |
clean |
0 | 1352s |
seat2 |
gemini-frontier-thinking |
tcb_and_spec_critic |
completed |
findings |
3 | 1061s |
seat3 |
gemini-executable-falsifier |
sandboxed_probe_runner |
completed |
clean |
0 | 1591s |
Deduplicated Findings
| ID | Sev | Consensus | Verification | Location | Summary |
|---|---|---|---|---|---|
G2-R1-01 |
P2 | 1 (seat2) | static_verified |
trusted/cargo-anneal/src/core/foreign_entry.rs:770 |
ty_requires_structural_extra_validity traverses FfiType::Record DAGs without memoization, causing O(2^N) exponential hangs on diamond record DAGs. |
G2-R1-02 |
P2 | 1 (seat2) | static_verified |
trusted/cargo-anneal/src/core/foreign_entry.rs:1197 |
build_foreign_entry_contracts and parse_foreign_entry_contracts_strict admit abi.kind == "system" on non-Linux targets instead of enforcing the Linux-only extern "system" boundary. |
G2-R1-03 |
P2 | 1 (seat2) | static_verified |
trusted/cargo-anneal/src/core/foreign_entry.rs:1739 |
parse_discharge_strict rewrites forbidden Phase-1 string discharges (by_c_typing, by_build_assert, by_ffi_check) to CallerClauseDischarge::Residual, corrupting parsed JSON output and hiding mutations in diff_receipts. |
G2-R1-01 [P2] (trusted/cargo-anneal/src/core/foreign_entry.rs:770, Pass 2 §3 (trusted/cargo-anneal), static_verified): ty_requires_structural_extra_validity traverses FfiType::Record DAGs without memoization, causing O(2^N) exponential hangs on diamond record DAGs.
- Invariant: Manifest validation in trusted/cargo-anneal must run in linear/polynomial time on valid acyclic ffi_exports.json record graphs, matching rustc-capture's memoized ValidityReasonCollector (trusted/rustc-capture/src/ffi_exports.rs:1754-1763,1897-1944).
- Evidence: In trusted/cargo-anneal/src/core/foreign_entry.rs:798-814, the FfiType::Record arm inserts rust_name into visiting_records, evaluates rec.fields.iter().any(...), and removes rust_name on exit with no acyclic memo table. For a 40-level diamond DAG of baseline-initialized structs (e.g. zero-sized #[repr(C)] struct S_k(S_{k-1}, S_{k-1}) within MAX_FFI_TYPE_DEPTH=64, or a ~6 KiB retained capture/ffi_exports.json), rustc, LayoutCollector (record_tys dedup), ValidityReasonCollector (memo), and collect_referenced_layouts (foreign_entry.rs:711) all run in O(N) time, whereas ty_requires_structural_extra_validity performs 2^40 - 1 recursive calls because every branch returns false and .any(...) cannot short-circuit. Because validate_ffi_exports_manifest runs twice in verify.rs (parse_ffi_exports_manifest and build_foreign_entry_contracts) and once in inspect --verify-artifacts, this hangs both verify and inspect indefinitely.
G2-R1-02 [P2] (trusted/cargo-anneal/src/core/foreign_entry.rs:1197, Pass 2 §3 (trusted/cargo-anneal), static_verified): build_foreign_entry_contracts and parse_foreign_entry_contracts_strict admit abi.kind == "system" on non-Linux targets instead of enforcing the Linux-only extern "system" boundary.
- Invariant: Phase 1 foreign-ABI export admission allows extern "system" strictly on Linux targets (docs/trust-model.md:731-735, docs/alpha.md:208, trusted/rustc-capture/src/extract.rs:8222-8226), and cargo-anneal independently enforces capture/receipt ABI admission invariants fail-closed.
- Evidence: build_foreign_entry_contracts (trusted/cargo-anneal/src/core/foreign_entry.rs:1197-1202) checks only matches!(export.abi.kind.as_str(), "c" | "system") without verifying that manifest.target is a Linux target, and parse_foreign_entry_contracts_strict (trusted/cargo-anneal/src/core/foreign_entry.rs:1491-1493, called from trusted/cargo-anneal/src/core/inspect/schema.rs:2024 without passing target) likewise accepts "system" for any configuration.target. A manifest or standalone Receipt v3 targeting a non-Linux triple (such as x86_64-pc-windows-msvc or aarch64-apple-darwin) with abi = {"kind": "system", "unwind": false} therefore passes build_foreign_entry_contracts and cargo anneal inspect with zero invariant violations.
G2-R1-03 [P2] (trusted/cargo-anneal/src/core/foreign_entry.rs:1739, Pass 2 §3 (trusted/cargo-anneal), static_verified): parse_discharge_strict rewrites forbidden Phase-1 string discharges (by_c_typing, by_build_assert, by_ffi_check) to CallerClauseDischarge::Residual, corrupting parsed JSON output and hiding mutations in diff_receipts.
- Invariant: Strict receipt parsing must preserve recognized discharge variants faithfully (consistent with by_wrapper_proof and by_linked_theorem at lines 1763 and 1774) so parsed JSON and diff_receipts accurately reflect claimed discharges.
- Evidence: In trusted/cargo-anneal/src/core/foreign_entry.rs:1739-1745, matching "by_c_typing" | "by_build_assert" | "by_ffi_check" pushes a Phase-1 violation but returns Ok(CallerClauseDischarge::Residual) rather than CallerClauseDischarge::ByCTyping / ByBuildAssert / ByFfiCheck (defined on lines 67-69). Consequently, cargo anneal inspect --passive --format json serializes the tampered clause as "discharge": "residual", and diff_receipts (trusted/cargo-anneal/src/core/inspect/diff.rs:1819,1959,2019,2057) compares cl.discharge as Residual vs Residual, emitting zero changes and has_regressions == false (whereas tampering to by_wrapper_proof is preserved on line 1763 and reported as a Tier A regression).
Non-blocking advisories (P3, not Gate 2 findings)
These notes do not block merge and do not require another Gate 2 round.
G2-R1-A01[P3] (trusted/cargo-anneal/src/core/foreign_entry.rs:181): extract_captured_foreign_info_from_capture_json deserializes configuration into Option<serde_json::Value> via serde_json::from_slice, silently accepting duplicate keys inside configuration.G2-R1-A02[P3] (trusted/cargo-anneal/src/core/foreign_entry.rs:1118): ffi_exports.json and retained capture.json are parsed with plain serde_json::from_slice rather than the duplicate-key-rejecting StrictJsonDom parser that target_base PR 602 introduced for untrusted verify.rs JSON inputs.G2-R1-A03[P3] (trusted/cargo-anneal/src/core/foreign_entry.rs:1559): parse_foreign_entry_contracts_strict permits non-contiguous/duplicate parameter indices, duplicate parameter names across indices, empty warnings arrays, and unknown warning codes.G2-R1-A04[P3] (trusted/cargo-anneal/src/core/foreign_entry.rs:1675): Bare inspect (without --verify-artifacts) does not require a warning for every extra-validity parameter clause, nor a safety_pre clause on unsafe exports; only --verify-artifacts re-derivation catches a receipt that drops them.G2-R1-A05[P3] (trusted/cargo-anneal/src/verify.rs:5293): Every non-stdlib receipt now carries configuration.allow_foreign_exports=true even for Rust-only crates, so inspect --diff across a tool upgrade reports a configuration change (Tier A under require_unchanged_specs); the commit body could state this receipt-wide effect explicitly.G2-R1-A06[P3] (global): AssuranceBadge::Ok doc comment says 'zero-warning' while classify_success_badge only checks spec_warnings.is_empty(), leaving [OK] active when foreign_entry_contracts emits [foreign-entry: extra_validity_parameter] warning rows (AssuranceBadge::Warn specifically formats anti-vacuity spec_warnings); warning and caveat rows still render unconditionally including under --quiet.
Executed Sandbox Probes
seat3repo_hygiene_and_root_manifest: outcome=passseat3taxonomy_lockstep_live_and_cli_json: outcome=passseat3test_verify_zerocopy_unittest: outcome=passseat3test_check_taxonomy_lockstep_unittest: outcome=passseat3rustc_capture_to_foreign_entry_parity_and_core_purity: outcome=passseat3rustc_2024_ffi_abi_layout_sanity: outcome=passseat3docs_relative_links_and_ci_check_todo: outcome=passseat3github_workflow_security_checklist: outcome=inapplicableseat3workspace_cargo_and_lean_builds: outcome=skipped_light_workload
|
🤖 Exact-HEAD verification receipt for PR 2 ( PR State: Strictly Draft ( Gate-2 Round 1 Fixes Incorporated (Delta over
|
2fb9d54 to
a5e9f42
Compare
joshlf
left a comment
There was a problem hiding this comment.
Authored by an AI agent acting on joshlf's behalf.
Gate 2 Independent Cross-Family Review — FINDINGS (tier2a_core_tcb, Round 2)
- Identity:
multi:5f07ae36854a910fac2010e39768d5d14131eddb:a5e9f4210321365f93a36729bd45843c29bdeb25(base=5f07ae36854a,head=a5e9f4210321,tree=5f45678b13a5) - Separation:
author_family=agentvs.reviewer_family=multi - Coverage: 23 inspected, 0 inapplicable, 0 blocked (of 23 changed file(s))
- Review mode:
delta_escalatedrelative to the prior Gate 2 review at head2fb9d54b3c1b59caad2f11230947a5c2f2519fff(escalated to the full panel: Q1 delta guard forces the full panel)
| Seat | Family | Role | Status | Verdict | Findings | Latency |
|---|---|---|---|---|---|---|
seat1 |
claude-frontier-thinking |
tcb_and_api_critic |
completed |
clean |
0 | 2359s |
seat2 |
gemini-frontier-thinking |
tcb_and_spec_critic |
completed |
findings |
1 | 1175s |
seat3 |
gemini-executable-falsifier |
sandboxed_probe_runner |
completed |
findings |
3 | 907s |
Deduplicated Findings
| ID | Sev | Consensus | Verification | Location | Summary |
|---|---|---|---|---|---|
G2-R2-01 |
P2 | 2 (seat2, seat3) | static_verified |
trusted/cargo-anneal/src/core/foreign_entry.rs:181 |
extract_captured_foreign_info_from_capture_json deserializes configuration into serde_json::Value, silently accepting duplicate allow_foreign_exports keys inside retained capture.json. |
G2-R2-02 |
P2 | 2 (seat2, seat3) | probe_confirmed |
trusted/cargo-anneal/src/core/inspect/diff.rs:1971 |
baseline_altered in diff_foreign_entry_contracts does not inspect discharge/statement tampering on a parameter that simultaneously retires from ExtraValidity to BaselineInitialized. |
G2-R2-03 |
P2 | 2 (seat2, seat3) | static_verified |
trusted/cargo-anneal/src/core/inspect/render.rs:1199 |
render_markdown omits ffi_exports_manifest_sha256 and foreign_entry_contracts disclosures that render_human and render_ledger display. |
G2-R2-04 |
P2 | 1 (seat2) | static_verified |
trusted/cargo-anneal/src/inspect.rs:1043 |
verify_retained_artifacts probes capture/ffi_exports.json with SafeFs::probe_symlink_metadata (bare lstat), following intermediate symlinks on dir/capture outside --artifacts-dir. |
G2-R2-01 [P2] (trusted/cargo-anneal/src/core/foreign_entry.rs:181, Pass 2 §3 (trusted/cargo-anneal), static_verified): extract_captured_foreign_info_from_capture_json deserializes configuration into serde_json::Value, silently accepting duplicate allow_foreign_exports keys inside retained capture.json.
- Invariant: Strict JSON parsing defense-in-depth on untrusted retained artifacts.
- Evidence: While
trusted/cargo-anneal/src/inspect.rsparses sibling retained manifests (result.jsonlines 829-830,capture/capture_shards.jsonline 1072,spec-closureline 1364,request.jsonline 1458) throughStrictJsonDom::parse_with_max_bytes,inspect.rs:933callsextract_captured_foreign_info_from_capture_json(trusted/cargo-anneal/src/core/foreign_entry.rs:129-215) which usesserde_json::from_slice::<CaptureJsonRoot>withconfiguration: Option<Value>and no#[serde(deny_unknown_fields)], silently applying last-key-wins to duplicate keys insideconfiguration(includingallow_foreign_exports) and omitting depth-64 bounds;parse_ffi_exports_manifest(trusted/cargo-anneal/src/core/foreign_entry.rs:1168, called frominspect.rs:987andverify.rs:5592) similarly callsserde_json::from_slicedirectly withoutStrictJsonDom::parse.
G2-R2-02 [P2] (trusted/cargo-anneal/src/core/inspect/diff.rs:1971, Pass 2 §3 (trusted/cargo-anneal), probe_confirmed): baseline_altered in diff_foreign_entry_contracts does not inspect discharge/statement tampering on a parameter that simultaneously retires from ExtraValidity to BaselineInitialized.
- Invariant: Defense-in-depth regression detection in diff_receipts independent of invariant_violations.
- Evidence: In
trusted/cargo-anneal/src/core/inspect/diff.rs:1928-1991,collect_entry_validityplacesentry_validity.param.<idx>.<name>clauses intob_ev_extra(and notb_ev_base) wheneverwarningscontainsextra_validity_parameterfor<name>, and intoh_ev_baseonce the warning is retired inhead. Line 1971-1972 computeslet baseline_altered = h_ev_base.iter().any(|(k, v)| b_ev_base.get(k).is_some_and(|bv| bv != v));, which returnsfalsefor any key missing fromb_ev_base. Confirmed in an isolatedbwraprustcprobe of lines 1899-1991: under an unchangedrust_identityand a fresh symbol (so step 1exportsisTierB), retiringwarningswhile settingentry_validity.param.0.x.statementto a vacuous string (valid receipt with 0invariant_violationsunderdischarge: "residual") or settingdischarge: "by_c_typing"yields("TierB", false)andhas_regressions == false.
G2-R2-03 [P2] (trusted/cargo-anneal/src/core/inspect/render.rs:1199, Pass 2 §3 (trusted/cargo-anneal), static_verified): render_markdown omits ffi_exports_manifest_sha256 and foreign_entry_contracts disclosures that render_human and render_ledger display.
- Invariant: Cross-format disclosure parity in cargo anneal inspect.
- Evidence: PR adds
ffi_exportsdigest,Foreign-Entry Contractsbaseline caveat, andForeign-Entry Warningstorender_human(trusted/cargo-anneal/src/core/inspect/render.rs:821-823,867-891) andrender_ledger(1118-1124,1177-1192), plus unit testrenders_ffi_exports_digest_and_warnings_in_text_and_ledger(line 2003), whilerender_markdown(lines 1251-1420) andassurance_qualification_tags(lines 440-474) emit neither table rows nor warning callouts forffi_exports_manifest_sha256orforeign_entry_contracts(includingunsafesafety_preclauses andextra_validity_parameterwarnings).
G2-R2-04 [P2] (trusted/cargo-anneal/src/inspect.rs:1043, Pass 2 §3 (trusted/cargo-anneal), static_verified): verify_retained_artifacts probes capture/ffi_exports.json with SafeFs::probe_symlink_metadata (bare lstat), following intermediate symlinks on dir/capture outside --artifacts-dir.
- Invariant: Pass 2 §3 (trusted/cargo-anneal) retained-artifact containment: every multi-component path access under an untrusted --artifacts-dir must traverse every intermediate directory with O_DIRECTORY | O_NOFOLLOW (matching read_artifact_under_dir at inspect.rs:652-740) to prevent symlink escape and TOCTOU swaps.
- Evidence: At trusted/cargo-anneal/src/inspect.rs:1042-1054, when s.ffi_exports_manifest_sha256 is None, verify_retained_artifacts constructs
let ffi_path = dir.join("capture/ffi_exports.json")and callsSafeFs::probe_symlink_metadata(&ffi_path, "inspect"). SafeFs::probe_symlink_metadata (trusted/cargo-anneal/src/sys_util.rs:140-151) calls barefs::symlink_metadata(lstat), which only avoids following a symlink on the final component (ffi_exports.json) and unconditionally follows a symlink on the intermediatecapturecomponent. Trigger 1 (static symlink escape): if an untrusted artifacts directory has symlinkdir/capture -> /arbitrary/host/dir,read_artifact_under_dir(dir, "capture/capture.json", ...)at inspect.rs:922 fails viaO_NOFOLLOWand pushes tofailures, but execution continues to line 1043 and probes/arbitrary/host/dir/ffi_exports.json, leaking host file existence or permission errors (EACCES) intocheck.failures. Trigger 2 (TOCTOU): swappingdir/captureto a symlink pointing to an empty directory between line 922 and line 1043 causesprobe_symlink_metadatato returnOk(None)and miss an unexpectedcapture/ffi_exports.json. Replace with aprobe_artifact_under_dirhelper usingopenat(..., O_DIRECTORY | O_NOFOLLOW)+fstatat(..., AT_SYMLINK_NOFOLLOW)on Unix (andvalidate_artifact_dir_chainprefix validation on non-Unix).
Non-blocking advisories (P3, not Gate 2 findings)
These notes do not block merge and do not require another Gate 2 round.
G2-R2-A01[P3] (trusted/cargo-anneal/src/core/foreign_entry.rs:873): validate_ffi_exports_manifest omits export-level ABI, symbol, uniqueness, and parameter checks that only run later in build_foreign_entry_contracts.G2-R2-A02[P3] (docs/trust-model.md:724): No Human review surface block could be confirmed: the PR body has none and the PR comments could not be read.G2-R2-A03[P3] (trusted/cargo-anneal/src/core/foreign_entry.rs:823): The record-layout walks recurse once per named record with no depth cap, so a crafted long chain could overflow the stack during inspect --verify-artifacts.G2-R2-A04[P3] (trusted/cargo-anneal/src/core/foreign_entry.rs:1745): parse_foreign_entry_contracts_strict accepts arbitrary non-blank warnings[*].code values and non-contiguous/duplicate-name entry_validity.param.. clauses despite diff.rs filtering strictly on extra_validity_parameter.G2-R2-A05[P3] (trusted/cargo-anneal/src/core/inspect/diff.rs:1847): else if b_safety_evidence != h_safety_evidence skips reporting a safety_pre evidence-hash change when another export retires safety_pre in the same diff.G2-R2-A06[P3] (trusted/cargo-anneal/src/core/inspect/render.rs:867): Human inspect --quiet hides foreign-entry contracts and extra-validity warnings, although the commit message calls the warnings non-suppressible.G2-R2-A07[P3] (trusted/cargo-anneal/src/core/inspect/schema.rs:2036): No test covers the rule that ffi_exports_manifest_sha256 and foreign_entry_contracts must appear together, or the schema-side stdlib_crate vs allow_foreign_exports exclusion.G2-R2-A08[P3] (trusted/cargo-anneal/src/output.rs:1016): The success badge only checks spec_warnings, so the card can show an OK badge next to a foreign-entry warning row.G2-R2-A09[P3] (trusted/cargo-anneal/src/verify.rs:6829): Rebase needed onto target_base near specification_manifest_sha256, and expanded check_taxonomy_lockstep staging makes test_all_fail_closed_taxonomy_and_ref_branches exceed 30s single-probe budgets.
Executed Sandbox Probes
seat3Mandatory Workflow Permissions / Auth / Secret-Containment Checklist (8 items): outcome=N/A — zero.github/workflows/*.ymlfiles were added or modified in the 23-file PR diff, and no workflow triggers, permissions, secrets, checkouts, shell interpolations, caches, or guards were altered.seat3Pass 1 deterministic static hygiene walk (os.walkover read-only candidate) + diffTODO/bidi/80-col doc check insidebwrap``: outcome=passed (exit 0): 0 symlinks, 0 hardlinks, 0 gitlinks, 0 checked-in build caches, 0 case/NFC collisions, 0 bidi/control chars, 0 TODO/FIXME/XXX in diff or commit metadata, valid 2026 Fuchsia headers on all 3 added.rs` files, all prose lines in modified regions of `docs/alpha.md` (lines 742-763) and `docs/trust-model.md` (lines 724-763) <= 80 chars.`seat3sha256sum --check --strict trusted/root-manifest.sha256` inside `bwrap: outcome=passed (exit 0):Cargo.toml,Cargo.lock,flake.nix,flake.lockall OK.seat3python3 -I -B -m unittest discover -s ci -p 'test_verify_zerocopy.py' -v` inside `bwrap: outcome=passed (exit 0): 32 tests ran in 4.625s, all OK (includingforeign_opt_in_okand negative foreign-export receipt tests).seat3python3 -I -B ci/check_taxonomy_lockstep.py --json` + 3 standalone `TaxonomyLockstepTests` + bounded framework/symbol/symlink mutation checks inside `bwrap: outcome=passed (exit 0): CLI JSONok: true(enums_found: 18,total_constructs: 101,source_refs_checked: 215in 3.27s); 3 non-loop unit tests OK in 25.749s;test_all_fail_closed_taxonomy_and_ref_branchestimed out at 30s (exit 124) due to 31 sequential ~3.3s lockstep invocations.seat3ci/check_skills_and_docs.py`, `ci/check_fast_docs_path_sync.py`, `ci/check_contract_lockstep.py`, `ci/check_fast_manifest_hygiene.py` inside `bwrap: outcome=passed (all exit 0);ci/check_todo.shexited 127 (rgabsent in stripped sandbox/usr/bin, covered by Python diff/metadata check).seat3Cross-file contract parity (trusted/rustc-capture/src/ffi_exports.rsvstrusted/cargo-anneal/src/core/foreign_entry.rs) +is_linux_target_triplevsrustc --print target-list(--print target-spec-json) across all 322 pinned compiler targets insidebwrap``: outcome=passed (exit 0): 322/322 targets matchedspec.os == "linux"` (0 mismatches); `FfiPassMode`, `FfiType`, `FfiReprFlags`, `FfiFieldLayout`, `FfiEnumVariant`, `FfiEnumTagEncoding`, `FfiEnumLayout`, `CanonicalSig`, and `ValidityReasonCollector` matched field-for-field.`seat3Standalonerustc --edition 2024executable falsification probe ofdiff.rscollect_entry_validity(lines 1899-1991) onb_ev_extra -> h_ev_baseinsidebwrap``: outcome=defect_confirmed (Finding 1, exit 0): both guttedentry_validity.param.0.x.statement` (valid `residual` receipt) and `ByCTyping` discharge produced `("TierB", false)` (`baseline_altered == false`) instead of `TierA`.`seat3target_base` (`5f07ae36`) overlap & hex-case compatibility check across all 7 shared files inside `bwrap: outcome=passed (exit 0): 6/7 files and all 38/39 diff hunks matchtarget_basecontext verbatim with lowercase SHA-256 fixtures; 1 hunk inverify.rs:6829sits 2 lines below#602'sspecification_manifest_sha256change.
|
🤖 Exact-HEAD verification receipt for PR 2 ( PR State: Strictly Draft ( Gate-2 Round 2 Fixes Incorporated (Delta over
|
a5e9f42 to
3d85a25
Compare
|
🤖 Exact-HEAD verification receipt for PR 2 ( PR State: Strictly Draft ( Gate-2 Round 2 + Clippy Fixes Incorporated (Delta over
|
3d85a25 to
6061922
Compare
joshlf
left a comment
There was a problem hiding this comment.
Authored by an AI agent acting on joshlf's behalf.
Gate 2 Independent Cross-Family Review — FINDINGS (tier2a_core_tcb, Round 3)
- Identity:
multi:53ae52f441a59d264cf2aba51cd19041fbacd44f:60619228942e1da10f73b88d29b1120e381032b8(base=53ae52f441a5,head=60619228942e,tree=e64900ee9f84) - Separation:
author_family=agentvs.reviewer_family=multi - Coverage: 23 inspected, 0 inapplicable, 0 blocked (of 23 changed file(s))
- Review mode:
delta_escalatedrelative to the prior Gate 2 review at heada5e9f4210321365f93a36729bd45843c29bdeb25(escalated to the full panel: Q1 delta guard forces the full panel)
| Seat | Family | Role | Status | Verdict | Findings | Latency |
|---|---|---|---|---|---|---|
seat1 |
claude-frontier-thinking |
tcb_and_api_critic |
completed |
clean |
0 | 515s |
seat2 |
gemini-frontier-thinking |
tcb_and_spec_critic |
completed |
clean |
0 | 1151s |
seat3 |
gemini-executable-falsifier |
sandboxed_probe_runner |
completed |
findings |
1 | 1242s |
Deduplicated Findings
| ID | Sev | Consensus | Verification | Location | Summary |
|---|---|---|---|---|---|
G2-R3-01 |
P2 | 1 (seat3) | probe_confirmed |
trusted/cargo-anneal/src/core/foreign_entry.rs:200 |
StrictJsonDom::MAX_JSON_DEPTH (64) prematurely rejects valid capture.json and ffi_exports.json files within MAX_FFI_TYPE_DEPTH (64) and parse_capture_receipt's 128-level limit. |
G2-R3-01 [P2] (trusted/cargo-anneal/src/core/foreign_entry.rs:200, Pass 2 §3 (trusted/cargo-anneal), probe_confirmed): StrictJsonDom::MAX_JSON_DEPTH (64) prematurely rejects valid capture.json and ffi_exports.json files within MAX_FFI_TYPE_DEPTH (64) and parse_capture_receipt's 128-level limit.
- Invariant: cargo-anneal artifact parsers must accept every valid capture/ffi_exports JSON emitted within anneal-rustc-capture's structural depth limits, and inspect --verify-artifacts must not reject pure-Rust captures accepted by verify.
- Evidence: StrictJsonDom::parse_with_max_bytes enforces MAX_JSON_DEPTH = 64 across all nested JSON objects/arrays (
trusted/cargo-anneal/src/core/inspect/strict_json.rs:31,91-98,154-178). Inffi_exports.json(trusted/rustc-capture/src/ffi_exports.rs:58-226,1067,1151-1165),exports[0].params[0].tystarts at JSON depth 6 whileMAX_FFI_TYPE_DEPTH = 64allows 59 nested arrays (depth 65 > 64) or 30 nested 1-tuples (2 containers each, depth 66 > 64), both confirmed to compile cleanly withrustc --edition=2024 --crate-type=lib(exit 0, no#![recursion_limit]). Additionally,trusted/cargo-anneal/src/verify.rs:2385-2403(parse_capture_receipt) usesserde_json::from_slice(default recursion limit 128), whereastrusted/cargo-anneal/src/inspect.rs:1061now callsextract_captured_foreign_info_from_capture_json(trusted/cargo-anneal/src/core/foreign_entry.rs:196-203) withMAX_JSON_DEPTH = 64, rejecting valid zero-FFIcapture/capture.jsonfiles (depth >= 65 atprogram.bodies[i].local_tys[j],trusted/rustc-capture/src/ir.rs:888-965) duringinspect --verify-artifacts. Fix by raising the artifact JSON parser depth bound cleanly above128 + outer envelope(or using a dedicated higher-depth strict parser constant for capture/FFI artifacts).
Non-blocking advisories (P3, not Gate 2 findings)
These notes do not block merge and do not require another Gate 2 round.
G2-R3-A01[P3] (trusted/cargo-anneal/src/core/foreign_entry.rs:1097): validate_ffi_exports_manifest defers several per-export structural checks (abi.unwind, abi.c_variadic, unsupported abi.kind, empty/duplicate symbol or rust_identity, contiguous param.index/unique param.name) until build_foreign_entry_contracts after Lean elaboration.G2-R3-A02[P3] (trusted/cargo-anneal/src/core/foreign_entry.rs:1330): ffi_exports.json parameter types are cross-checked against capture.json bodies only by count, not by type.G2-R3-A03[P3] (trusted/cargo-anneal/src/inspect.rs:1093): verify_retained_artifacts reads capture/ffi_exports.json under receipt_artifact_cap (which honors --max-receipt-bytes) but parse_ffi_exports_manifest enforces a fixed 128 MiB cap (MAX_FOREIGN_ARTIFACT_JSON_BYTES) without forwarding max_receipt_bytes.G2-R3-A04[P3] (trusted/cargo-anneal/src/verify.rs:5293): The supplied PR metadata contains no Human review surface block; the Review Receipt was not provided for this review.G2-R3-A05[P3] (trusted/cargo-anneal/src/verify.rs:5376): verify.rs always passes --allow-foreign-exports on non-stdlib runs but still accepts a capture whose configuration omits allow_foreign_exports.G2-R3-A06[P3] (trusted/cargo-anneal/src/verify.rs:7042): --fast-check returns before build_foreign_entry_contracts runs, so the ffi_exports/capture cross-check is skipped in dev mode.
Executed Sandbox Probes
seat3Static repo-wide hygiene scan (symlinks, submodules, build caches, case/NFC collisions, bidi/control Unicode, TODOs) inside bwrap --unshare-all: outcome=passedseat3Pinned root manifest checksum check (sha256sum --check --strict trusted/root-manifest.sha256) inside bwrap --unshare-all: outcome=passedseat3Taxonomy lockstep CLI check (ci/check_taxonomy_lockstep.py) inside bwrap --unshare-all: outcome=passedseat3Zerocopy receipt validator unit tests (ci/test_verify_zerocopy.py) inside bwrap --unshare-all: outcome=passedseat3Taxonomy lockstep unit and mutation test suite (ci/test_check_taxonomy_lockstep.py) inside bwrap --unshare-all: outcome=passedseat3Built-in rustc target triple parity probe vs foreign_entry.rs::is_linux_target_triple inside bwrap --unshare-all: outcome=passedseat3Adversarial deep-type rustc compilation and StrictJsonDom JSON container depth probe inside bwrap --unshare-all: outcome=failed_reproduced_defectseat3Fuchsia copyright headers, added TODO/FIXME markers in diff & commit 606192289, and Markdown relative links/anchors check inside bwrap --unshare-all: outcome=passed
|
🤖 Exact-HEAD verification receipt for PR 2 ( PR State: Strictly Draft ( Gate-2 Round 3 Fix Incorporated (Delta over
|
6061922 to
1a7d055
Compare
joshlf
left a comment
There was a problem hiding this comment.
Authored by an AI agent acting on joshlf's behalf.
Gate 2 Independent Cross-Family Review — CLEAN (tier2a_core_tcb, Round 4)
- Identity:
multi:2ce3cf9e185c561929ceb06817f7485904f1be61:1a7d0551d6b016448ad44a142d238aa28e5b8587(base=2ce3cf9e185c,head=1a7d0551d6b0,tree=18c6fff167a7) - Separation:
author_family=agentvs.reviewer_family=multi - Coverage: 24 inspected, 0 inapplicable, 0 blocked (of 24 changed file(s))
- Review mode:
delta_escalatedrelative to the prior Gate 2 review at head60619228942e1da10f73b88d29b1120e381032b8(escalated to the full panel: Q1 delta guard forces the full panel)
| Seat | Family | Role | Status | Verdict | Findings | Latency |
|---|---|---|---|---|---|---|
seat1 |
claude-frontier-thinking |
tcb_and_api_critic |
completed |
clean |
0 | 533s |
seat2 |
gemini-frontier-thinking |
tcb_and_spec_critic |
completed |
clean |
0 | 1234s |
seat3 |
gemini-executable-falsifier |
sandboxed_probe_runner |
completed |
clean |
0 | 884s |
No unresolved P0-P2 findings raised across completed seats.
Non-blocking advisories (P3, not Gate 2 findings)
These notes do not block merge and do not require another Gate 2 round.
G2-R4-A01[P3] (docs/trust-model.md:724): The section is still titled 'Opt-in foreign-ABI export capture' although cargo anneal verify now passes the flag on every run without --stdlib-crate, so every new receipt carries configuration.allow_foreign_exports: true and a new capture digest.G2-R4-A02[P3] (tools/anneal-corpus-scan/canonical_taxonomy_v1.json:105): item_extern_c_export_non_unwinding cites Trusted/Framework/Instances.lean#bodyMatchesMirSignature as its Lean semantics ref, but that check runs only on the MirEnvelope path this PR explicitly refuses for foreign exports.G2-R4-A03[P3] (trusted/cargo-anneal/src/core/foreign_entry.rs:658): is_valid_raw_bits_hex accepts uppercase hex digits and inspect.rs compares ffi_exports_manifest_sha256 case-insensitively.G2-R4-A04[P3] (trusted/cargo-anneal/src/core/foreign_entry.rs:948): validate_ffi_exports_manifest defers several per-export ABI/identity/parameter checks to build_foreign_entry_contracts.G2-R4-A05[P3] (trusted/cargo-anneal/src/core/foreign_entry.rs:1836):parse_foreign_entry_contracts_strictonly requireswarnings[].codeto be non-empty (!code.trim().is_empty()), whereasbuild_foreign_entry_contractsonly emits"extra_validity_parameter"anddiff_foreign_entry_contractsfiltersw.code == "extra_validity_parameter"when canonicalizingentry_validity.baseline_byte_initialization. Defense-in-depth note only: any mismatched or unrecognized warning code still triggersTierAunderforeign_entry_contracts.warningsindiff.rsand failsinspect --verify-artifactscontract recomputation.G2-R4-A06[P3] (trusted/cargo-anneal/src/verify.rs:5293): No Review Receipt / Human review surface block was in the staged artifacts, so its completeness (listing trusted/cargo-anneal, ci/, docs/trust-model.md and the default-on capture flag) could not be checked.
Executed Sandbox Probes
seat3pass1_fs_unicode_hygiene: outcome=passedseat3sha256sum_root_manifest: outcome=passedseat3workflow_permissions_checklist: outcome=inapplicableseat3taxonomy_lockstep_check: outcome=passedseat3ci_test_verify_zerocopy: outcome=passedseat3ci_test_check_taxonomy_lockstep_targeted: outcome=passedseat3ci_test_check_taxonomy_lockstep_exhaustive: outcome=timeoutseat3docs_links_and_nextest_config: outcome=passedseat3rustc_e2e_ffi_snippets: outcome=passedseat3rustc_standalone_logic_edge_cases: outcome=passedseat3heavy_cargo_and_lean_suites: outcome=not_run_under_workload_light
|
Authored by an AI agent acting on joshlf's behalf. Posted |
1a7d055 to
c166577
Compare
|
🤖 Exact-HEAD verification receipt for PR 2 ( Rebase & Post-#618 Fix (Delta over
|
c166577 to
f457fac
Compare
|
🤖 Exact-HEAD verification receipt for PR 2 ( Rebase & Mechanical Updates (Delta over
|
joshlf
left a comment
There was a problem hiding this comment.
Authored by an AI agent acting on joshlf's behalf.
Gate 2 Independent Cross-Family Review — FINDINGS (tier2a_core_tcb, Round 5)
- Identity:
one:bc9a7ea96ee91f6b03bdc8c0bd50e481d6c58268:defc63cf09bfabdf29e0fb86e12a5589891b66d8:9f28b1646ec583db31bf781789f6fe0a7f6167ec64a8d020a7ce876de725b9b4(base=6c2abcfa4aa5,head=f457facfd3ad,tree=defc63cf09bf) - Separation:
author_family=agentvs.reviewer_family=multi - Coverage: 24 inspected, 0 inapplicable, 0 blocked (of 24 changed file(s))
- Review mode:
delta_escalatedrelative to the prior Gate 2 review at head1a7d0551d6b016448ad44a142d238aa28e5b8587(escalated to the full panel: Q1 delta guard forces the full panel)
| Seat | Family | Role | Status | Verdict | Findings | Latency |
|---|---|---|---|---|---|---|
seat1 |
claude-frontier-thinking |
tcb_and_api_critic |
completed |
clean |
0 | 627s |
seat2 |
gemini-frontier-thinking |
tcb_and_spec_critic |
completed |
clean |
0 | 903s |
seat3 |
gemini-executable-falsifier |
sandboxed_probe_runner |
completed |
findings |
1 | 1016s |
Deduplicated Findings
| ID | Sev | Consensus | Verification | Location | Summary |
|---|---|---|---|---|---|
G2-R5-01 |
P2 | 1 (seat3) | probe_confirmed |
trusted/cargo-anneal/src/core/foreign_entry.rs:923 |
Cyclic FfiRecordLayout DAGs bypass memoization in ty_requires_structural_extra_validity before signature_sha256 verification, causing O(2^N) CPU DoS. |
G2-R5-01 [P2] (trusted/cargo-anneal/src/core/foreign_entry.rs:923, Pass 2 §3 (trusted/cargo-anneal), probe_confirmed): Cyclic FfiRecordLayout DAGs bypass memoization in ty_requires_structural_extra_validity before signature_sha256 verification, causing O(2^N) CPU DoS.
- Invariant: Untrusted ffi_exports.json manifest validation must run in bounded polynomial time within the declared size, depth, and diamond-DAG limits and reject physically impossible by-value Rust record cycles fail-closed.
- Evidence: collect_referenced_layouts (trusted/cargo-anneal/src/core/foreign_entry.rs:769-770) short-circuits on already-seen records and permits cycles, while validate_ffi_exports_manifest calls ty_requires_structural_extra_validity (line 1148) unconditionally on every export parameter before compute_export_signature_sha256 (line 1205). Whenever a record DAG contains a cycle edge back toward an ancestor without hitting an extra-validity leaf, hit_cycle propagates true up the DAG and line 923 (
if requires || !hit_cycle) skips inserting into memo, forcing exponential re-traversal of every diamond node. Inside bwrap, rustc confirmed recursive by-value structs ([S; 0] and mutual tuples) fail compilation with error[E0072], and a compiled probe mirroring lines 769-927 completed an acyclic 41-record diamond in 82 visits (0.031 ms) vs 16,777,215 visits (2,787.821 ms) with one cycle back-edge at N=23.
Non-blocking advisories (P3, not Gate 2 findings)
These notes do not block merge and do not require another Gate 2 round.
G2-R5-A01[P3] (docs/trust-model.md:724): The section heading still says 'Opt-in' although cargo anneal verify now enables --allow-foreign-exports by default, and the section does not describe the receipt foreign_entry_contracts envelope (residual-only discharge, required ambient clauses, --verify-artifacts re-derivation).G2-R5-A02[P3] (trusted/cargo-anneal/src/core/foreign_entry.rs:1120): Move per-export ABI kind/unwind/c_variadic validation into validate_ffi_exports_manifest so parse_ffi_exports_manifest fails fast before Lean elaboration.G2-R5-A03[P3] (trusted/cargo-anneal/src/core/foreign_entry.rs:1836): Restrict Phase 1 foreign-entry warning codes toextra_validity_parameterand reject explicit emptywarnings: []in parse_foreign_entry_contracts_strict.G2-R5-A04[P3] (trusted/cargo-anneal/src/core/inspect/diff.rs:1903): canonical_baseline_stmt re-implements the baseline clause text emitted by build_foreign_entry_contracts (foreign_entry.rs:1446) instead of sharing one helper.G2-R5-A05[P3] (trusted/cargo-anneal/src/output.rs:1025): Success verdict cards emit green [OK] even when foreign_entry_contracts carries D3 extra_validity_parameter warnings or safety_pre residual obligations, whereas inspect renders yellow [QUALIFIED].
Executed Sandbox Probes
seat3repo_hygiene_and_diff_scan: outcome=passedseat3root_manifest_sha256: outcome=passedseat3taxonomy_lockstep_and_refs: outcome=passedseat3ci_test_verify_zerocopy: outcome=passedseat3ci_test_check_taxonomy_lockstep: outcome=passedseat3rustc_target_triples_vs_is_linux_target_triple: outcome=passedseat3cyclic_record_dag_dos_and_rustc_e0072: outcome=finding_confirmedseat3strict_json_iterative_edge_cases: outcome=passedseat3workflow_permissions_auth_secret_checklist: outcome=na
|
🤖 Exact-HEAD verification receipt for PR 2 ( Gate-2 Round 5 Fix (1-File TCB Delta over
|
f457fac to
9037793
Compare
|
Anneal Merge Coordination Status:
Authored by an AI agent acting on joshlf's behalf. |
joshlf
left a comment
There was a problem hiding this comment.
Authored by an AI agent acting on joshlf's behalf.
Gate 2 Independent Cross-Family Review — FINDINGS (tier2a_core_tcb, Round 6)
- Identity:
multi:dbb2ae53ac1d429095f0df348d4aa341843cf682:90377931875a2764cae1795c03d44514442e0d13(base=dbb2ae53ac1d,head=90377931875a,tree=bcff50256826) - Separation:
author_family=agentvs.reviewer_family=multi - Coverage: 24 inspected, 0 inapplicable, 0 blocked (of 24 changed file(s))
- Review mode:
delta_escalatedrelative to the prior Gate 2 review at headf457facfd3adcd30874af9ea7d79c7981baa4d77(escalated to the full panel: Q1 delta guard forces the full panel)
| Seat | Family | Role | Status | Verdict | Findings | Latency |
|---|---|---|---|---|---|---|
seat1 |
claude-frontier-thinking |
tcb_and_api_critic |
completed |
clean |
0 | 684s |
seat2 |
gemini-frontier-thinking |
tcb_and_spec_critic |
completed |
findings |
1 | 1256s |
seat3 |
gemini-executable-falsifier |
sandboxed_probe_runner |
completed |
clean |
0 | 1097s |
Deduplicated Findings
| ID | Sev | Consensus | Verification | Location | Summary |
|---|---|---|---|---|---|
G2-R6-01 |
P2 | 1 (seat2) | static_verified |
trusted/cargo-anneal/src/core/foreign_entry.rs:1076 |
ty_requires_structural_extra_validity caches depth-truncated Ok(true) fallback results in the shared extra_validity_memo, causing false rejection of valid rustc-capture manifests and poisoning subsequent shallow parameter/export checks. |
G2-R6-01 [P2] (trusted/cargo-anneal/src/core/foreign_entry.rs:1076, Pass 2 §3 (trusted/cargo-anneal), static_verified): ty_requires_structural_extra_validity caches depth-truncated Ok(true) fallback results in the shared extra_validity_memo, causing false rejection of valid rustc-capture manifests and poisoning subsequent shallow parameter/export checks.
- Invariant: validate_ffi_exports_manifest structural validity validation must agree with rustc-capture (LayoutCollector::lower_ty + ValidityReasonCollector) and must not cache depth-dependent truncation outcomes in a depth-independent rust_name -> bool memo map.
- Evidence: In trusted/rustc-capture/src/ffi_exports.rs:1151-1165 and :1388-1397, LayoutCollector::lower_ty caches lowered records in record_tys (returning Ok(()) on re-encounter), and ValidityReasonCollector (lines 1773-1985) has no depth cutoff. In trusted/cargo-anneal/src/core/foreign_entry.rs:1000-1008 and :1038-1077, ty_requires_structural_extra_validity returns Ok(false) on FfiType::Ptr without populating extra_validity_memo, returns Ok(true) whenever depth > MAX_LAYOUT_WALK_DEPTH (64), and unconditionally writes memo.insert(rust_name.clone(), requires) at line 1076 into the manifest-wide extra_validity_memo (line 1272). Trigger: define a 35-level #[repr(C)] baseline-initialized struct chain S0 { x: u32 }, ..., S34 { f: S33 } and #[repr(C)] struct Wrap { a: [[...[S34; 1]...; 1]; 1], b: bool } (31 nested arrays) in pub extern "C" fn f(p0: *const S34, p1: Wrap, p2: S34) -> u32. rustc-capture lowers p0 at depth 1..37 (< 64) caching S0..S34, hits the cache for S34 inside p1 at depth 33, and emits BaselineInitialized for p0 and p2 and ExtraValidity for p1. In foreign_entry.rs, collect_referenced_layouts succeeds, p0 skips S34 in ty_requires_structural_extra_validity, p1 walks Wrap + 31 arrays + S34..S2 and hits S1 at depth 65 > 64 -> Ok(true), poisoning extra_validity_memo for S2..S34 with true (p1 still passes line 1325 because it is ExtraValidity). Then shallow depth-0 p2: S34 (or any later export g(x: S34)) reads the poisoned true from extra_validity_memo at line 1039 and fails at lines 1317-1322. (Similarly, p1: [[...[S34; 1]...; 1]; 1] marked BaselineInitialized is directly rejected.) Because validate_acyclic_by_value_layouts (line 1268) and StrictJsonDom depth 256 (line 1412) already guarantee acyclic O(V + E) termination, depth truncation should not poison memo (and is unnecessary once acyclicity is verified).
Non-blocking advisories (P3, not Gate 2 findings)
These notes do not block merge and do not require another Gate 2 round.
G2-R6-A01[P3] (docs/trust-model.md:727): The supplied PR metadata has no Human review surface block (the Review Receipt comment was not in the bundle), so its completeness could not be checked; it must exist before ready-for-review and list the trusted/cargo-anneal TCB changes, the ci/ changes, the docs/trust-model.md default-admission policy flip, and the new receipt fields.G2-R6-A02[P3] (trusted/cargo-anneal/src/core/foreign_entry.rs:67): The agent-facing cargo-anneal skill doc (trusted/cargo-anneal/skills/cargo-anneal/SKILL.md, 'Diagnose failures and read Receipt v3 honestly') is not updated to mention ffi_exports_manifest_sha256, foreign_entry_contracts, or reporting residual foreign-entry obligations and extra-validity warnings.G2-R6-A03[P3] (trusted/cargo-anneal/src/core/foreign_entry.rs:1989): parse_foreign_entry_contracts_strict permits arbitrary non-empty warnings[*].code values, explicit empty warnings arrays, and ambient.panic_link_consistency statements not matching configuration.panic during offline receipt inspection.G2-R6-A04[P3] (trusted/cargo-anneal/src/inspect.rs:1050): verify_artifacts reads capture/capture.json with MAX_ARTIFACT_FILE_BYTES instead of receipt_artifact_cap even though line 1064 forwards max(MAX_ARTIFACT_FILE_BYTES, max_receipt_bytes) to the JSON parser.
Executed Sandbox Probes
seat3Static hygiene scan of candidate tree (2923 tracked paths) and all 24 changed files + commit message: 0 symlinks (120000: outcome=passedseat3sha256sum --check --strict trusted/root-manifest.sha256 inside bwrap --unshare-all --clearenv exited 0 (Cargo.toml, Carg: outcome=passedseat3python3 -I -B -m unittest discover -s ci -p 'test_verify_zerocopy.py' -v inside bwrap exited 0 (32/32 tests passed in 2.: outcome=passedseat3All 4 tests in ci/test_check_taxonomy_lockstep.py passed inside bwrap (split to stay under 30s timeout: 3 fast tests in: outcome=passedseat3python3 -I -B probe in bwrap verified canonical_taxonomy_v1.json counts (101 constructs matching total_constructs, statu: outcome=passedseat3Standalone rustc binary compiled and executed in bwrap verified parse_strict_iterative, parse_json_string_token, and par: outcome=passedseat3Isolated bwrap unittest runs exited 0 on test_workflow_yaml (14), test_check_pr_hygiene_size_budget (17), test_check_con: outcome=passedseat3Verified all local relative links in candidate docs/alpha.md and docs/trust-model.md resolve to existing repository targ: outcome=passedseat3Workflow checklist item 1 (top-level and per-job permissions least-privilege): 0 .github/workflows/*.yml files modified: outcome=passedseat3Workflow checklist item 2 (triggers): 0 .github/workflows/*.yml files modified; bwrap scan confirmed 0 occurrences of pu: outcome=passedseat3Workflow checklist item 3 (secrets / GITHUB_TOKEN / GITHUB_ENV / GITHUB_OUTPUT scoping): 0 workflow files modified; grep: outcome=passedseat3Workflow checklist item 4 (release/publish protected environment): release.yml unmodified; bwrap audit confirmed environ: outcome=passedseat3Workflow checklist item 5 (persist-credentials: false and full SHA pinning): 0 workflow files modified; anneal-fast-chec: outcome=passedseat3Workflow checklist item 6 (${{ ... }} script injection in run:): 0 workflow files modified; no modified files introduce: outcome=passedseat3Workflow checklist item 7 (cache and artifact trust boundaries): 0 workflow or ci/checks.toml files modified; grep acros: outcome=passedseat3Workflow checklist item 8 (no guard relaxation): 0 .github/workflows/*.yml or ci/checks.toml guards altered; ci/verify_z: outcome=passed
Wire `cargo-anneal` to opt into and enforce Phase 1 non-variadic,
non-unwinding `extern "C"` and Linux `extern "system"` export
verification on top of the Ring-0 `Body.abi` metadata and
`ffi_exports.json` manifest capture infrastructure:
- Foreign-entry manifest parsing and `ForeignEntryContract` builder
(`trusted/cargo-anneal/src/core/foreign_entry.rs`,
`trusted/cargo-anneal/src/core/mod.rs`): Strictly parse and validate
`capture/ffi_exports.json` (`#[serde(deny_unknown_fields)]`, schema
version, target, 64-bit pointer width, `ambient_obligations`, record
and enum layout tables including `Vec`, `FnPtr.c_variadic`, payload
enums, `FfiEnumTagEncoding`, and `"uninhabited"`/`"untagged"`/`"none"`
discriminants, structural extra-validity classification, and exact
per-export `signature_sha256` recomputation), cross-check captured
foreign-ABI bodies (`abi != .rust`) 1:1 against `capture.json`, and
emit deterministic `ForeignEntryContract` records with explicit
per-parameter `entry_validity` clauses, `safety_pre` (for `unsafe`
exports only), fixed `ambient.*` clauses, non-suppressible `D3`
extra-validity warnings (`extra_validity_parameter`), and an explicit
baseline byte-initialization validity caveat (`MaybeUninit<T>`
contrast) so non-flagged scalar/pointer parameters are never implied
to be validity-free.
- `verify.rs` wiring (`trusted/cargo-anneal/src/verify.rs`): Pass
`--allow-foreign-exports` to `anneal-rustc-capture` on non-stdlib
runs, authenticate `configuration.allow_foreign_exports` in
`capture.json` fail-closed whenever foreign-ABI bodies or
`ffi_exports.json` appear, refuse foreign exports on `MirEnvelope`
(`#[spec]`) requests, hash `ffi_exports.json` into
`ffi_exports_manifest_sha256`, record
`FOREIGN_ENTRY_RECEIPT_ASSUMPTION` in `assumptions`, and attach
`foreign_entry_contracts` to Receipt v3.
- Receipt v3 `inspect` & human output
(`trusted/cargo-anneal/src/core/inspect/{schema,render,diff}.rs`,
`trusted/cargo-anneal/src/inspect.rs`,
`trusted/cargo-anneal/src/output.rs`): Enforce strict envelope
validation (symmetric `allow_foreign_exports`, `assumptions`,
`ffi_exports_manifest_sha256`, `foreign_entry_contracts`, `Phase 1`
`residual`-only discharge), verify `capture/ffi_exports.json` SHA-256
and re-derived contracts in `--verify-artifacts`, render human/ledger/
card disclosures and warnings, and classify foreign-entry changes and
regressions in three-tier `diff_receipts`.
- End-to-end tests, docs, and taxonomy lockstep
(`tests/cargo-anneal/tests/suite/ffi_export_entry_e2e.rs`,
`tests/cargo-anneal/tests/cli/sharding_and_limits/`,
`tests/cargo-anneal/tests/cli/foreign_entry_guards.rs`,
`tests/testkit/src/assertions.rs`, `.config/nextest.toml`,
`docs/alpha.md`, `docs/trust-model.md`,
`tools/anneal-corpus-scan/canonical_taxonomy_v1.json`,
`ci/test_check_taxonomy_lockstep.py`, `ci/verify_zerocopy.py`,
`ci/test_verify_zerocopy.py`): Add E2E scalar `extern "C"`
verification under `panic=unwind` + `overflow_checks: true`, tamper
and missing-flag controls, extra-validity warning + `safety_pre` test,
and safe-export precondition refusal control, and promote
`item_extern_c_export_non_unwinding` to `SUPPORTED_END_TO_END`.
Agent-authored-by: AI agent acting on Josh Liebow-Feeser's behalf
9037793 to
ed4f573
Compare
|
🤖 Exact-HEAD verification receipt for PR 2 ( Gate-2 Round 6 Fix (1-File TCB Delta over
|
joshlf
left a comment
There was a problem hiding this comment.
Authored by an AI agent acting on joshlf's behalf.
Gate 2 Independent Cross-Family Review — CLEAN (tier2a_core_tcb, Round 7)
- Identity:
multi:1a60949aad8080f5d083aabd2edeacfe0d39078d:ed4f5735d233e53d5c54e76523352d09a42c0ded(base=1a60949aad80,head=ed4f5735d233,tree=0097c5b1d186) - Separation:
author_family=agentvs.reviewer_family=multi - Coverage: 24 inspected, 0 inapplicable, 0 blocked (of 24 changed file(s))
- Review mode:
delta_escalatedrelative to the prior Gate 2 review at head90377931875a2764cae1795c03d44514442e0d13(escalated to the full panel: Q1 delta guard forces the full panel)
| Seat | Family | Role | Status | Verdict | Findings | Latency |
|---|---|---|---|---|---|---|
seat1 |
claude-frontier-thinking |
tcb_and_api_critic |
completed |
clean |
0 | 713s |
seat2 |
gemini-frontier-thinking |
tcb_and_spec_critic |
completed |
clean |
0 | 904s |
seat3 |
gemini-executable-falsifier |
sandboxed_probe_runner |
completed |
clean |
0 | 2284s |
No unresolved P0-P2 findings raised across completed seats.
Non-blocking advisories (P3, not Gate 2 findings)
These notes do not block merge and do not require another Gate 2 round.
G2-R7-A01[P3] (docs/trust-model.md:724): The trust-model section on foreign-ABI export capture does not describe the new Receipt v3 trust semantics (foreign_entry_contracts clauses are all residual, i.e. the verified guarantee holds only if callers meet the entry_validity, safety_pre and ambient obligations).G2-R7-A02[P3] (trusted/cargo-anneal/src/core/foreign_entry.rs:42): Doc comment claims structural validity classification 'never disagrees' with rustc-capture's ValidityReasonCollector, but the structural walk ignores layout scalar valid ranges (e.g. NonZero records) and can return false where capture reports extra validity.G2-R7-A03[P3] (trusted/cargo-anneal/src/core/foreign_entry.rs:682): collect_referenced_layouts permits depth 64 (65 frames) whereas rustc-capture LayoutCollector stops at depth >= 64.G2-R7-A04[P3] (trusted/cargo-anneal/src/core/foreign_entry.rs:827): is_linux_target_triple matches target.os == linux across all 322 built-in rustc targets, but synthetic 4-component *-linux-androideabi or 3-component custom -linux- triples would misclassify.G2-R7-A05[P3] (trusted/cargo-anneal/src/core/inspect/diff.rs:1835): Retiring safety_pre with --require-unchanged-specs emits a Tier A note mentioning specification_manifest_sha256 even when specification_manifest_sha256 itself did not change.G2-R7-A06[P3] (trusted/cargo-anneal/src/core/inspect/diff.rs:2056): Whenbaseline_alteredtriggers on a baseline-onlyentry_validityclause with unchanged IDs and no extra-validity entries,fmt_evemits identicalbaseandheadID strings instead of showing the altered baseline payload.G2-R7-A07[P3] (trusted/cargo-anneal/src/verify.rs:5379): PR title and body say cargo-anneal 'opts into' foreign exports, but the flag is passed on every non-stdlib run with no user-facing opt-in or opt-out; the description could state this default expansion explicitly.
Executed Sandbox Probes
seat1bwrap-sandboxed python3 -B -m unittest discover -s ci -p test_verify_zerocopy.py on candidate copy: outcome=Ran 32 tests OKseat1python3 -B check_taxonomy_lockstep.check_lockstep on candidate tree (base-identical script, untrusted JSON input): outcome=ok=True, enums_found=18, total_constructs=101, unmapped=[], stale=[]seat3hygiene_sha256_manifest: outcome=passedseat3hygiene_static_repo_and_docs: outcome=passedseat3ci_check_taxonomy_lockstep: outcome=passedseat3ci_test_check_taxonomy_lockstep: outcome=passedseat3ci_test_verify_zerocopy: outcome=passedseat3rustc_target_os_linux_parity_322_targets: outcome=passedseat3bwrap_rustc_probe_strict_json_and_foreign_entry: outcome=passedseat3workflow_checklist_item_1_permissions: outcome=not_applicableseat3workflow_checklist_item_2_triggers: outcome=not_applicableseat3workflow_checklist_item_3_secrets: outcome=not_applicableseat3workflow_checklist_item_4_protected_environments: outcome=not_applicableseat3workflow_checklist_item_5_checkout_and_pinned_shas: outcome=not_applicableseat3workflow_checklist_item_6_shell_injection: outcome=not_applicableseat3workflow_checklist_item_7_cache_artifact_trust: outcome=not_applicableseat3workflow_checklist_item_8_guard_relaxations: outcome=not_applicable
|
Authored by an AI agent acting on joshlf's behalf. Posted |
Wire
cargo-annealto opt into and enforce Phase 1 non-variadic, non-unwindingextern "C"and Linuxextern "system"export verification on top of the Ring-0Body.abimetadata andffi_exports.jsonmanifest capture infrastructure:ForeignEntryContractbuilder (trusted/cargo-anneal/src/core/foreign_entry.rs,trusted/cargo-anneal/src/core/mod.rs): Strictly parse and validatecapture/ffi_exports.json(#[serde(deny_unknown_fields)], schema version, target, 64-bit pointer width,ambient_obligations, record and enum layout tables includingVec,FnPtr.c_variadic, payload enums,FfiEnumTagEncoding, and"uninhabited"/"untagged"/"none"discriminants, structural extra-validity classification, and exact per-exportsignature_sha256recomputation), cross-check captured foreign-ABI bodies (abi != .rust) 1:1 againstcapture.json, and emit deterministicForeignEntryContractrecords with explicit per-parameterentry_validityclauses,safety_pre(forunsafeexports only), fixedambient.*clauses, non-suppressibleD3extra-validity warnings (extra_validity_parameter), and an explicit baseline byte-initialization validity caveat (MaybeUninit<T>contrast) so non-flagged scalar/pointer parameters are never implied to be validity-free.verify.rswiring (trusted/cargo-anneal/src/verify.rs): Pass--allow-foreign-exportstoanneal-rustc-captureon non-stdlib runs, authenticateconfiguration.allow_foreign_exportsincapture.jsonfail-closed whenever foreign-ABI bodies orffi_exports.jsonappear, refuse foreign exports onMirEnvelope(#[spec]) requests, hashffi_exports.jsonintoffi_exports_manifest_sha256, recordFOREIGN_ENTRY_RECEIPT_ASSUMPTIONinassumptions, and attachforeign_entry_contractsto Receipt v3.inspect& human output (trusted/cargo-anneal/src/core/inspect/{schema,render,diff}.rs,trusted/cargo-anneal/src/inspect.rs,trusted/cargo-anneal/src/output.rs): Enforce strict envelope validation (symmetricallow_foreign_exports,assumptions,ffi_exports_manifest_sha256,foreign_entry_contracts,Phase 1residual-only discharge), verifycapture/ffi_exports.jsonSHA-256 and re-derived contracts in--verify-artifacts, render human/ledger/ card disclosures and warnings, and classify foreign-entry changes and regressions in three-tierdiff_receipts.tests/cargo-anneal/tests/suite/ffi_export_entry_e2e.rs,tests/cargo-anneal/tests/cli/sharding_and_limits/,tests/cargo-anneal/tests/cli/foreign_entry_guards.rs,tests/testkit/src/assertions.rs,.config/nextest.toml,docs/alpha.md,docs/trust-model.md,tools/anneal-corpus-scan/canonical_taxonomy_v1.json,ci/test_check_taxonomy_lockstep.py,ci/verify_zerocopy.py,ci/test_verify_zerocopy.py): Add E2E scalarextern "C"verification underpanic=unwind+overflow_checks: true, tamper and missing-flag controls, extra-validity warning +safety_pretest, and safe-export precondition refusal control, and promoteitem_extern_c_export_non_unwindingtoSUPPORTED_END_TO_END.Authored by an AI agent acting on Josh Liebow-Feeser's behalf.