4.2 KiB
Worker transport security review
Scope: f7048ab (parent equivalent aa99216). Narrow transport-only hardening; no orchestration/core/AppModule changes, release authority, live provisioning or deployment.
Fixed
- Authenticated artifact retrieval now requires a local fixed-base QA registration, successful staging PREPARE run, matching immutable commit, 20-cent task, and DONE outbox bound to that exact run. Workers can read only their own outbox/run; separately provisioned Stage CI can read bounded completed tracer artifacts for independent verification. Foreign QA registrations and arbitrary authenticated workers do not suffice. Returned bytes must match both content hash and deterministic run-bound tracer report.
- Artifact base is canonical HTTPS with the exact
/internal/prepare-worker/artifactspath: no userinfo, query, fragment, alternate port, IP literals, localhost/private-name suffixes, escaped or normalized arbitrary paths. This is static reviewed configuration, not a fetched URL. DNS resolution/reachability is deliberately not attempted; the operator must review the fixed origin and DNS/TLS routing. - Configuration requires an actual boolean enable flag, non-overlapping valid allowlists and valid unique credential grants. Both transport snapshot and workflow config are frozen, including arrays and grant objects; caller mutation cannot change the snapshot.
- Linux descriptor-relative directory traversal with O_DIRECTORY/O_NOFOLLOW prevents symlinked path components and pins directories across renames. Final directory must be private and owned by process UID. File creation uses exclusive O_CREAT/O_EXCL/O_NOFOLLOW, never truncating existing symlinks, hardlinks or regular files. Reads use a pinned O_NOFOLLOW/O_NONBLOCK descriptor, require a private owned regular single-link file, and are bounded to 2049 bytes before digest/run binding verification.
Preserved and verified
Bearer service digest identity, strict DTO/body impersonation rejection, independent CI role, explicit task-only claim (no queue polling), exact 20-cent cap, Gate1 gating, lease owner/token/task/run fences, unknown-cost reservation exhaustion, STOP_AGENTS and cancellation checks, atomic core completion recheck. No network fetch of artifact URLs was introduced.
The executor remains a deterministic JSON tracer: no LLM, shell, browser, deployment, repository inspection or real application QA. Successful tracer QA is not acceptance-criteria verification.
Evidence
Actual disposable PostgreSQL16/no-network Docker fixture, Nest TCP HTTP listener, child Node22 executor and full backend tsc -b build: /opt/services/canina/validation/v4-worker-security/.
auth-red.log: unrelated registered worker received 200 instead of expected 404.config-red.log: unsafe credential-bearing base accepted.file-red.log: symlink target sentinel overwritten by deterministic report.freeze-red.log: workflow config remained mutable.security-green.log: all 7 tests pass, including own-worker/CI retrieval, foreign URI denial, directory/file symlink and hardlink rejection, tamper integrity rejection, kill/lease/task fencing and actual child executor to VERIFYING.build.log: full backendtsc -bexit 0.tracer-evidence.json: actual fixture task/run/hash/content, GET200, cost0. External URI reachability explicitly NOT_TESTED_ISOLATED_FIXTURE_HOST.
Limits / residual responsibilities
Linux /proc/self/fd is required; unsupported platforms fail closed. Protect the artifact mount and its ancestry from same-UID/root attackers; they remain outside this process boundary. File and database cannot commit atomically: a killed/denied/competing completion can leave an unregistered orphan, deliberately unreadable and never overwritten automatically. No retry/cleanup redesign was added. Descriptor pinning prevents path redirection but does not promise availability during hostile renames. Symlink/hardlink swaps are tested; exhaustive adversarial scheduling is not claimed.
Parent still owns service-network restriction, reviewed origin/DNS/TLS reachability, body/rate limits, secret provisioning, Stage CI evidence provenance, aggregate department budgets and integration tests. All workers remain unwired/default-disabled; no live secrets or RELEASE_AUTHORIZE used.