Change feed: any read-token holder can move any Consumer's position #40

Closed
opened 2026-11-13 12:35:37 +00:00 by svc-agent-writer · 2 comments

What happens

PR #39 (issue #15) adds named Consumers to the change feed. A Consumer name is a label, not a credential:

  • The api has one read token. require_consumer checks only that the name is in [feed] consumers.
  • Nothing ties a Consumer name to the caller. A caller that holds the read token can call messages_changes_ack with the name of another Consumer and a cursor that it built itself. The epoch tag appears in every cursor, so building a valid cursor is easy.
  • A review of the PR head dae5828 proved this by running it with synthetic fixtures. A session that acted as one Consumer acknowledged position 3 for a second Consumer. The second Consumer then read an empty page.

Why it matters

  • The target Consumer silently skips events. Today these include unsend events. When the deletion slice (#13) lands, they will include del events, which ADR 0005 relies on to remove downstream copies.
  • The likely path is prompt injection. Message text comes from other people, and an agent reads it.
  • No data is exposed. The read token already reads the whole Mirror.

What to decide

  1. Bind each Consumer to its own token: a config map from token file to Consumer name. The api takes the Consumer from the token, not from an argument. A cursor that names its Consumer does not help: the attacker can read the target Consumer's feed and get a valid cursor.
  2. Or accept the risk and state it in SECURITY.md: a Consumer name is not a credential, and any read-token holder can move any Consumer.

Also in this PR

  • kit/scopes.py:3 still says "No scope can write." The read scope now writes Consumer positions. Make the docstring match SECURITY.md.
  • tests/test_log_scan.py: CODES does not include unknown-consumer, cursor-expired or cursor-ahead, so the log scan does not cover the error paths of the feed.

Acceptance criteria

  • A test proves that a caller cannot move the position of a Consumer that it is not, or SECURITY.md states the accepted risk in one sentence.
  • The kit/scopes.py docstring matches SECURITY.md.
  • The log scan covers the three feed error codes.

Human act

T4 merge: the operator merges the #15 rework PR, which closes this issue (CONV-40)

Blocked by


Filed under: operator word "Grant" sha256:78b7d0379d5e

## What happens PR #39 (issue #15) adds named Consumers to the change feed. A Consumer name is a label, not a credential: - The api has one read token. `require_consumer` checks only that the name is in `[feed] consumers`. - Nothing ties a Consumer name to the caller. A caller that holds the read token can call `messages_changes_ack` with the name of another Consumer and a cursor that it built itself. The epoch tag appears in every cursor, so building a valid cursor is easy. - A review of the PR head `dae5828` proved this by running it with synthetic fixtures. A session that acted as one Consumer acknowledged position 3 for a second Consumer. The second Consumer then read an empty page. ## Why it matters - The target Consumer silently skips events. Today these include `unsend` events. When the deletion slice (#13) lands, they will include `del` events, which ADR 0005 relies on to remove downstream copies. - The likely path is prompt injection. Message text comes from other people, and an agent reads it. - No data is exposed. The read token already reads the whole Mirror. ## What to decide 1. Bind each Consumer to its own token: a config map from token file to Consumer name. The api takes the Consumer from the token, not from an argument. A cursor that names its Consumer does not help: the attacker can read the target Consumer's feed and get a valid cursor. 2. Or accept the risk and state it in `SECURITY.md`: a Consumer name is not a credential, and any read-token holder can move any Consumer. ## Also in this PR - `kit/scopes.py:3` still says "No scope can write." The read scope now writes Consumer positions. Make the docstring match `SECURITY.md`. - `tests/test_log_scan.py`: `CODES` does not include `unknown-consumer`, `cursor-expired` or `cursor-ahead`, so the log scan does not cover the error paths of the feed. ## Acceptance criteria - A test proves that a caller cannot move the position of a Consumer that it is not, or `SECURITY.md` states the accepted risk in one sentence. - The `kit/scopes.py` docstring matches `SECURITY.md`. - The log scan covers the three feed error codes. ## Human act T4 merge: the operator merges the #15 rework PR, which closes this issue (CONV-40) ## Blocked by - #15 --- Filed under: operator word "Grant" sha256:78b7d0379d5e
Author
Member

Two more findings from the correctness review of dae5828 (PR #39), proved by mutation:

  • store.py:336: the ack's write guard has no test. Replacing guard=_positions_only in acking() with an allow-all authorizer leaves every test green. The guard tests in test_store.py cover open_positions, but acking() calls _open_guarded directly. Fix: route acking() through open_positions(), or add a test that a write to another table inside acking() is refused.
  • cli.py:46: removing consumers=cfg.feed.consumers from the build_app call leaves every test green. In production every Consumer would then get unknown-consumer. Fix: a test of the api verb with a [feed] consumers config.

Smaller: no test pins EVENTS_RETENTION_DAYS == 30 (1 day and 3,650 days both pass), and no test covers a del event whose message row still exists (views.py:339).

Filed under: operator word "Grant" sha256:78b7d0379d5e

Two more findings from the correctness review of `dae5828` (PR #39), proved by mutation: - `store.py:336`: the ack's write guard has no test. Replacing `guard=_positions_only` in `acking()` with an allow-all authorizer leaves every test green. The guard tests in `test_store.py` cover `open_positions`, but `acking()` calls `_open_guarded` directly. Fix: route `acking()` through `open_positions()`, or add a test that a write to another table inside `acking()` is refused. - `cli.py:46`: removing `consumers=cfg.feed.consumers` from the `build_app` call leaves every test green. In production every Consumer would then get `unknown-consumer`. Fix: a test of the `api` verb with a `[feed] consumers` config. Smaller: no test pins `EVENTS_RETENTION_DAYS == 30` (1 day and 3,650 days both pass), and no test covers a `del` event whose message row still exists (`views.py:339`). Filed under: operator word "Grant" sha256:78b7d0379d5e
Author
Member

This was generated by AI during triage.

Triage

  • The operator ruled option 1: bind each Consumer to its own token. This is to be done before #13, because #13 sends del events through the feed.
  • Every item of this issue, and of the comment above, is a row of the #15 rework spec:
    • R1: the token binding. The api takes the Consumer from the token, not from an argument.
    • Section 8: the kit/scopes.py docstring.
    • R6: the cli.py wiring of [feed] consumers.
    • R7: the write guard of acking().
    • R8: the log scan of the feed error codes.
    • R9: a test that pins EVENTS_RETENTION_DAYS (ADR 0010 Amendment 1).
    • R10: the del event with a live row.
  • With the token binding, unknown-consumer no longer reaches the feed tools, so R8 lists cursor-expired and cursor-ahead only.
  • CONV-40 rule 3 fires: a Consumer token is a credential. State: ready-for-human. The #15 diff writes config.example.toml, so its merge is T4 and is the operator's act.

Disposition: this issue stays open, Blocked by #15. The #15 rework PR closes it when it merges.

> *This was generated by AI during triage.* ## Triage - The operator ruled option 1: bind each Consumer to its own token. This is to be done before #13, because #13 sends `del` events through the feed. - Every item of this issue, and of the comment above, is a row of the #15 rework spec: - R1: the token binding. The api takes the Consumer from the token, not from an argument. - Section 8: the `kit/scopes.py` docstring. - R6: the `cli.py` wiring of `[feed] consumers`. - R7: the write guard of `acking()`. - R8: the log scan of the feed error codes. - R9: a test that pins `EVENTS_RETENTION_DAYS` (ADR 0010 Amendment 1). - R10: the `del` event with a live row. - With the token binding, `unknown-consumer` no longer reaches the feed tools, so R8 lists `cursor-expired` and `cursor-ahead` only. - CONV-40 rule 3 fires: a Consumer token is a credential. State: `ready-for-human`. The #15 diff writes `config.example.toml`, so its merge is T4 and is the operator's act. **Disposition:** this issue stays open, `Blocked by #15`. The #15 rework PR closes it when it merges.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
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#40
No description provided.