Tests: the proof that the api does not open the Feeder token file misses two ways to open it #36

Closed
opened 2026-11-13 11:38:09 +00:00 by svc-agent-writer · 1 comment

Parent: #6. Records: ADR 0006 (docs/adr/0006-retention-deletion-and-forget.md), SECURITY.md, and the table "Which verb opens which secret file" in README.md.

What happens

The test test_the_api_does_not_open_the_feeder_token_file in tests/test_config_cli.py came with #31. It proves less than its name says. A review made two changes to a copy of the code, and the full suite still passed after each one:

  • start() read the Feeder token file with Path.read_text() under the api verb. The test replaces only os.open, and the built-in open does not go through that name.
  • cli._api read the Feeder token file. The test replaces cli._api, so no code after start() runs under the check.

The shipped code does not open the file on either path. The fault is in the strength of the test.

Two statements in the documents are also incomplete:

  • README.md says that api starts when the Feeder token file is absent. It does not say that api also starts when the file is too short or readable by another user. check and sync still refuse such a file.
  • README.md and SECURITY.md say that the api never opens the file. They do not say that the api process is still able to read it: it runs as the same service user, and the config names the path.

What to build

  • Record file opens with an audit hook (sys.addaudithook, the open event) in place of the os.open replacement.
  • Run the real _api in that test, with only server.serve replaced.
  • Add the two missing statements to the documents.

#33 builds the same proof for every secret file. If #33 takes this method, close this issue with a reference to it.

Acceptance criteria

  • The test fails when start() reads the Feeder token file with the built-in open under the api verb.
  • The test fails when _api reads the Feeder token file.
  • README.md states what api does with a Feeder token file that is absent, too short or readable by another user.
  • README.md and SECURITY.md state that "never opens" is a behaviour of the code, and that the file permissions do not separate the api from the file.

Blocked by

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

Parent: #6. Records: ADR 0006 (`docs/adr/0006-retention-deletion-and-forget.md`), `SECURITY.md`, and the table "Which verb opens which secret file" in `README.md`. ## What happens The test `test_the_api_does_not_open_the_feeder_token_file` in `tests/test_config_cli.py` came with #31. It proves less than its name says. A review made two changes to a copy of the code, and the full suite still passed after each one: - `start()` read the Feeder token file with `Path.read_text()` under the `api` verb. The test replaces only `os.open`, and the built-in `open` does not go through that name. - `cli._api` read the Feeder token file. The test replaces `cli._api`, so no code after `start()` runs under the check. The shipped code does not open the file on either path. The fault is in the strength of the test. Two statements in the documents are also incomplete: - `README.md` says that `api` starts when the Feeder token file is absent. It does not say that `api` also starts when the file is too short or readable by another user. `check` and `sync` still refuse such a file. - `README.md` and `SECURITY.md` say that the api never opens the file. They do not say that the api process is still able to read it: it runs as the same service user, and the config names the path. ## What to build - Record file opens with an audit hook (`sys.addaudithook`, the `open` event) in place of the `os.open` replacement. - Run the real `_api` in that test, with only `server.serve` replaced. - Add the two missing statements to the documents. #33 builds the same proof for every secret file. If #33 takes this method, close this issue with a reference to it. ## Acceptance criteria - The test fails when `start()` reads the Feeder token file with the built-in `open` under the `api` verb. - The test fails when `_api` reads the Feeder token file. - `README.md` states what `api` does with a Feeder token file that is absent, too short or readable by another user. - `README.md` and `SECURITY.md` state that "never opens" is a behaviour of the code, and that the file permissions do not separate the api from the file. ## Blocked by - #31 Filed under: operator word "Grant" sha256:78b7d0379d5e
Author
Member

Done by PR #41 (b5413cf, issue #33):

  • Every "does not open" test now records Python open audit events, so the built-in open, io.open and os.open are all seen. The api tests run the real _api, with only server.serve stubbed. A self-test proves the recorder.
  • The README states that api starts when the Feeder token file is absent, too short or open to another user. SECURITY.md states that "never opens" describes the code, not a permission boundary.

What remains (a positive control, path resolution, C-level opens) is in #42.

Filed under: operator word "Accept. Proceed" (2026-11-14)

Done by PR #41 (`b5413cf`, issue #33): - Every "does not open" test now records Python `open` audit events, so the built-in `open`, `io.open` and `os.open` are all seen. The api tests run the real `_api`, with only `server.serve` stubbed. A self-test proves the recorder. - The README states that `api` starts when the Feeder token file is absent, too short or open to another user. `SECURITY.md` states that "never opens" describes the code, not a permission boundary. What remains (a positive control, path resolution, C-level opens) is in #42. Filed under: operator word "Accept. Proceed" (2026-11-14)
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#36
No description provided.