Skip to content

Close ten fail-open gaps an adversarial review found in the wallet validator - #116

Merged
brettheap merged 1 commit into
mainfrom
fix/openxwallet-validator-holes
Aug 8, 2026
Merged

brettheap merged 1 commit into
mainfrom
fix/openxwallet-validator-holes

Conversation

@brettheap

Copy link
Copy Markdown
Contributor

Follow-up to #115. An adversarial review of the validator — run before any consumer adopted the family — found ten fail-open gaps and one crash. All are closed here, each with a permanent probe.

The pattern is the point, and it's worth stating plainly: every gap was a rule that looked right and asked a slightly wrong question.

The one that matters most

The collapse rule — the check that exists to stop a weaker custody model claiming a stronger one's authority — tested whether a model's key was readable.

But readability is only one route to evidencing the environment. A key isolated from the holder's execution context but signable by it without limit evidences the environment too: a compromised environment still signs anything the holder could. That middle case (isolated_invocable) sat in neither the readable list nor the holder list, so it could outrank the holder-evidencing model completely untouched:

- id: isolated_per_use_authorized   # evidences: holder
  authority_ceiling: act            # rank 2
- id: isolated_invocable            # evidences: environment  — honest!
  authority_ceiling: act_unsupervised   # rank 3 — ABOVE the holder model

→ 0 errors before this commit.

Re-keyed onto what a model evidences, which is the property the ruling was ever about. The name-keyed unearned-ceiling bug fixed in 5f61c4b was the same mistake in a different place — worth noting that the first fix closed the instance and not the class.

The rest

gap was
Presentation still accepted as proof Tested verified is False, so an absent verdict passed — signature presented, never checked, act permitted, filed authenticated.
An exercise didn't bind to its grant Unresolvable grant, act never conferred, non-audience wallet presenting it, custody stronger than the wallet declares — all passed, leaving every downstream rule adjudicating a fiction. New rule (r).
Declared custody never checked The closed set bound only where an exercise reported a model in force, never where a wallet declared one — so an invented model made every ceiling resolve to nothing. The cap failing open at the one point it binds. New rule (s).
Constraint escaped by silence Constraints were read from the exercise's own evaluations, so omitting the block escaped a constraint the grant declared. Declaration lives on the grant; that's where it's read now.
Attenuation ignored the posture Compared acts, objects, tier, expiry — so a derivation could keep its parent's tier and waive the approval that made that tier survivable. Posture and tier are one vocabulary by rule (h).
Layer 2 was inert Validated real artifacts without indexing them first, so every cross-record rule resolved only against the packaged corpus. It also excluded that corpus by this checkout's absolute paths — so scanning a vendored copy, the normal path for a pinning domain, re-adjudicated all the negatives as live records (23 false findings).
A naive timestamp aborted the run TypeError → the broad handler turned it into exit 2, discarding every finding from every other file and reporting a harness error where CI needed findings.
Key-material patterns too narrow Matched only bare PEM armor: missed a PGP block in the same field the shipped fixture uses, and missed a serialized JWK entirely — and since every object here is closed, a JWK can only arrive as a string, which is exactly where it wasn't being looked for.
The detail pin failed open expected_failure stopped at the first non-comment line, so a pin after a blank line was silently dropped — the fixture keeps a green self-test with its invariant pin gone, the precise drift the pin exists to prevent.

After

16 positives / 24 negative confirmations, 11/11 requirements, 19 rules, 17 load-bearing codes (red-proof: neuter any one, corpus goes red).

Bar green: validator self-test and repo mode, 132 manifest digests, openspec validate --all --strict 54/54, doc-health zero new findings.

Full record with the probe for each gap is in specs/006-openxwallet-contracts/traceability.yaml under review_hardening.

🤖 Generated with Claude Code

…lidator

Every gap was a rule that looked right and asked a slightly wrong question.
Recorded in traceability.yaml under `review_hardening`, each with the probe
that now holds it closed. Found before any consumer adopted the family.

THE COLLAPSE RULE ASKED THE WRONG QUESTION. It tested whether a custody
model's KEY WAS READABLE. Readability is only one route to evidencing the
environment — a key isolated from the holder's context but signable by it
without limit evidences the environment too — so that middle case sat in
neither the readable list nor the holder list and could outrank the
holder-evidencing model untouched. Re-keyed onto what a model EVIDENCES, which
is the property the ruling was ever about. The name-keyed unearned-ceiling
rule from the previous commit was the same mistake in a different place.

PRESENTATION WAS STILL ACCEPTED AS PROOF. The rule tested `verified is False`,
so an ABSENT verdict passed: a signature presented, never checked, act
permitted, filed as authenticated. Anything that is not an explicit
verification is now unproven.

AN EXERCISE DID NOT BIND TO ITS GRANT. An unresolvable grant, an act the grant
never conferred, a non-audience wallet presenting it, or a custody model
stronger than the wallet declares — all passed, leaving every downstream rule
adjudicating a fiction. Rule (r).

A WALLET'S DECLARED CUSTODY WAS NEVER CHECKED. The closed set bound only where
an exercise reported a model in force, never where a wallet declared one, so an
invented model made every ceiling derived from it resolve to nothing — the cap
failing open at the one point it is supposed to bind. Rule (s).

A CONSTRAINT WAS ESCAPED BY SILENCE. Constraints were read from the exercise's
own evaluations, so omitting the block escaped a constraint the grant declared.
Declaration lives on the grant; the check reads it from there now.

ATTENUATION IGNORED THE POSTURE. It compared acts, objects, tier and expiry —
so a derivation could keep its parent's tier and waive the approval that made
that tier survivable. Posture and tier are one vocabulary by rule (h); now
attenuation covers both, plus inherited distinct-holder constraints.

LAYER 2 WAS INERT. It validated real artifacts without indexing them first, so
every cross-record rule resolved only against the packaged corpus, while
legitimate parent/child pairs reported spurious unresolved-reference findings.
It also excluded the packaged corpus by this checkout's absolute paths, so
scanning a VENDORED copy — the normal consumption path for a pinning domain —
re-adjudicated all the negatives as live records (23 false findings).

A NAIVE TIMESTAMP ABORTED THE RUN. Comparing it against an aware one raised
TypeError, which the broad handler turned into exit 2, discarding every finding
from every other file and reporting a harness error where CI needed findings.

KEY-MATERIAL PATTERNS WERE TOO NARROW. The value scan matched only bare PEM
armor, missing a PGP block in the same field the shipped fixture uses, and
missed a serialized JWK entirely — and since every object here is closed, a JWK
can only arrive as a string, which is exactly where it was not being looked for.

THE DETAIL PIN FAILED OPEN. `expected_failure` stopped at the first non-comment
line, so a pin after a blank line was silently dropped and the fixture kept a
green self-test with its invariant pin gone — the precise drift the pin exists
to prevent.

Corpus 16 positives / 24 negative confirmations, 11/11 requirements, 19 rules,
17 load-bearing codes. Bar green: validator self-test and repo mode, 132
manifest digests, openspec 54/54, doc-health with zero new findings.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Copilot AI lite review requested due to automatic review settings August 8, 2026 02:34
@brettheap

Copy link
Copy Markdown
Contributor Author

@codex review

@sourcery-ai sourcery-ai 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.

Hi @brettheap! 👋

Your private repo does not have access to Sourcery.

Please upgrade to continue using Sourcery ✨

@brettheap
brettheap merged commit 76e4d0b into main Aug 8, 2026
1 check passed
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep them coming!

Reviewed commit: 2486436055

ℹ️ 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".

Copilot AI 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.

Pull request overview

Hardens the openxWallet contract validator (scripts/validate-openxwallet.py) and its evidence corpus by closing adversarially found fail-open paths (and one crash), and by adding new negative confirmations/red-proof coverage to make those gaps permanently regression-tested.

Changes:

  • Tighten validator semantics around custody collapse, exercise↔grant binding, declared custody closed-set enforcement, posture attenuation, and proof-of-possession verdict handling.
  • Improve validator robustness/coverage: key-material detection (PEM label variants + serialized JWK), timezone-naive timestamp parsing, repo-scan indexing, and negative-fixture header parsing.
  • Expand evidence/traceability and documentation to reflect new probes, finding codes, and counts.

Reviewed changes

Copilot reviewed 15 out of 15 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
specs/006-openxwallet-contracts/traceability.yaml Adds new probes and a review_hardening audit trail; updates corpus counts
specs/006-openxwallet-contracts/evidence/red-proof-output.txt Updates red-proof results for new load-bearing codes
scripts/validate-openxwallet.py Implements new/strengthened validator rules and fixes repo-scan + timestamp + key-material detection gaps
ideation/staging/INDEX.md Updates staged-topic record to reflect new negative-confirmation count
contracts/README.md Updates contract catalog entry to reflect new rule/negative counts
contracts/CHANGELOG.md Updates release narrative counts (rules, negatives, codes)
contracts/openxwallet/examples/negative/wallet-custody-outside-the-closed-set.yaml New negative probe for wallet-declared custody closed-set enforcement
contracts/openxwallet/examples/negative/wallet-carries-jwk-private-exponent.yaml New negative probe for serialized JWK private exponent detection
contracts/openxwallet/examples/negative/grant-derived-waives-parent-approval.yaml New negative probe for posture attenuation widening
contracts/openxwallet/examples/negative/exercise-permitted-on-unverified-proof.yaml New negative probe for “presented but unverified/absent verdict” fail-open
contracts/openxwallet/examples/negative/exercise-omits-a-declared-constraint.yaml New negative probe for constraint omission fail-open
contracts/openxwallet/examples/negative/exercise-by-a-wallet-the-grant-does-not-address.yaml New negative probe for exercise audience binding
contracts/openxwallet/examples/negative/custody-registry-environment-outranks-holder.yaml New negative probe for custody collapse gap (evidences-based)
contracts/openxwallet/examples/negative/custody-registry-collapsed-ceilings.yaml Updates expected-failure detail pin to match revised collapse error wording
contracts/openxwallet/examples/exercise-unattributable-act.example.yaml Updates example to align custody-in-force with strengthened custody semantics

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

# (e) custody caps authority.
wallet_ref = (doc.get("audience") or {}).get("wallet_ref")
resolved = ctx.ceiling_for_wallet(wallet_ref) if wallet_ref else None
if wallet_ref and resolved is None and ctx.wallets:
Comment on lines +1131 to 1134
if "examples" in path.parts and any(
part in ("openxwallet", "openxwallet-agent-profile")
for part in path.parts):
continue
Comment on lines +1153 to 1162
# INDEX FIRST, then validate. Without this the cross-record rules — the
# custody ceiling, attenuation, revocation through the chain, the audience
# binding — resolved only against the packaged corpus and were therefore
# inert on every real artifact, while legitimate parent/child pairs inside
# the scanned repo reported spurious unresolved-reference findings.
for _, doc in found:
ctx.index(doc)
for path, doc in found:
scanned += 1
validate_record(f, str(path), doc, docs, ctx)
review_hardening:
pass: adversarial review of the validator, 2026-08-08, before any consumer adopted the family
finding: >-
The checks were sound on the shapes they examined and had four fail-open
Comment on lines +17 to +27
holder:
holder_id: agent:ledger-jwk
holder_class: agent
key_reference:
did: "did:web:xforge.us:wallets:agent-jwk"
key_id: key-jwk-0009
signature_algorithm: ed25519
custody:
model: holder_readable
registry_version: 1
declared_by: '{"kty":"OKP","crv":"Ed25519","x":"11qYAYKxCrfVS_7TyWQHOg7hcvPapiMlrwIaaPcHURo","d":"nWGxne_9WmC6hEr0kuwsxERJxWl7MmkZcDusAxyuf2A"}'
brettheap pushed a commit that referenced this pull request Aug 8, 2026
The release digest inventory for the bundle registered at the
contract-v1.31 changelog entry: the openxWallet holder-agnostic core
(six kinds, closed custody registry) and its first profile (the agent
composition record), realized by Speckit feature
006-openxwallet-contracts through PRs #115, #116 and #120 — landing,
validator hardening, and the docs-truth pass that followed the third
adversarial review. The new families' per-file digests are carried by
contracts/manifest.yaml inside this inventory, per the v1.30
convention; the packaged corpus and validator are content-addressed by
the release commit.

Co-Authored-By: Claude Fable 5 <[email protected]>
@brettheap
brettheap deleted the fix/openxwallet-validator-holes branch August 24, 2026 20:17
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.

2 participants