Skip to content

Key roles, step 3: realm trust material and the layer-manifest path, fail-closed until every site enforces (REQ-KEYROLES-001) - #316

Merged
avrabe merged 7 commits into
mainfrom
feat/keyroles-3b-layer-path
Nov 5, 2026
Merged

avrabe merged 7 commits into
mainfrom
feat/keyroles-3b-layer-path

Conversation

@avrabe

@avrabe avrabe commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

This is step 3 of REQ-KEYROLES-001 (key roles): realm trust material, and the layer-manifest verification path. It is PR 3 and PR 3b combined, because 3b only makes sense on top of 3.

Fail-closed until the wiring lands

A realm that declares key-roles = true is refused at load (RealmError::KeyRolesNotEnforced). Status, index and attestation verification still use only the root, so loading such a realm would accept root-signed documents its own declaration forbids. PR 5 removes the refusal once every verification site consults Realm::trust(). The places it touches are marked TODO(PR 5).

Realms without the new keys behave exactly as before.

Change

  • varve-realms.toml: two new keys.
    • key-roles = true;
    • delegation-file, which is resolved like trust-root-file. A delegation-file without key-roles = true is refused at load.
    • An older varve refuses a realms file that carries either key, rather than silently ignoring it.
  • Realm::trust():
    • for a realm without roles, it returns RealmTrust::root_only;
    • for a realm with roles, it returns the delegation-backed role trust;
    • a missing, unreadable or refused delegation is an error, never a fallback to root-only.
  • Layer path (3b):
    • PinnedKeyVerifier::from_trust judges a layer manifest under the realm's LAYER keys in a roles realm, and under the root otherwise;
    • compose::walk_installed_trusted composes included layers under each realm's own trust;
    • varve-serve builds its realm verifier and its composition trusts from Realm::trust();
    • root_public_key() still returns the realm root.
  • concept-config-reference.md documents both keys and the refusal.

Evidence

  • Tests written first.
    • PR 3's realm.rs tests initially failed to compile: there was no key_roles field and no trust() method.
    • For PR 3b, the layer-path tests were run against a stub. The roles-realm install, reverify and compose tests failed on that stub, and the status- or root-signed refusals failed because the stub's error did not name the roles.
    • 2 of the 3 varve-serve tests failed against the unchanged main.rs with No valid signatures.
  • Already green before the change: three tests check that a no-roles realm stays root-only, so they had nothing to fail on. They are:
    • the_same_layer_signed_bytes_are_refused_under_a_realm_declaring_no_roles;
    • layer_signed_bytes_are_refused_by_compose_under_a_no_roles_realm;
    • the serve test the_same_layer_signed_layer_is_refused_by_a_realm_declaring_no_roles.
  • The refusal: the varve-serve roles-realm tests now assert KeyRolesNotEnforced and carry a TODO(PR 5) to flip back.
  • Mutation runs, CI flags, all 0 missed:
    • realm.rs: 36 mutants tested in 9m: 34 caught, 2 unviable;
    • verify.rs and compose.rs: 101 mutants tested in 18m: 89 caught, 12 unviable;
    • varve-serve/src/main.rs is exempt as a bin target in mutation-scope.toml.
  • Local checks after merging current main: fmt is clean, clippy -D warnings is clean, cargo test --workspace passes, and rivet validate passes.

Next

PRs 4 and 5: CLI signing by role, and the consumer wiring of status, index and attestation. They remove the refusal.

🤖 Generated with Claude Code

https://claude.ai/code/session_019TNtfRjLNhEz82G2ggeeNu

avrabe and others added 7 commits November 5, 2026 08:00
…REQ-KEYROLES-001, step 3)

A realms file may declare key-roles = true and a delegation-file (resolved
like trust-root-file). Realm::trust() returns root-only for a realm without
roles, and the delegation-backed role trust for one with them; a missing,
unreadable or refused delegation is an error, never a root-only fallback.
delegation-file without key-roles = true is refused at load. Realms without
the keys are unchanged. An older varve refuses a file carrying the keys.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…on site enforces it (REQ-KEYROLES-001)

No verification site consults Realm::trust() yet, so a roles realm would
accept root-signed layers and statuses its own declaration forbids.
resolve_realm now refuses it with a clear error instead of verifying it as
root-only. Realm::trust() and its tests are kept, built through a private
loader that skips the refusal. TODO(PR 5) marks the removal.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…R 3b)

PinnedKeyVerifier::from_trust judges a layer manifest under the realm's LAYER
keys in a roles realm and under the root otherwise; compose gains
walk_installed_trusted and varve-serve builds its realm verifier and its
composition trusts from Realm::trust(). root_public_key() stays the realm root.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The loader now refuses key-roles realms (KeyRolesNotEnforced); the viewer tests
assert that refusal, with a TODO to flip them once PR 5 wires every site.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@avrabe
avrabe merged commit 409d07f into main Nov 5, 2026
75 of 76 checks passed
@avrabe
avrabe deleted the feat/keyroles-3b-layer-path branch November 5, 2026 19:30
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