Deploy: close the test gaps and two hardening items from the PR #51 reviews #52

Closed
opened 2026-11-13 22:40:43 +00:00 by svc-agent-writer · 2 comments

Two reviews of PR #51 (issue #18, head b116792, merged as 13a2fc8) found no blocker. The shipped files meet the spec. The items below are gaps in tests/test_deploy.py, where a drift that breaks a security property still leaves the suite green, and two hardening items. The correctness review ran 46 mutations; 13 survived, and each survivor is listed here.

Should fix: hardening

  1. sync and api share one disk-backed /tmp with no size limit (deploy/k8s/base/messagesmind.yaml, the tmp emptyDir). Both run as uid 10001, so the volume is a writable channel between the two processes, and a compromised api can fill the node's ephemeral disk. Compose gives each service its own tmpfs; Kubernetes does not. Fix: one emptyDir per container, with medium: Memory and a sizeLimit.
  2. The base names the unqualified image messagesmind. kubectl apply -k deploy/k8s/base, or an overlay with a wrong images entry, deploys an unpinned image. Docker and containerd resolve it to docker.io/library/messagesmind:latest; CRI-O can search other registries. That pod would mount the store key and the tokens. The tests assert image == "messagesmind". Fix: a fully qualified, digest-pinned placeholder in the base, so the base alone fails closed.

Should fix: tests that a drift passes

  1. The effective NetworkPolicy check reads only the overlay patches list. A patches entry in the base kustomization, or a patchesJson6902 entry in the overlay, that adds egress to 0.0.0.0/0 passes. kustomize build confirmed that the rendered policy then holds 0.0.0.0/0. Fix: an exact key allow-list for each kustomization (base: apiVersion, kind, resources, labels; overlay adds namespace, configMapGenerator, images, patches), and the base resources pinned to exactly the two manifests.
  2. A container may mount the other process's secret volume. The test checks that each container mounts its own secret emptyDir read-only and no Secret volume. sync with an extra mount of api-secrets passes. Fix: the set of secret volumes that each container mounts equals its own.
  3. The Containerfile checks parse only one spelling. COPY --link --from=<unpinned image> passes, because only lines that start with COPY --from= are checked. A lower-case run apt-get install passes the RUN/ADD allow-list, and a lower-case user 0 would pass the USER check. Fix: parse instructions case-insensitively, and find --from= anywhere on a COPY line.
  4. No offline test ties the compose files together. Each of these breaks AC1 and passes the suite: api removed from allowed_hosts in the compose api.toml; the compose Feeder url on another port; the feeder service reading read-token; the smoke --url on sync. Fix: assert that the Feeder url matches the feeder service and its --port, that the smoke host is in the api's allowed_hosts, and that each token-file path names the right secret file.

Notes

  • hostNetwork: true on the pod passes, and a NetworkPolicy does not apply to a host-network pod. The README names the Pod Security restricted level, which refuses it, but no test checks. The compose hardening test does not check privileged, user or network_mode.
  • The api containerPort set to 8421 passes, while the probes and the server stay on 8420.
  • No test checks the image layout: a wrong COPY src/... path, or a removed COPY --from=build /app/.venv, passes. Only the host build catches them.
  • No test runs the compose_stack.py feeder verb; only the host smoke does.
  • .dockerignore admits any file under src/messages_mind_mcp/ that is not .pyc, for example a stray local .db or .toml. Allow *.py only.
  • The api shares the pod's egress, so it can reach the Feeder's port without the token. The overlay README states this. Only separate pods remove it.
  • The api mounts the data volume read-write and can delete tombstones.db; a later Rebuild would then re-import Forgotten messages. This is integrity, at the trust level of the api's store key. Record it in SECURITY.md, or split the volume.
  • A changed Secret reaches the pod only on restart, because the init copy runs at pod start. The README does not say so.
  • test_deploy.effective_policy() re-implements the JSON patch instead of running kustomize. The kubeconform and kustomize CI step (operator surface, .woodpecker/) would close this.
  • The runtime image keeps pip and setuptools from the Python base.

Acceptance criteria

  • Items 1 and 2 are fixed in the manifests, and a test covers each.
  • For items 3 to 6, each mutation named above fails a test.
  • Each note is fixed, or has a recorded decision.

Triage rulings (2026-11-15)

Operator word "accept leans / after #13, triage #58 and dispatch" (sha256:a999fb29c997).

  • Ruling 6: this issue adds one CI step to .woodpecker/. The step runs kustomize build on the base and on each overlay, and runs kubeconform in strict mode on each result. .woodpecker/ is an operator surface; this ruling allows that one step only. Pin each tool by version and by sha256. The step checks the rendered NetworkPolicy, so it replaces the re-implemented JSON patch in test_deploy.effective_policy() or runs beside it.
  • Ruling 7: no macOS CI lane in this issue. It comes after M1.
  • Ruling 8: ready-for-agent. The follow-ups #52, #54 and #56 run one at a time, after #13 and #58.

Blocked by

  • none

Filed under: operator word "merge 51" sha256:d300361cfa20

Two reviews of PR #51 (issue #18, head `b116792`, merged as `13a2fc8`) found no blocker. The shipped files meet the spec. The items below are gaps in `tests/test_deploy.py`, where a drift that breaks a security property still leaves the suite green, and two hardening items. The correctness review ran 46 mutations; 13 survived, and each survivor is listed here. ## Should fix: hardening 1. **`sync` and `api` share one disk-backed `/tmp` with no size limit** (`deploy/k8s/base/messagesmind.yaml`, the `tmp` emptyDir). Both run as uid 10001, so the volume is a writable channel between the two processes, and a compromised api can fill the node's ephemeral disk. Compose gives each service its own tmpfs; Kubernetes does not. Fix: one emptyDir per container, with `medium: Memory` and a `sizeLimit`. 2. **The base names the unqualified image `messagesmind`.** `kubectl apply -k deploy/k8s/base`, or an overlay with a wrong `images` entry, deploys an unpinned image. Docker and containerd resolve it to `docker.io/library/messagesmind:latest`; CRI-O can search other registries. That pod would mount the store key and the tokens. The tests assert `image == "messagesmind"`. Fix: a fully qualified, digest-pinned placeholder in the base, so the base alone fails closed. ## Should fix: tests that a drift passes 3. **The effective NetworkPolicy check reads only the overlay `patches` list.** A `patches` entry in the base kustomization, or a `patchesJson6902` entry in the overlay, that adds egress to `0.0.0.0/0` passes. `kustomize build` confirmed that the rendered policy then holds `0.0.0.0/0`. Fix: an exact key allow-list for each kustomization (base: `apiVersion`, `kind`, `resources`, `labels`; overlay adds `namespace`, `configMapGenerator`, `images`, `patches`), and the base `resources` pinned to exactly the two manifests. 4. **A container may mount the other process's secret volume.** The test checks that each container mounts its own secret emptyDir read-only and no Secret volume. `sync` with an extra mount of `api-secrets` passes. Fix: the set of secret volumes that each container mounts equals its own. 5. **The Containerfile checks parse only one spelling.** `COPY --link --from=<unpinned image>` passes, because only lines that start with `COPY --from=` are checked. A lower-case `run apt-get install` passes the `RUN`/`ADD` allow-list, and a lower-case `user 0` would pass the `USER` check. Fix: parse instructions case-insensitively, and find `--from=` anywhere on a `COPY` line. 6. **No offline test ties the compose files together.** Each of these breaks AC1 and passes the suite: `api` removed from `allowed_hosts` in the compose `api.toml`; the compose Feeder url on another port; the `feeder` service reading `read-token`; the smoke `--url` on `sync`. Fix: assert that the Feeder url matches the `feeder` service and its `--port`, that the smoke host is in the api's `allowed_hosts`, and that each token-file path names the right secret file. ## Notes - `hostNetwork: true` on the pod passes, and a NetworkPolicy does not apply to a host-network pod. The README names the Pod Security `restricted` level, which refuses it, but no test checks. The compose hardening test does not check `privileged`, `user` or `network_mode`. - The api `containerPort` set to `8421` passes, while the probes and the server stay on `8420`. - No test checks the image layout: a wrong `COPY src/...` path, or a removed `COPY --from=build /app/.venv`, passes. Only the host build catches them. - No test runs the `compose_stack.py feeder` verb; only the host smoke does. - `.dockerignore` admits any file under `src/messages_mind_mcp/` that is not `.pyc`, for example a stray local `.db` or `.toml`. Allow `*.py` only. - The api shares the pod's egress, so it can reach the Feeder's port without the token. The overlay README states this. Only separate pods remove it. - The api mounts the data volume read-write and can delete `tombstones.db`; a later Rebuild would then re-import Forgotten messages. This is integrity, at the trust level of the api's store key. Record it in `SECURITY.md`, or split the volume. - A changed Secret reaches the pod only on restart, because the init copy runs at pod start. The README does not say so. - `test_deploy.effective_policy()` re-implements the JSON patch instead of running kustomize. The kubeconform and kustomize CI step (operator surface, `.woodpecker/`) would close this. - The runtime image keeps `pip` and `setuptools` from the Python base. ## Acceptance criteria - Items 1 and 2 are fixed in the manifests, and a test covers each. - For items 3 to 6, each mutation named above fails a test. - Each note is fixed, or has a recorded decision. ## Triage rulings (2026-11-15) Operator word "accept leans / after #13, triage #58 and dispatch" (sha256:a999fb29c997). - **Ruling 6:** this issue adds one CI step to `.woodpecker/`. The step runs `kustomize build` on the base and on each overlay, and runs `kubeconform` in strict mode on each result. `.woodpecker/` is an operator surface; this ruling allows that one step only. Pin each tool by version and by sha256. The step checks the rendered NetworkPolicy, so it replaces the re-implemented JSON patch in `test_deploy.effective_policy()` or runs beside it. - **Ruling 7:** no macOS CI lane in this issue. It comes after M1. - **Ruling 8:** `ready-for-agent`. The follow-ups #52, #54 and #56 run one at a time, after #13 and #58. ## Blocked by - none --- Filed under: operator word "merge 51" sha256:d300361cfa20
Author
Member

This was generated by AI during triage.

Moved to ready-for-agent under ruling 8. The body now holds the rulings for this issue (ruling 6, the kustomize and kubeconform CI step; ruling 7, no macOS lane). The six should-fix items and the notes are bounded to deploy/, the Containerfile, .dockerignore, tests/test_deploy.py and one .woodpecker/ step. Dispatch waits for the operator's svd:go.

> *This was generated by AI during triage.* Moved to `ready-for-agent` under ruling 8. The body now holds the rulings for this issue (ruling 6, the kustomize and kubeconform CI step; ruling 7, no macOS lane). The six should-fix items and the notes are bounded to `deploy/`, the Containerfile, `.dockerignore`, `tests/test_deploy.py` and one `.woodpecker/` step. Dispatch waits for the operator's `svd:go`.
Collaborator

spec-verify-dispatch Half B for dev/messages-mind-mcp#52 deploy-close-the-test-gaps-and-two-hardening-items-from-the completed integration verify.

  • PR: #63
  • Branch: feat/svd-dev-messages-mind-mcp-52-deploy-close-the-test-gaps-b48b00f4
  • Commit: f929a91961
  • Build: none
  • Test: green
  • Reader audit clean: True
  • Spec fidelity: True
  • Ready for merge: False
  • Check ci/woodpecker/pr/validation: green https://ci.groupthink.asia/repos/75/pipeline/59/1
  • Checks: required ci/woodpecker/pr/validation resolved pass by CI-wait poll
  • Forbidden mutation: .woodpecker/validation.yaml (#81 guard)
  • Warning: Host-only checks remain for the architect: compose image smoke (docker compose --profile smoke run --rm smoke prints smoke=ok) and the pinned Woodpecker manifests step going green.
  • Warning: Subagent rendered with installed kustomize v5.8.1; CI pins v5.8.3 and kubeconform v0.8.0, so the pinned render is not locally verified.
  • CI wait: ci/woodpecker/pr/validation -> pass
  • Rework: 0 round(s), outcome forbidden-mutation
  • Escalation: measured branch diff touched may-not-mutate path(s): .woodpecker/validation.yaml — a gate/CI/lint surface was modified; human review required (#81). Remedy (ADR-0021, docs/adr/0021-may-not-mutate-ci-surfaces-rider-remedy.md): the fence does not move — land the CI-surface edit as a human-authored architect-rider commit on this branch before integrate, or as a separate follow-up PR. An agent lane never edits these surfaces.
  • Decision: resolve the blockers above and rerun integrate, or park this PR for a human?
spec-verify-dispatch Half B for dev/messages-mind-mcp#52 deploy-close-the-test-gaps-and-two-hardening-items-from-the completed integration verify. - PR: https://git.groupthink.asia/dev/messages-mind-mcp/pulls/63 - Branch: feat/svd-dev-messages-mind-mcp-52-deploy-close-the-test-gaps-b48b00f4 - Commit: f929a9196112d61d726c59a9e58497bfd4397468 - Build: none - Test: green - Reader audit clean: True - Spec fidelity: True - Ready for merge: False - Check ci/woodpecker/pr/validation: green https://ci.groupthink.asia/repos/75/pipeline/59/1 - Checks: required ci/woodpecker/pr/validation resolved pass by CI-wait poll - Forbidden mutation: .woodpecker/validation.yaml (#81 guard) - Warning: Host-only checks remain for the architect: compose image smoke (`docker compose --profile smoke run --rm smoke` prints smoke=ok) and the pinned Woodpecker `manifests` step going green. - Warning: Subagent rendered with installed kustomize v5.8.1; CI pins v5.8.3 and kubeconform v0.8.0, so the pinned render is not locally verified. - CI wait: ci/woodpecker/pr/validation -> pass - Rework: 0 round(s), outcome forbidden-mutation - Escalation: measured branch diff touched may-not-mutate path(s): .woodpecker/validation.yaml — a gate/CI/lint surface was modified; human review required (#81). Remedy (ADR-0021, docs/adr/0021-may-not-mutate-ci-surfaces-rider-remedy.md): the fence does not move — land the CI-surface edit as a human-authored architect-rider commit on this branch before integrate, or as a separate follow-up PR. An agent lane never edits these surfaces. - Decision: resolve the blockers above and rerun integrate, or park this PR for a human?
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#52
No description provided.