Startup secret check: compare the salt and every secret pair in normalised form #69
Labels
No labels
boundary:crosses
bug
enhancement
epic
needs-info
needs-triage
ready-for-agent
ready-for-human
svd:go
svd:hold
wontfix
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
dev/messages-mind-mcp#69
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The startup secret check compares the tombstone salt with the store key only in raw form. A salt file that holds the key in upper case, with a space before it, or with two newlines after it passes
check,syncandforget. Only an exact copy is refused. Found by the correctness and the security review of PR #67; split out of #68 at triage, because it is the most important item there.What the code does now (
mainat99a849c)read_key_file(src/messages_mind_mcp/store.py:136-143) strips whitespace and folds hex to lower case.read_secret_file(src/messages_mind_mcp/kit/secrets.py:18-42) returns raw bytes. It removes one trailing newline only. The salt and every token go through it.startup.py:127-136compares every pair in raw form. A second loop compares each token'sstrip().lower()form with the key. The salt has no such comparison, and no pair other than token and key is compared in normalised form.A reproduction with synthetic files and the shipped readers and
first_equal:README.md:401andSECURITY.md:66say thattokens-equalcompares "the value of every secret". The documents claim more than the code does.Decisions
strip().lower()form) and the tombstone salt, including the salt against the key".tombstones.py:44-50). Do not change the salt thatSecretsholds or that the Tombstone functions receive: a change of the HMAC input changes every existing Tombstone hash and the salt check.Acceptance criteria
check,syncandforgetrefuse withsecret=error code=tokens-equal at=store.key_file,store.tombstone_salt_filewhen the salt file holds the key in upper case, the key with whitespace before or after it, or the key and an extra newline.Secrets.saltequals the bytes thatread_secret_filereturns for the salt file. A test asserts this.test_a_token_equal_to_another_secret_is_refused(tests/test_config_cli.py) or sit beside it.README.mdandSECURITY.mdsay thattokens-equalcompares every pair in normalised form, and say what the normalised form is.make checkpasses. Synthetic data only.Primary files
src/messages_mind_mcp/startup.pysrc/messages_mind_mcp/kit/scopes.pytests/test_config_cli.pyREADME.mdSECURITY.mdHuman act
ruling: the operator approves dispatch with
svd:goand names T4 for the merge of this secret-check change (CONV-40)Blocked by
Sequencing
#56 is at its gate with spec base
99a849cand writestests/test_config_cli.py,README.mdandSECURITY.md. This issue goes after #56 merges and before #65, which also writesstartup.py.Filed under: operator word "accept" sha256:c125d0397b60
⏸ SVD architect gate: dev/messages-mind-mcp#69 startup-secret-check-compare-the-salt-and-every-secret-pair
Status: CLEAN after 0 rework round(s) · 0 blocking defect(s) · 0 lens(es) INCONCLUSIVE (could not run) · 0 lens(es) DEGRADED (deterministic denial) · complexity
standard· dispatch effortmediumRun:
20261115T135627Z-5777e317Held because: CLEAN but 3 open risk(s) (1 sequencing · 1 verification · 1 decision) — HOLD-ALL parks everything. The risks, verbatim:
Open risks:
0486d0acarries 'Closes #56' and is this spec's base. Nothing else blocks dispatch. #65 also writes startup.py and must dispatch after this PR merges. If #65 lands first, the drift guard halts on startup.py and this spec needs a codex-svd rebaseline. [sequencing — blocked by #56]0486d0abefore the first edit and again on the PR head. Record both passed/skipped counts in the PR body and confirm the failure set is unchanged apart from the new and updated tests passing. [verification]Change: In kit/scopes.py, add
normalised(value: bytes) -> bytes=value.strip(b" \t\n\r\x0b\x0c").lower()besidefirst_equal(scopes.py:38-46). Makefirst_equalnormalise each entry once, then compare every pair with hmac.compare_digest. Keep the same pair order, keep no early exit, and keep n(n-1)/2 comparisons. In startup.py, keep thelabelledlist (121-130) and its singlefirst_equalcall (131), and delete the str-based token-vs-key loop (132-136). The rawsaltstill goes to Secrets (150). Do not touch Tokens.post_init or Tokens.match. Extend test_a_token_equal_to_another_secret_is_refused (test_config_cli.py:1947-1991) with a refusing-verbs column and 10 new normalised cases: salt-key upper/leading/trailing/newline, salt-token, and token-token. Add a raw-salt test. Unit-testnormalisedin test_kit.py. Rewrite the identical tokens-equal sentence at README.md:401 and SECURITY.md:66 to define the normalised form, and update the pinned assertion in tests/test_feed.py:484-498.Files:
src/messages_mind_mcp/kit/scopes.py·src/messages_mind_mcp/startup.py·tests/test_config_cli.py·tests/test_kit.py·tests/test_feed.py·README.md·SECURITY.mdDecision: accept the 3 open risk(s) above and dispatch this spec (
svd:go), or park (svd:skip) / re-spec (svd:respec)?Your call (when this issue is held at the gate via
svd:hold):svd:go— approve; Half-B dispatch accepts exactly this spec (open risks accepted)svd:firebesidesvd:go— approve AND authorise the Half-B fire from the phone; never on its ownsvd:skip— park it; dispatch refuses it and the issue stays for a humansvd:respec— discard this spec; the next Half-A run re-produces it with this record as prior-attempt contextSpec:
/Users/piers/.local/state/exhaust/groupthink/specs/2026-11-15-startup-secret-check-compare-the-salt-and-every-secret-pair.md— next:codex-svd dispatch --args '<same-json>' --approved-spec-path /Users/piers/.local/state/exhaust/groupthink/specs/2026-11-15-startup-secret-check-compare-the-salt-and-every-secret-pair.mdspec-verify-dispatch Half B for dev/messages-mind-mcp#69 startup-secret-check-compare-the-salt-and-every-secret-pair completed integration verify.
1eac95853eCloses #69and the passed/skipped counts. Host make check on the PR head: 1372 passed, 58 skipped, 2 deselected. The base was not re-measured here.codex-svd ship --run-id 20261115T141029Z-f6ff7503 --confirm-merge)spec-verify-dispatch Half B for dev/messages-mind-mcp#69 startup-secret-check-compare-the-salt-and-every-secret-pair completed integration verify.
1eac95853e1eac958: ci/woodpecker/pr/validation green. Local make check passed with 1374 passed and 58 skipped. No blockers.codex-svd ship --run-id 20261115T141029Z-f6ff7503 --confirm-merge)spec-verify-dispatch Half B for dev/messages-mind-mcp#69 startup-secret-check-compare-the-salt-and-every-secret-pair completed integration verify.
6a7dde90226a7dde9: Woodpecker ci/woodpecker/pr/validation pending. Local: ruff, format, mypy clean; pytest 1372 passed, 58 skipped, 2 deselected. Blocker: PR body lacks the required 'Boot refusal' line.Closes #69.' PR #76 body has Closes #69 but grep -ci 'boot refusal' returns 0.