Skip to content

feat(preauth): envelope checker slice (scripts/preauth.py and policy) - #50

Draft
mojomast wants to merge 3 commits into
mainfrom
feat/preauth-envelope
Draft

mojomast wants to merge 3 commits into
mainfrom
feat/preauth-envelope

Conversation

@mojomast

Copy link
Copy Markdown
Owner

Slice for the approved preauth-envelope contract c413827ed596969626234b6ea5d296a81d46f4df05f7787afe5ec12156601872 (owner: approved: c413827e; supersedes 5c22cbf3). Bee attempt att_acba65aca9441b6b (deepseek-v4.1-flash), dispatched in contract mode (preflight: tier high). Branch is feat/preauth-envelope = the RED commit 8b1fcda2 plus one bee commit touching only scripts/preauth.py, policy/preauth.md, policy/README.md and schemas/preauth.schema.json.

Coordinator verification: the 98 approved tests in tests/test_preauth_envelope.py and test_preauth_policy.py pass; the full suite passes (459); the frozen verifier scripts/preauth_verify.py (sha256 prefix 0a3ab62b), policy/allowed_signers, tests and fixtures are untouched; gitleaks clean.

Depends on lease PR #48 being reviewed and merged first (the lease-tamper gate resolves the lease from the base branch). Coordinator-authored and security-critical: needs an independent review by someone other than the coordinator. Draft on purpose. Do not merge before that review.

MR.INDIA and others added 2 commits November 27, 2026 19:42
… only)

Byte-identical tree to 1e3788b (the contract's source_rev) minus the five unapproved draft contracts (r1-r5) that branch carries under .rizzstack/contracts. Lets the slice branch avoid contract-store changes in its own commits.
…t_acba65aca9441b6b]

Slice preauth-envelope (contract c413827e). Verified by the coordinator: the 98 approved tests pass, the full suite passes (459), the frozen verifier scripts/preauth_verify.py is untouched (sha 0a3ab62b...), gitleaks clean, only assigned files changed. Coordinator-authored: needs an independent review.

@mojomast mojomast left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

CHANGES REQUESTED (independent review — outside reviewer GROKCHAT, at owner Kyle's request: AC-005 trust-root whitespace/control-character comment bypass and AC-015/016 path-normalisation bypass) at 672702a

Otherwise sound: the diff against the RED commit touches exactly the 4 assigned files; tests and the frozen verifier (sha256 0a3ab62b...) are untouched; the 98 approved tests pass and the full suite passes (459 incl. 3 skipped). Real-key probes for foreign key, wrong issuer, tampering, each missing fact, option-injection issuers, wrong action, non-descended base, tier and TTL all refuse correctly; the shipped empty trust root refuses.

BLOCKING 1 (AC-005, pin bypass): trust_fingerprints parses the trust root with str.splitlines()/strip()/split(), while ssh-keygen splits on \n and space or tab only. A line that starts with one of \x0c, \x0b, \x1c, U+0085, U+00A0 or U+2028 and then "#," followed by a namespaces option and an unpinned key is a comment to preauth.py but an entry with principal pattern "" to ssh-keygen, so an envelope signed by the unpinned key is accepted while the pin set holds only the owner key. Reproduced with real ssh-keygen. Fix: split on \n only, reject any byte outside printable ASCII except tab, treat a line as a comment only when its first non-space/tab byte is '#', and split fields on space or tab only.

BLOCKING 2 (AC-015/016, oracle fail-open): the re-freeze oracle compares raw dict keys, so non-canonical measured paths ("./tests/x.py", "tests//x.py") or two raw keys that normalise to the same path let a changed frozen test pass as ok. Fix: normalise paths first, refuse collisions, then compare the normalised maps.

Advisories: the pin check uses bytes read once while ssh-keygen re-reads the file by path (TOCTOU); the verifier import resolves via sys.path at runtime (the hash is pinned only in tests); envelope conditions and review are type-checked but never evaluated (wiring must enforce them); regression tests for both blockers need a test-file amendment under a new contract because the tests are frozen.

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