Deploy follow-ups from the #52 reviews: the rendered checker, the SECURITY record and the CI guard #64
Labels
No labels
boundary:crosses
bug
enhancement
epic
needs-info
needs-triage
ready-for-agent
ready-for-human
svd:go
svd:hold
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
dev/messages-mind-mcp#64
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The correctness review and the security review of PR #63 (head
f929a91) found no blocker. The rendered pod deploys safely: each process has its own memory-backed/tmpand its own secret volume, every image is the zero-digest placeholder, and the NetworkPolicy allows only the api port in and the Feeder/32out. The findings below are in the new checks and the documents. PR #63 cannot take a rework round, because the runner refuses a branch that carries a CI-surface diff, so they land here.Should fix first
podSelectorwith the pod labels (tests/rendered_manifests.py:20-50). A secondlabelsentry indeploy/k8s/base/kustomization.yamlwithfields: [{kind: NetworkPolicy, path: spec/podSelector/matchLabels, create: true}]is an allowed key. kustomize then renders a policy that selects no pod, so the pod loses all isolation, and every check passes (reproduced by both reviews). Fix: the policypodSelector.matchLabelsmust be a non-empty subset of the Deployment's pod template labels; check the kustomizationlabelsvalue exactly./32check reads onlyprefixlen(tests/rendered_manifests.py:43). An IPv62001:db8::/32with a matching Feeder URL passes; that block holds 2^96 addresses (reproduced). Fix:ip_network(cidr).num_addresses == 1.SECURITY.md:133-148, "What the Kubernetes pod does not separate", understates what the api can do. The api holds the store key and write access to the volume. It can remove thedeletion_slicemarker row (sync.py:310) or rewrite the Mirror and its event log, so thetombstones-missingstop does not protect against the api. State also:README.md:73), so any Rebuild there re-imports Forgotten messages;dataread-write, and compose has no egress control, so "egress reaches only the Feeder" holds for the pod only;/dev/shmand the IPC namespace, both writable by uid 10001.The section is hard-wrapped; the rest of the file holds one paragraph per line.
README.md:453claims more than the step checks. It says the step "checks the rendered NetworkPolicy, pod and images", but the checker does not check thepodSelector, thesecurityContextvalues or the image repository. It also uses the process word "architect rider" in a public README. Say "The pipeline'smanifestsstep renders…" and list what it checks.The rendered checker (
tests/rendered_manifests.py)It is the only gate for an overlay other than
example. Each render below passes it (reproduced):/but a dot (evil.example@sha256:…,messagesmind.v2@sha256:…) counts as qualified, and Docker resolves it todocker.io/library/…; any other registry (ghcr.io/evil/x@sha256:…) passes. Fix: the repository equalsgit.groupthink.asia/dev/messages-mind-mcp.securityContextvalues are not checked:allowPrivilegeEscalation: true,readOnlyRootFilesystem: falseandcapabilities.addpass. PodrunAsUser: 0andautomountServiceAccountToken: truepass.projectedvolume,env.valueFrom.secretKeyRefor annfsvolume. Init-container mounts are not checked, so the api init container can copyfeeder-tokenfromsync-secrets-in, and the Secretitemscan gainfeeder-token.PodorDaemonSetwithhostNetwork: truethat mounts the Secret passes, and so does aLoadBalancerService.pod_violationshostPath, the securityContext keys, hostPort, sync ports, the probe port and init/tmp; inimage_violationsthe dot check, the digest regex and the init containers; every branch ofpolicy_violations; the kind count and ConfigMap parsing inrendered_violations; the FROM pin incontainerfile_violations; the Feeder hostname, the port agreement, the token parent and the token names incompose_violations. Add a mutation row for each.Other drift tests
tests/test_deploy.py:136-205): a# escape=``directive plusLABEL note=x\hides a realRUN;SHELL [...]bypasses the RUN allow-list;USER 10001:10001moved into the build stage passes, and the final image then runs as root (compose forbidsuser:, so compose runs it as root; this gap is older than #63);ENV LD_PRELOAD=…and a secondENV UV_LOCKED=0pass. Fix: refuse a parser directive, refuseSHELL, requireUSERafter the lastFROM, and pin theENVset.tests/test_deploy.py:211):extra_hosts: ["feeder:203.0.113.9"]sends the sync worker's Feeder token to that address, and passes.uts: host,cgroup: host,sysctls,group_add,runtimeandcgroup_parentalso pass. Fix: an exact key allow-list for each service..dockerignore(tests/test_deploy.py:768-800): an added!**/*.keyor!src/messages_mind_mcp/**/*token*passes, because the test checks named paths, not the exact pattern list. Pin the pattern list. The translatorcontext_included(:249) has no unit test of a zero-directory**/,*against/, or parent matching; four changes to it go undetected.The
manifestsCI step and its guard test (operator surface).woodpecker/validation.yamlis a may-not-mutate surface, so items 13 and 14 need anarchitect-ridercommit or a separate operator PR (dev/stables ADR-0021).test_the_pipeline_renders_and_validates_every_kustomization(tests/test_deploy.py:901-922) passes each of these edits (reproduced):failure: ignoreorwhen: {event: tag}on the step;kustomize build … > /dev/null;example.yamldropped from kubeconform or from the checker;|| trueon kubeconform or the checker;-ignore-missing-schemas,-skip NetworkPolicyor-schema-location default; a second unverified download that overwrites the verified archive, or a different binary extracted; anHTTPS_PROXYentry; a legacysecrets:key. Fix: pin the step's command list exactly, and refusefailure,when,secretsand proxy keys on it.pip install uv==0.12.17has no hash, anduv runbuilds the project withhatchling, which the lock does not hash. Both already hold for thecheckstep.Notes
.dockerignorematcher agreed with a port of moby/patternmatcher on 6798 paths. Docker also admits a file inside a directory named*.py, for examplesrc/messages_mind_mcp/x.py/stray.db.rendered_manifests.maincatches onlyOSErrorandYAMLError. A render with missing keys exits with a traceback, so it still fails closed.Blocked by
Filed under: operator word "I grant authority to merge T4 through 21:00 aedt" sha256:cec4dd4fecbd