Repository navigation
Registry + securityContext hardening hygiene (post-archetype consolidation) - #16
Merged
Merged
Conversation
added 7 commits
June 28, 2026 19:13
Post-archetype consolidation bundle: (1) register the built leaf-session backend track (MVP + 3 archetypes) in the milestone registry; (2) align server.ts isMainModule to the exact fileURLToPath idiom; (3) apply the cron-dispatch securityContext baseline (non-root, runAsUser 65532, seccomp, no-priv-esc, drop caps, readOnlyRootFilesystem attempted) to the leaf-worker ScaledJob + Knative service, decided empirically via the live gate smoke. Defers reclaimer-churn tuning. Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: Paolo Dettori <[email protected]>
…asks) Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: Paolo Dettori <[email protected]>
…archetypes A/B/C) Signed-off-by: Paolo Dettori <[email protected]>
…ron-dispatch) Signed-off-by: Paolo Dettori <[email protected]>
…rop caps, read-only rootfs) Signed-off-by: Paolo Dettori <[email protected]>
With the leaf-worker hardened to uid 65532, runLeaf hit EACCES writing the gate marker into a results dir the smoke's orchestrator pod created as root. fsGroup makes the harness's own writes group-owned but does not make a root-created dir group-writable. The orchestrator owns /work (charter G3), so it must provision result dirs writable by the harness uid; the smoke models this with chmod 0777 on the run dir. Documented the operational contract in the spec. Agent ran cleanly under the hardened context; only cross-writer /work ownership needed coordination. Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: Paolo Dettori <[email protected]>
Final-review nit: leaf-job.ts calls main() unconditionally (script-only, never imported), so only cron-dispatch.ts shares the fileURLToPath idiom. Comment-only; no runtime change. Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: Paolo Dettori <[email protected]>
pdettori
commented
Jun 29, 2026
pdettori
left a comment
Member
Author
There was a problem hiding this comment.
Self-review (automated) — Clean consolidation/hardening bundle. The three changes are independent and well-scoped:
- Registry docs for the built leaf-session backend track (MVP + 3 archetypes) — previously shipped but unregistered.
server.tsentrypoint guard aligned to the canonicalfileURLToPath(import.meta.url)pattern (matchescron-dispatch.ts).- securityContext hardening on both the leaf-worker ScaledJob and Knative service — non-root (uid 65532), seccomp RuntimeDefault, drop ALL caps, read-only rootfs, fsGroup 65532.
All 7 commits DCO-signed. Live gate smoke confirms 6/6 claims pass under the hardened context. The chmod 0777 in the smoke is an acknowledged stopgap (production contract: group-write under shared fsGroup).
Reviewed: TypeScript, K8s/YAML, Shell, Docs. No security, convention, or correctness issues found.
Verdict: would APPROVE if not own PR.
2 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Post-archetype consolidation/hardening bundle (no runtime behavior change to
runLeaf, the gate, the contract, the queue, or KEDA scaling).docs/specs/README.md): a new "Leaf-Session Backend (BUILT)" section recording the work that shipped but was unregistered — MVP contract (Task 6: gated Kind smoke for the leaf-session contract + live-path fixes #10/Gate 7: resumable leaf sessions (crash mid-run → resume → verdict) #11), async (feat: async leaf completion (KEDA ScaledJob + Redis Streams work queue) #12), cron (feat: scheduled leaf dispatch (Archetype C cron trigger on-ramp) #13), human-gate (Add human-gate (gate-while-idle, Archetype B) to the leaf-session backend #14).server.tsentrypoint idiom: replaced the fragileprocess.argv[1].includes("knative-server")guard with the exactprocess.argv[1] === fileURLToPath(import.meta.url)(matchescron-dispatch.ts). No auto-start regression (server suite green).ScaledJob+ the Knative service (both previously ran as root with default caps): pod-levelrunAsNonRoot/runAsUser 65532/fsGroup 65532/seccomp RuntimeDefault; container-levelallowPrivilegeEscalation:false/readOnlyRootFilesystem:true/drop ["ALL"];HOME=/tmp+ writable/tmpemptyDir;kubernetes.podspec-securitycontextfeature flag insetup-kind.sh.Live-verification finding (documented): a non-root harness (uid 65532) can't write a
/workresults dir created by a root orchestrator (fsGroupdoesn't cover cross-writer dirs). Since the orchestrator owns/work(charter G3), it must provision result dirs writable by the harness uid; the smoke models this withchmod 0777on its run dir, and the spec records the production contract (group-write under sharedfsGroup 65532).Verification
@sh/harness119 passed (2 skipped),@sh/knative-server29 passed.leaf-gate-smoke.sh) all 6 claims PASS under a confirmed hardened pod (runAsUser=65532, fsGroup=65532, readOnlyRootFilesystem=true, drop ALL), includingkubectl execinto sandbox-0 and the full pause/scale-to-zero/approve/idempotent/reject-with-re-gate/abort flow.readOnlyRootFilesystem: trueheld on both pods (no fallback needed).Deferred follow-up (non-blocking)
Operator-runbook entry for non-root deployments (production guidance: group-write under
fsGroup 65532, notchmod 0777). Reclaimer-churn tuning remains deferred (no observed symptom).Assisted-By: Claude Code