Repository navigation
✨ feat(filter): wire insecure_allow_body_blind_writes into runtime exec policy - #123
Merged
Merged
Conversation
The exec body-inspection policy had no idea the top-level insecure_allow_body_blind_writes flag existed: an empty request_body.exec.allowed_commands unconditionally denied every exec with "no commands are allowlisted", regardless of the flag. The flag only ever satisfied the startup validator (internal/cmd/rules.go), so every preset that documents "set this flag to allow unpinned exec" was silently non-functional for exec at request time. - ExecOptions.AllowBlindWrites (filter/exec.go) lifts ONLY the "no commands are allowlisted" gate when AllowedCommands is empty; allow_privileged, allow_root_user, and allowed_env_vars/denied_env_vars still apply exactly as configured. The field has no effect once a real allowlist is pinned. - attachRuntimeInspectors (cmd/serve.go) wires the global insecure_allow_body_blind_writes config value into it for both the default policy and every named client profile. - withFilter now logs a startup warning (once per process, surviving hot-reload) naming exactly what the flag loosens, matching the existing warnIfLabelACLEnabled pattern. Default-deny is unchanged: the flag must still be set explicitly.
Both drydock preset headers said "current Drydock does not spawn a separate helper container" for self-update. As of drydock dev/v1.6 (SelfUpdateTransitionShared.ts / self-update-controller.ts, read via ref-only git show against origin/dev/v1.6), that changed: drydock now spawns a separate ephemeral AutoRemove helper container that itself issues the stop-old/start-new/health-poll/finalize-exec/remove-old sequence over the same bind-mounted socket, rather than drydock's own process doing so directly. The pinned allowed_commands argv in drydock-with-selfupdate.yaml (["node", "dist/triggers/providers/docker/self-update-finalize-entrypoint.js"]) was independently verified against the current source and is still exactly correct — only the "who calls exec" narrative needed updating.
- exec_test.go: flag off keeps the unchanged default-deny; flag on allows a clean exec but still denies privileged/root/denylisted-env execs; flag has no effect once AllowedCommands is pinned; a full-middleware HTTP case. - portwing_preset_conformance_test.go: portwing-with-exec.yaml's exec-create assertion flips from denied to allowed now that the flag actually works, plus a new case proving the flag only lifts the allowlist gate (privileged exec still denies). TestMiddlewareDeniesUnallowlistedExecCreateCommand keeps the flag-off default-deny covered independently of any preset. - drydock_preset_conformance_test.go: added a case with the full finalize exec-create body (AttachStdout/AttachStderr/Cmd/Env with the real DD_SELF_UPDATE_* names) proving Env doesn't affect the verdict. - github/gitlab runner integration test helpers now wire insecure_allow_body_blind_writes the same way production does, so those presets' own opt-in takes effect in the integration harness too. - serve_test.go/serve_warn_test.go/coverage_gaps_test.go: servePolicyConfig and buildServeClientProfiles both propagate the flag into PolicyConfig.Exec.AllowBlindWrites for the default policy and every named client profile; the new startup warning fires once per process and survives a simulated hot-reload.
- README's "Container runtime hardening" group_add snippet still used the pre-rename DOCKER_GID variable after every compose example switched to DOCKER_SOCK_GID — now consistent. - security.mdx, configuration.mdx, and the README feature table now state that insecure_allow_body_blind_writes changes exec request-time behavior (not just startup validation): an unpinned exec is admitted instead of denied, but allow_privileged/allow_root_user/allowed_env_vars/ denied_env_vars still gate it exactly as configured. - presets.mdx's drydock-with-selfupdate.yaml summary said allow_root_user=false; the shipped preset (and its own YAML header) has always set it true — corrected, with the reasoning (empty exec User reads as root) restored. - CHANGELOG entries for all of the above plus the new tests.
…LF_UPDATE_* set drydock-with-selfupdate.yaml pinned exec Cmd via allowed_commands but left exec Env completely unrestricted (exec.go's empty allowed/denied env lists mean "no restriction"). For an interpreter command like node, Env can change what the pinned argv actually executes — NODE_OPTIONS can --require arbitrary code before the script runs, NODE_PATH can redirect module resolution — so the "exact-argv pin keeps it safe" claim was overstated. - 🔧 add allowed_env_vars to request_body.exec, scoped to exactly the DD_SELF_UPDATE_* names drydock's buildFinalizeExecEnv() sends (self-update-controller.ts), verified against drydock dev/v1.6 source - 📝 update header/inline comments to describe the Env attack surface and why the argv pin alone doesn't close it - 🧪 add a conformance case proving the same allowlisted Cmd with an extra NODE_OPTIONS Env entry is now denied, and correct a stale test comment that said Env was intentionally unrestricted
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This branch was successfully deployed
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.
What
Closes the exec-policy gap from the tri-repo integration review (PICKUP item 4):
insecure_allow_body_blind_writeswas honored by the startup/reload/CLI validators but never reachedfilter.ExecOptions, so at runtime an emptyallowed_commandsdenied ALL exec regardless of the flag — the documented opt-in was a silent no-op.Changes
ExecOptions.AllowBlindWriteswired fromcfg.InsecureAllowBodyBlindWritesinattachRuntimeInspectors. Scoped precisely: only the empty-allowlist gate is lifted;allow_privileged,allow_root_user, and env-var gates still apply exactly as configured. Default-deny remains the default, covered by tests.drydock-with-selfupdate.yamlpinned exec argv but left Env unrestricted — an allowlistednodeexec could be subverted viaNODE_OPTIONS. Now pinsallowed_env_varsto the exactDD_SELF_UPDATE_*names drydock'sbuildFinalizeExecEnv()sends (verified against drydock dev/v1.6 source), with a conformance test proving a NODE_OPTIONS-carrying exec is denied.allow_root_user=falsefor the selfupdate preset; shipped YAML has it true).Context
Surveyed the July 2026 socket-proxy field (Tecnativa, linuxserver, wollomatic, CetusGuard, 11notes, docker-proxy-acl, hawser): every one of them tops out at endpoint-level exec on/off — none inspect Cmd/Env/Privileged. sockguard's per-argv allowlisting + code-enforced blind-write gate already exceeded parity; this PR makes the documented escape hatch actually work and closes the env-injection corner.
Verification
Full
go test ./... -count=3 -racein app/ clean; conformance suites updated (flag on/off, scoping, drydock env pin); reviewed independently by two adversarial passes.