PR #45: the api container gets the tombstone salt, and the deploy tests have gaps #46

Closed
opened 2026-11-13 13:29:56 +00:00 by svc-agent-writer · 2 comments

Two reviews of PR #45 (issue #18, head abd3005) ran before the merge gate. PR CI is green. The PR is held because of item 1.

Blocker

  1. The api container gets the tombstone salt. Since #33 (b5413cf), the api verb never reads the salt file (TOMBSTONE_SALT_VERBS is check and sync; README: "The api never opens the tombstone salt file"). But the deploy files copy it into the api:

    • deploy/k8s/base/messagesmind.yaml:53-58 (the api items of the Secret) and :82 (the api init command);
    • tests/compose_stack.py:28 (the api set of make_secrets).

    A compromised api would then hold the salt and, on the shared data volume, tombstones.db. With both, it can test message guids against the Tombstones and learn which messages were Forgotten (ADR 0006, ADR 0007). The test locks this in: tests/test_deploy.py:29-31 builds PROCESS_SECRETS from cfg.secret_files() (the files that a config names), not from the files that a verb opens. The README and the overlay README say that each process sees only its own secret files.

    Fix: drop tombstone-salt from the api Secret items, the api init command and the api set of make_secrets. api.toml still names the path, because StoreConfig requires it. Build PROCESS_SECRETS from startup.SECRET_FILE_VERBS. Correct the expected stat output in the overlay README.

    Cause: the spec was written before #33, and its rebaseline on b5413cf checked line positions, not the secret sets of each process.

Should fix

  1. compose.yaml: no service sets read_only: true, cap_drop: [ALL] or security_opt: [no-new-privileges:true]. /etc/messagesmind is owned by uid 10001 (Containerfile:13), so a compromised api can write there. Add the three keys and a tmpfs for /tmp, and make /etc/messagesmind owned by root.
  2. compose.yaml:60: the smoke service mounts every api secret, the store key included, but needs only the read token.
  3. deploy/k8s/base/networkpolicy.yaml:11: the ingress rule has no from, so any pod in any namespace can reach port 8420, and the bearer token is the only control. The overlay should add a namespace or pod selector for the proxy, and the README should say so.
  4. tests/test_deploy.py:281: the image pin is not tested. With images: [], kustomize deploys messagesmind, which resolves to docker.io/library/messagesmind:latest. Assert exactly one entry for messagesmind with a digest.
  5. tests/test_deploy.py:98-106, 302: "nothing else" is checked only on the base policy and its patch. An overlay that adds an allow-all NetworkPolicy, an overlay CIDR of 198.0.0.0/8, and a base CIDR of 0.0.0.0/0 all pass. Pin the overlay resources, require /32, and assert that the base CIDR is in 192.0.2.0/24.
  6. tests/test_deploy.py:277: a RUN apt-get install or an ADD https://… in the Containerfile passes. Allow-list every RUN and ADD line.

Notes

  • No .dockerignore. COPY src/… copies host __pycache__ files and host file modes; a checkout made with umask 077 gives files that uid 10001 cannot read.
  • The runtime image keeps bash, apt and pip. The entrypoint python -m adds the working directory to sys.path; -I or -P removes that.
  • fsGroup makes the store files group-writable (0660); consider fsGroupChangePolicy: OnRootMismatch.
  • Mutations that break a run but leak nothing also pass: the compose sync service mounting api.toml, /var/lib/messagesmind missing from the install -d line, a container without the /tmp mount, volumes_from: [api] on smoke, and an exec probe on /healthz/sync.
  • tests/compose_stack.py:89 retries on every exception, so a persistent 401 reports as timeout.
  • Unproven offline, as the spec records: the compose smoke (AC1) and live NetworkPolicy enforcement (AC4).

Acceptance criteria

  • Item 1 is fixed, and a test derives each process's secret set from startup.SECRET_FILE_VERBS.
  • Items 2-7 are fixed, or each has a recorded decision.
  • The compose smoke passes on a host with a container engine.

Human act

eyes-on verify: the compose smoke passes under Podman on the host (CONV-40)

Blocked by


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

Two reviews of PR #45 (issue #18, head `abd3005`) ran before the merge gate. PR CI is green. The PR is held because of item 1. ## Blocker 1. **The api container gets the tombstone salt.** Since #33 (`b5413cf`), the api verb never reads the salt file (`TOMBSTONE_SALT_VERBS` is `check` and `sync`; README: "The api never opens the tombstone salt file"). But the deploy files copy it into the api: - `deploy/k8s/base/messagesmind.yaml:53-58` (the api items of the Secret) and `:82` (the api init command); - `tests/compose_stack.py:28` (the api set of `make_secrets`). A compromised api would then hold the salt and, on the shared data volume, `tombstones.db`. With both, it can test message guids against the Tombstones and learn which messages were Forgotten (ADR 0006, ADR 0007). The test locks this in: `tests/test_deploy.py:29-31` builds `PROCESS_SECRETS` from `cfg.secret_files()` (the files that a config names), not from the files that a verb opens. The README and the overlay README say that each process sees only its own secret files. Fix: drop `tombstone-salt` from the api Secret items, the api init command and the api set of `make_secrets`. `api.toml` still names the path, because `StoreConfig` requires it. Build `PROCESS_SECRETS` from `startup.SECRET_FILE_VERBS`. Correct the expected `stat` output in the overlay README. Cause: the spec was written before #33, and its rebaseline on `b5413cf` checked line positions, not the secret sets of each process. ## Should fix 2. `compose.yaml`: no service sets `read_only: true`, `cap_drop: [ALL]` or `security_opt: [no-new-privileges:true]`. `/etc/messagesmind` is owned by uid 10001 (`Containerfile:13`), so a compromised api can write there. Add the three keys and a `tmpfs` for `/tmp`, and make `/etc/messagesmind` owned by root. 3. `compose.yaml:60`: the smoke service mounts every api secret, the store key included, but needs only the read token. 4. `deploy/k8s/base/networkpolicy.yaml:11`: the ingress rule has no `from`, so any pod in any namespace can reach port 8420, and the bearer token is the only control. The overlay should add a namespace or pod selector for the proxy, and the README should say so. 5. `tests/test_deploy.py:281`: the image pin is not tested. With `images: []`, kustomize deploys `messagesmind`, which resolves to `docker.io/library/messagesmind:latest`. Assert exactly one entry for `messagesmind` with a digest. 6. `tests/test_deploy.py:98-106, 302`: "nothing else" is checked only on the base policy and its patch. An overlay that adds an allow-all NetworkPolicy, an overlay CIDR of `198.0.0.0/8`, and a base CIDR of `0.0.0.0/0` all pass. Pin the overlay `resources`, require `/32`, and assert that the base CIDR is in `192.0.2.0/24`. 7. `tests/test_deploy.py:277`: a `RUN apt-get install` or an `ADD https://…` in the Containerfile passes. Allow-list every `RUN` and `ADD` line. ## Notes - No `.dockerignore`. `COPY src/…` copies host `__pycache__` files and host file modes; a checkout made with umask 077 gives files that uid 10001 cannot read. - The runtime image keeps bash, apt and pip. The entrypoint `python -m` adds the working directory to `sys.path`; `-I` or `-P` removes that. - `fsGroup` makes the store files group-writable (`0660`); consider `fsGroupChangePolicy: OnRootMismatch`. - Mutations that break a run but leak nothing also pass: the compose `sync` service mounting `api.toml`, `/var/lib/messagesmind` missing from the `install -d` line, a container without the `/tmp` mount, `volumes_from: [api]` on smoke, and an exec probe on `/healthz/sync`. - `tests/compose_stack.py:89` retries on every exception, so a persistent `401` reports as `timeout`. - Unproven offline, as the spec records: the compose smoke (AC1) and live NetworkPolicy enforcement (AC4). ## Acceptance criteria - Item 1 is fixed, and a test derives each process's secret set from `startup.SECRET_FILE_VERBS`. - Items 2-7 are fixed, or each has a recorded decision. - The compose smoke passes on a host with a container engine. ## Human act eyes-on verify: the compose smoke passes under Podman on the host (CONV-40) ## Blocked by - #18 --- Filed under: operator word "Grant" sha256:78b7d0379d5e
Author
Member

This was generated by AI during triage.

Triage

  • The operator ruled that one rework round of #18 fixes item 1 (the blocker) together with items 2 to 7. The compose smoke then runs under Podman.
  • Every item is a row of the #18 rework spec:
    • R1: item 1. The api gets no tombstone salt, and the test derives each process's secret set from startup.SECRET_FILE_VERBS.
    • R2: items 2 and 3, and the compose checks from the notes.
    • R3: item 4, the ingress from selector.
    • R4: items 5 to 7.
    • R5: .dockerignore, python -I, fsGroupChangePolicy: OnRootMismatch and the 401 retry.
  • The operator also ruled that #18 drops the bucket egress rule.
  • CONV-40 rule 3 fires: this is the network policy and the secret mounts. State: ready-for-human. One acceptance criterion cannot run in CI: the compose smoke needs a container engine.

Disposition: close this issue when the #18 rework PR merges and the compose smoke passes on the host.

> *This was generated by AI during triage.* ## Triage - The operator ruled that one rework round of #18 fixes item 1 (the blocker) together with items 2 to 7. The compose smoke then runs under Podman. - Every item is a row of the #18 rework spec: - R1: item 1. The api gets no tombstone salt, and the test derives each process's secret set from `startup.SECRET_FILE_VERBS`. - R2: items 2 and 3, and the compose checks from the notes. - R3: item 4, the ingress `from` selector. - R4: items 5 to 7. - R5: `.dockerignore`, `python -I`, `fsGroupChangePolicy: OnRootMismatch` and the `401` retry. - The operator also ruled that #18 drops the bucket egress rule. - CONV-40 rule 3 fires: this is the network policy and the secret mounts. State: `ready-for-human`. One acceptance criterion cannot run in CI: the compose smoke needs a container engine. **Disposition:** close this issue when the #18 rework PR merges and the compose smoke passes on the host.
Author
Member

This was generated by AI during triage.

Closed: both conditions of the disposition hold.

  • The #18 rework PR #51 merged as 13a2fc8. The merge tree equals the verified head b116792.
  • The compose smoke passed under Podman 5.8.8 with Docker Compose v2 on the host: smoke=ok messages=9, exit 0.
  • In the running containers, the api holds store-key and read-token only. sync holds store-key, tombstone-salt and feeder-token. Each file is mode 0400 and owned by uid 10001 (item 1).
  • Each container runs as uid 10001 with a read-only root, all default capabilities dropped and no-new-privileges. The api publishes on 127.0.0.1:8420 only (items 2 and 3).

The two merge-gate reviews of PR #51 found no blocker. Their should-fix items are filed as #52.

> *This was generated by AI during triage.* Closed: both conditions of the disposition hold. - The #18 rework PR #51 merged as `13a2fc8`. The merge tree equals the verified head `b116792`. - The compose smoke passed under Podman 5.8.8 with Docker Compose v2 on the host: `smoke=ok messages=9`, exit 0. - In the running containers, the api holds `store-key` and `read-token` only. `sync` holds `store-key`, `tombstone-salt` and `feeder-token`. Each file is mode `0400` and owned by uid 10001 (item 1). - Each container runs as uid 10001 with a read-only root, all default capabilities dropped and `no-new-privileges`. The api publishes on `127.0.0.1:8420` only (items 2 and 3). The two merge-gate reviews of PR #51 found no blocker. Their should-fix items are filed as #52.
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#46
No description provided.