Skip to content

feat(id): verify rebound bindings on import + full §6.2 refusal coverage (#3810 slice 4b) - #13196

Closed
dezren39 wants to merge 1 commit into
mainfrom
lane-oc-code-05-3810-export-refusals
Closed

dezren39 wants to merge 1 commit into
mainfrom
lane-oc-code-05-3810-export-refusals

Conversation

@dezren39

@dezren39 dezren39 commented Nov 23, 2026 •

Copy link
Copy Markdown
Member

Summary

Next slice of #3810 (tracked under #2852 slice 4, spec §6): import verification now handles rebound bindings, and every remaining §6.2 refusal path has a test.

  • Fix: HostedBindingService::verify_key_signature admitted only a transcript key equal to the current binding key, so no export of a rebound binding could ever verify on import (BindingKeySignatureInvalid on every history-carrying binding). It now also admits a ceremony key superseded into history; the rebind chain (service attestation over the record plus backing rebind records, both still checked in verify_import step 2) is what links it to the current key. Doc comment updated.
  • Tests (13 new in hosted_export, 1 in hosted_binding): delayed-rebind history round-trip (objects signed pre- and post-rotation both verify), fast-path (old-key-signature) history verifies with no backing records, and one test per remaining refusal: HistoryUnbacked, RebindRecordMismatch, tampered rebind record, ManifestBindingMismatch, BindingKeySignatureInvalid, BindingAttestationInvalid, CountMismatch, ObjectsDigestMismatch, DuplicateObject, MissingBlob, plus canonical-order storage and a JSON wire round-trip asserting the identical object/hash set.
  • Failing-first oracle: the 5 rebind tests failed on origin/main with BindingKeySignatureInvalid (the bug above), not with a compile error; they pass after the fix. The refusal tests characterize the already-correct step 1–3 checks.

Closes no issue by itself: #3810 stays open for the remaining wiring (live per-user store enumeration + R2 blob fetch feeding build_export, and §6.2 step-4 ingest), which needs the hosted data plane as input — see next slice below. Requires: nothing (pure pkgs/id Rust; no DO/Worker changes).

Evidence

  • Ran on the laptop at 019897e76d9 (fleet-build-lock, workspace pkgs/id):
    • cargo test -p id --lib → 540 passed, 0 failed (hosted_export 22/22, hosted_binding includes new key_signature_verifies_for_a_rebound_binding).
    • cargo check -p id --all-targets → clean; the only warnings touching these files were a pre-existing unused-import (Verifier, removed in this PR) and a pre-existing missing-docs warning on sign_service_bytes.
    • cargo fmt --check on both files → clean (workspace has pre-existing drift in untouched id-core/bridge files).
  • Not run: cargo clippy. Environment toolchain skew: clippy-driver reports rustc 1.99.1 while rustc is 1.99.0, so clippy fails with E0514 on dependency crates before reaching this code (e.g. id-currency-registry). Nightly CI clippy is the venue of record here.

Merge Danger

Low. One 6-line condition change in verify_key_signature plus its doc comment; everything else is #[cfg(test)] code. The condition only widens acceptance for bindings whose transcript key appears in their own attested history — fresh bindings behave exactly as before (covered by existing tampered_records_fail_verification). No serialization, schema, or API changes; no Worker/DO/TS changes.

{
  "direct_parent": null,
  "links": [],
  "lineage": {
    "design": null,
    "roadmap_item": null,
    "priority": null
  },
  "pm_meta": 1,
  "provenance": {
    "queue_id": null,
    "scheduled_start": null,
    "picked_up_at": null,
    "work_started_at": null,
    "created_at": "2026-11-23T10:35:16Z",
    "session_id": "ses_e5df84d4bc9ffePZPoIbfJmtbG",
    "lane": null,
    "host": "amd",
    "worktree": "/home/user/git/code-worktrees/oc-code-05-3810",
    "model": null,
    "lane_start_issues": [],
    "workspace_ref": {
      "kind": "worktree",
      "id": "/home/user/git/code-worktrees/oc-code-05-3810",
      "repo": "developing-today/code",
      "branch": "lane-oc-code-05-3810-export-refusals",
      "sha": "019897e76d988c924a074310dfb22f24ff186dca"
    },
    "auth_subject": "oc-code-01",
    "stamped_by": "fleet 0.1.0 (native)"
  }
}

Prove it works
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

…age (#3810 slice 4b)

verify_key_signature now admits a ceremony key superseded into
history, so exports of rebound bindings verify on import; the rebind
chain (service attestation plus backing records) still links it to
the current key. Adds 13 hosted_export tests (delayed/fast-path
history round-trips, every remaining ExportError refusal, canonical
order + JSON wire round-trip) and a binding-level regression test.

Evidence: cargo test -p id --lib → 540 passed, 0 failed;
hosted_export 22/22. Clippy not run: toolchain skew (clippy-driver
reports rustc 1.99.1 vs rustc 1.99.0, E0514 on deps); cargo check
--all-targets clean except pre-existing warnings.
@coderabbitai

coderabbitai Bot commented Nov 23, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 40 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 64c4d27d-8160-44ce-a8a6-9e018234f68b
Commits

Reviewing files that changed from the base of the PR and between 9764182 and 019897e.

Files selected for processing: 2

  • pkgs/id/src/hosted_binding.rs
  • pkgs/id/src/hosted_export.rs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-23T10:37:27.760843Z 019897e PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 019897e76d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

}

#[test]
fn key_signature_verifies_for_a_rebound_binding() {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Prefix the newly added test functions with test_

The 15 new test functions across this file and hosted_export.rs omit the test_ prefix explicitly required by the naming convention in pkgs/id/AGENTS.md. Rename these newly introduced tests to follow the documented package convention.

AGENTS.md reference: pkgs/id/AGENTS.md:L140-L140

Useful? React with 👍 / 👎.

@dezren39

Copy link
Copy Markdown
Member Author

Related uncovered verification gap filed as #13289: verify_import currently trusts object.blob_refs and does not bind them to the envelope's actual document content citation. I confirmed with a temporary repro that a valid signed document.put citing content A plus an unrelated carried blob B passes verify_import and is reported complete by ingest, while A remains unavailable. #13196's refusal tests are valuable but do not cover this mapping; #13289 records the acceptance criteria.

@dezren39

Copy link
Copy Markdown
Member Author

Superseded in part — Lane WB (archer), 2026-11-23.

This PR's production fix (verify_key_signature history admission) landed on main via PR #13212's cross-slice fix, leaving this PR conflicting with main and its remaining value tests-only. That test half is rebased onto current main as PR #13312 (adapted to the §6.3 envelope object model: ExportObject::from_envelope instead of the removed ExportObject::new), with the full cargo test -p id --lib suite green (552 passed). Once #13312 merges, this PR can be closed as superseded — no unique content will remain here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant