Sync: the api must not read the Feeder token #31

Closed
opened 2026-11-13 06:05:59 +00:00 by svc-agent-writer · 2 comments

Parent: #6. Records: ADR 0004 (docs/adr/0004-source-mac-and-feeder-network-face.md), SECURITY.md, the token table in README.md.

What to build

The Feeder token is the only credential for the Feeder (ADR 0004). The token table in the README gives it to sync and to no other process.

The code from #12 does not hold that line. start() in src/messages_mind_mcp/startup.py reads feeder.token_file for every verb when the config holds [feeder]. An api process with such a config holds the Feeder token in memory and never uses it. A fault in the api could then expose a credential that the api has no need for.

  • start() reads the Feeder token only for the verbs that need it. sync uses the token. check validates the token file.
  • The api verb does not open feeder.token_file, also when the config holds [feeder]. Secrets.feeder_token is None in an api process.
  • The check that refuses a write-token file does not change for any verb.
  • README.md and SECURITY.md state which verb opens which secret file. They state that the api never opens the Feeder token file.

Acceptance criteria

  • A test proves that the api verb does not open feeder.token_file: the config holds [feeder], the token file is absent, the start succeeds and feeder_token is None.
  • A test proves that sync and check refuse a Feeder token file that is absent, shorter than 32 characters or open to another user. The output holds a code and the location feeder.token_file, and no part of the file.
  • A test proves that check with [feeder] still validates the token file and makes no request.
  • No output line and no log line of any verb holds the Feeder token.
  • The README token table and SECURITY.md agree with the code.

Blocked by

  • none

Filed under: operator word "go" sha256:4cd0e21a9a07

Parent: #6. Records: ADR 0004 (`docs/adr/0004-source-mac-and-feeder-network-face.md`), `SECURITY.md`, the token table in `README.md`. ## What to build The Feeder token is the only credential for the Feeder (ADR 0004). The token table in the README gives it to `sync` and to no other process. The code from #12 does not hold that line. `start()` in `src/messages_mind_mcp/startup.py` reads `feeder.token_file` for every verb when the config holds `[feeder]`. An `api` process with such a config holds the Feeder token in memory and never uses it. A fault in the api could then expose a credential that the api has no need for. - `start()` reads the Feeder token only for the verbs that need it. `sync` uses the token. `check` validates the token file. - The `api` verb does not open `feeder.token_file`, also when the config holds `[feeder]`. `Secrets.feeder_token` is `None` in an `api` process. - The check that refuses a write-token file does not change for any verb. - `README.md` and `SECURITY.md` state which verb opens which secret file. They state that the api never opens the Feeder token file. ## Acceptance criteria - A test proves that the `api` verb does not open `feeder.token_file`: the config holds `[feeder]`, the token file is absent, the start succeeds and `feeder_token` is `None`. - A test proves that `sync` and `check` refuse a Feeder token file that is absent, shorter than 32 characters or open to another user. The output holds a code and the location `feeder.token_file`, and no part of the file. - A test proves that `check` with `[feeder]` still validates the token file and makes no request. - No output line and no log line of any verb holds the Feeder token. - The README token table and `SECURITY.md` agree with the code. ## Blocked by - none Filed under: operator word "go" sha256:4cd0e21a9a07
Collaborator

⏸ SVD architect gate: dev/messages-mind-mcp#31 sync-the-api-must-not-read-the-feeder-token

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 effort medium

Run: 20261113T090302Z-6f50569f

Held because: CLEAN but 2 open risk(s) (1 verification · 1 decision) — HOLD-ALL parks everything. The risks, verbatim:

Open risks:

  1. Other least-privilege gaps stay unfixed and are only documented. sync opens auth.read_token_file and auth.evidence_token_file (when [auth] is set) and never uses them. api opens store.tombstone_salt_file and never uses it. #31 covers only the Feeder token. Question: should a follow-up issue gate those reads by verb too, generalising FEEDER_TOKEN_VERBS to a per-secret verb map? [decision]
  2. The new tests and make check could not run in the read-only Half-A sandbox. After dispatch, check that the Woodpecker validation lane (make check) is green on the PR branch, and that the five new tests in tests/test_config_cli.py report as passed in that run. [verification]

Change: Extend the existing conditional-read pattern in start() at src/messages_mind_mcp/startup.py:57-71. Add type Verb = Literal["check","api","sync"] and FEEDER_TOKEN_VERBS: Final = frozenset({"check","sync"}). Make verb a required parameter: start(config_path, verb). Gate the feeder.token_file read with cfg.feeder is not None and verb in FEEDER_TOKEN_VERBS, so it fails closed. Leave refuse_write_token_files and Config.secret_files() unchanged: every verb still lists the Feeder token's directory. cli.py:69 passes args.verb. Update all 8 start() calls in tests/test_config_cli.py. Add tests for:

  • api with [feeder] and the token absent: start succeeds, feeder_token is None, and an os.open spy records no open of the token path;
  • sync and check refuse an absent, short or 0644 token with secret=error code=<c> at=feeder.token_file;
  • check with [feeder] validates the token and makes no connect (mirror the socket.connect recorder at test_sync.py:517-542);
  • no verb prints or logs the token;
  • a doc-agreement test derived from FEEDER_TOKEN_VERBS (mirror test_layout.py:109-121).
    README and SECURITY.md each get a which-verb-opens-which-secret-file statement, and both contain "The api never opens the Feeder token file."

Files: src/messages_mind_mcp/startup.py · src/messages_mind_mcp/cli.py · tests/test_config_cli.py · README.md · SECURITY.md

Decision: accept the 2 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):

  • add label svd:go — approve; Half-B dispatch accepts exactly this spec (open risks accepted)
  • add label svd:fire beside svd:go — approve AND authorise the Half-B fire from the phone; never on its own
  • add label svd:skip — park it; dispatch refuses it and the issue stays for a human
  • add label svd:respec — discard this spec; the next Half-A run re-produces it with this record as prior-attempt context

Spec: /Users/piers/.local/state/exhaust/groupthink/specs/2026-11-13-sync-the-api-must-not-read-the-feeder-token.md — next: codex-svd dispatch --args '<same-json>' --approved-spec-path /Users/piers/.local/state/exhaust/groupthink/specs/2026-11-13-sync-the-api-must-not-read-the-feeder-token.md

### ⏸ SVD architect gate: dev/messages-mind-mcp#31 sync-the-api-must-not-read-the-feeder-token **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 effort `medium` **Run:** `20261113T090302Z-6f50569f` **Held because:** CLEAN but 2 open risk(s) (1 verification · 1 decision) — HOLD-ALL parks everything. The risks, verbatim: **Open risks:** 1. Other least-privilege gaps stay unfixed and are only documented. sync opens auth.read_token_file and auth.evidence_token_file (when [auth] is set) and never uses them. api opens store.tombstone_salt_file and never uses it. #31 covers only the Feeder token. Question: should a follow-up issue gate those reads by verb too, generalising FEEDER_TOKEN_VERBS to a per-secret verb map? [decision] 2. The new tests and make check could not run in the read-only Half-A sandbox. After dispatch, check that the Woodpecker `validation` lane (`make check`) is green on the PR branch, and that the five new tests in tests/test_config_cli.py report as passed in that run. [verification] **Change:** Extend the existing conditional-read pattern in start() at src/messages_mind_mcp/startup.py:57-71. Add `type Verb = Literal["check","api","sync"]` and `FEEDER_TOKEN_VERBS: Final = frozenset({"check","sync"})`. Make `verb` a required parameter: start(config_path, verb). Gate the feeder.token_file read with `cfg.feeder is not None and verb in FEEDER_TOKEN_VERBS`, so it fails closed. Leave refuse_write_token_files and Config.secret_files() unchanged: every verb still lists the Feeder token's directory. cli.py:69 passes args.verb. Update all 8 start() calls in tests/test_config_cli.py. Add tests for: - api with [feeder] and the token absent: start succeeds, feeder_token is None, and an os.open spy records no open of the token path; - sync and check refuse an absent, short or 0644 token with `secret=error code=<c> at=feeder.token_file`; - check with [feeder] validates the token and makes no connect (mirror the socket.connect recorder at test_sync.py:517-542); - no verb prints or logs the token; - a doc-agreement test derived from FEEDER_TOKEN_VERBS (mirror test_layout.py:109-121). README and SECURITY.md each get a which-verb-opens-which-secret-file statement, and both contain "The api never opens the Feeder token file." **Files:** `src/messages_mind_mcp/startup.py` · `src/messages_mind_mcp/cli.py` · `tests/test_config_cli.py` · `README.md` · `SECURITY.md` **Decision:** accept the 2 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`): - add label `svd:go` — approve; Half-B dispatch accepts exactly this spec (open risks accepted) - add label `svd:fire` **beside** `svd:go` — approve AND authorise the Half-B fire from the phone; never on its own - add label `svd:skip` — park it; dispatch refuses it and the issue stays for a human - add label `svd:respec` — discard this spec; the next Half-A run re-produces it with this record as prior-attempt context <sub>Spec: `/Users/piers/.local/state/exhaust/groupthink/specs/2026-11-13-sync-the-api-must-not-read-the-feeder-token.md` — next: `codex-svd dispatch --args '<same-json>' --approved-spec-path /Users/piers/.local/state/exhaust/groupthink/specs/2026-11-13-sync-the-api-must-not-read-the-feeder-token.md`</sub>
Collaborator

spec-verify-dispatch Half B for dev/messages-mind-mcp#31 sync-the-api-must-not-read-the-feeder-token completed integration verify.

  • PR: #34
  • Branch: feat/svd-dev-messages-mind-mcp-31-sync-the-api-must-not-read-30f100cd
  • Commit: 0ff48a76f1
  • Build: none
  • Test: green
  • Reader audit clean: True
  • Spec fidelity: True
  • Ready for merge: True
  • Check ci/woodpecker/pr/validation: green https://ci.groupthink.asia/repos/75/pipeline/12/1
  • Checks: PR #34 head 0ff48a7: ci/woodpecker/pr/validation green. Local: ruff, format, mypy clean; 510 tests passed.
  • Warning: self-review: The missing-directory comment in refuse_write_token_files says a subsequent secret read reports the missing file, which is not always true for the Feeder token under api -> not fixed: the spec explicitly requires refuse_write_token_files to remain unchanged.
  • Decision: review the PR and merge? (codex-svd ship --run-id 20261113T104723Z-30f100cd --confirm-merge)
spec-verify-dispatch Half B for dev/messages-mind-mcp#31 sync-the-api-must-not-read-the-feeder-token completed integration verify. - PR: https://git.groupthink.asia/dev/messages-mind-mcp/pulls/34 - Branch: feat/svd-dev-messages-mind-mcp-31-sync-the-api-must-not-read-30f100cd - Commit: 0ff48a76f130f1700dac231bd3ab511e6db9ca07 - Build: none - Test: green - Reader audit clean: True - Spec fidelity: True - Ready for merge: True - Check ci/woodpecker/pr/validation: green https://ci.groupthink.asia/repos/75/pipeline/12/1 - Checks: PR #34 head 0ff48a7: ci/woodpecker/pr/validation green. Local: ruff, format, mypy clean; 510 tests passed. - Warning: self-review: The missing-directory comment in refuse_write_token_files says a subsequent secret read reports the missing file, which is not always true for the Feeder token under api -> not fixed: the spec explicitly requires refuse_write_token_files to remain unchanged. - Decision: review the PR and merge? (`codex-svd ship --run-id 20261113T104723Z-30f100cd --confirm-merge`)
svc-svd-writer 2026-11-13 11:56:10 +00:00
  • closed this issue
  • removed the
    svd:go
    label
Sign in to join this conversation.
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
dev/messages-mind-mcp#31
No description provided.