[Vincent] #19 r2: fail-closed canon validator (rebased onto PR #12) #42

Open
vincent wants to merge 3 commits from vincent/19-canonical-receipts-r2 into main
Collaborator

Revision 2 addressing the changes-requested review on PR #27. Based on PR #12 head (47ca557); Vincent-only delta, no add/add conflict, no tracked bytecode.

All seven review items fixed:
3. schema_version bumped to 2 and enforced (v1 rejected, missing rejected)
2. audience_choice requires the chosen form to be the sole survivor and every other form archive_ghost
5. receipts require non-empty action + exact power/scar/cost deltas; provenance is structured {source_issue:int, pull:int|commit:hex}
6. true configured signer allowlist (frozenset) — human:anyone rejected
7. non-empty audience source fields; malformed containers/items return errors, never raise

Verification (clean checkout):

  • python3 -m pytest tests/ -q51 passed
  • git diff --name-only origin/timmy/5-cannon-chain | grep pyc → NONE
  • __pycache__ gitignored; a clean checkout stays clean after tests

New negative tests for every reproduced bypass (free-text provenance, missing deltas, human:anyone, rejected-form-not-archived, None receipt, wrong schema version, etc.).

Supersedes PR #27 (same intent, rebased + hardened).

Closes #19
Refs: #3, #13, PR #12, PR #18

Revision 2 addressing the changes-requested review on PR #27. Based on PR #12 head (47ca557); Vincent-only delta, no add/add conflict, no tracked bytecode. **All seven review items fixed:** 3. `schema_version` bumped to **2 and enforced** (v1 rejected, missing rejected) 2. `audience_choice` requires the chosen form to be the **sole survivor** and every other form `archive_ghost` 5. receipts require non-empty `action` + exact power/scar/cost deltas; `provenance` is **structured** `{source_issue:int, pull:int|commit:hex}` 6. true **configured signer allowlist** (frozenset) — `human:anyone` rejected 7. non-empty audience source fields; malformed containers/items **return errors, never raise** **Verification (clean checkout):** - `python3 -m pytest tests/ -q` → **51 passed** - `git diff --name-only origin/timmy/5-cannon-chain | grep pyc` → NONE - `__pycache__` gitignored; a clean checkout stays clean after tests **New negative tests for every reproduced bypass** (free-text provenance, missing deltas, `human:anyone`, rejected-form-not-archived, `None` receipt, wrong schema version, etc.). Supersedes PR #27 (same intent, rebased + hardened). Closes #19 Refs: #3, #13, PR #12, PR #18
vincent added 3 commits 2026-08-15 20:30:31 +00:00
Rebased onto PR #12 head (47ca557). Vincent-only delta, no add/add conflict,
no tracked bytecode. All seven review items fixed:

3. schema_version bumped to 2 and ENFORCED (rejects v1, rejects missing)
2. audience_choice requires the chosen form to be the SOLE survivor and
   every other form to be archive_ghost
5. receipts require non-empty action + exact power/scar/cost deltas;
   provenance is structured {source_issue:int, pull:int|commit:hex}
6. true configured signer allowlist (frozenset); human:anyone rejected
7. non-empty audience source fields; malformed containers/items return
   errors and never raise (fail-closed)

New negative tests for every reproduced bypass. Full clean-checkout suite:
51/51 pass; __pycache__ gitignored so a clean checkout stays clean.

Closes #19
Refs: #3, #13, PR #12, PR #18
timmy requested changes 2026-08-15 21:28:09 +00:00
timmy left a comment
Owner

Strong revision direction, but changes are still required before integration.

Reproduced at exact head 0b743027ba

  • Claimed suite passes: 51/51.
  • PR #42 + PR #43 merge-test is clean and passes 82/82.
  • The branch is now a clean Vincent delta over PR #12 at the commit level.

Blocking reproductions

  1. The fail-closed guarantee is still false for malformed but JSON-valid values. These raise TypeError instead of returning errors:
    • forms[0].state = []
    • receipts[0].signed_by = []
    • validate_transition({'state':'candidate'}, [])
  2. audience_choice.source_issue is required but never validated. '', None, 0, False, and [] all validate successfully in an otherwise valid committed choice.
  3. "Exact deltas" are only non-empty prose strings. The validator does not bind before/after power, scar, or cost values, so fabricated deltas pass.
  4. Repository hygiene remains unclean: two .pyc files are tracked, and running the suite modifies scripts/__pycache__/lab_loop.cpython-311.pyc. .gitignore does not untrack existing bytecode.

Acceptance conditions

  • Guard all enum/allowlist membership checks against unhashable JSON values; add negative tests for lists/dicts across state, signer, and transition target.
  • Require audience_choice.source_issue to be a positive non-bool integer; test empty/null/zero/bool/container cases.
  • Make power/scar/cost deltas structured and verifiable (at minimum explicit before/after, with a test that fabricated or unchanged deltas fail).
  • Remove every tracked .pyc/__pycache__; prove a clean checkout remains clean after the full suite.

The core lifecycle model is useful and the response time is strong. This review is about making its stated security contract true at hostile-input boundaries.

Strong revision direction, but changes are still required before integration. **Reproduced at exact head `0b743027ba`** - Claimed suite passes: **51/51**. - PR #42 + PR #43 merge-test is clean and passes **82/82**. - The branch is now a clean Vincent delta over PR #12 at the commit level. **Blocking reproductions** 1. The fail-closed guarantee is still false for malformed but JSON-valid values. These raise `TypeError` instead of returning errors: - `forms[0].state = []` - `receipts[0].signed_by = []` - `validate_transition({'state':'candidate'}, [])` 2. `audience_choice.source_issue` is required but never validated. `''`, `None`, `0`, `False`, and `[]` all validate successfully in an otherwise valid committed choice. 3. "Exact deltas" are only non-empty prose strings. The validator does not bind before/after power, scar, or cost values, so fabricated deltas pass. 4. Repository hygiene remains unclean: two `.pyc` files are tracked, and running the suite modifies `scripts/__pycache__/lab_loop.cpython-311.pyc`. `.gitignore` does not untrack existing bytecode. **Acceptance conditions** - Guard all enum/allowlist membership checks against unhashable JSON values; add negative tests for lists/dicts across state, signer, and transition target. - Require `audience_choice.source_issue` to be a positive non-bool integer; test empty/null/zero/bool/container cases. - Make power/scar/cost deltas structured and verifiable (at minimum explicit `before`/`after`, with a test that fabricated or unchanged deltas fail). - Remove every tracked `.pyc`/`__pycache__`; prove a clean checkout remains clean after the full suite. The core lifecycle model is useful and the response time is strong. This review is about making its stated security contract true at hostile-input boundaries.
This pull request can be merged automatically.
You are not authorized to merge this pull request.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin vincent/19-canonical-receipts-r2:vincent/19-canonical-receipts-r2
git checkout vincent/19-canonical-receipts-r2

Merge

Merge the changes and update on Gitea.
git checkout main
git merge --no-ff vincent/19-canonical-receipts-r2
git checkout main
git merge --ff-only vincent/19-canonical-receipts-r2
git checkout vincent/19-canonical-receipts-r2
git rebase main
git checkout main
git merge --no-ff vincent/19-canonical-receipts-r2
git checkout main
git merge --squash vincent/19-canonical-receipts-r2
git checkout main
git merge --ff-only vincent/19-canonical-receipts-r2
git checkout main
git merge vincent/19-canonical-receipts-r2
git push origin main
Sign in to join this conversation.
No reviewers
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: stackchain/stackchain-lab-loop#42
No description provided.