Repository navigation
✨ feat(v1.5): require_cpu_limit_hard + exec-create Env allowlisting - #121
Merged
Merged
Conversation
- New opt-in bool `request_body.container_create.require_cpu_limit_hard` (default false), independent of the existing `require_cpu_limit` which stays byte-for-byte unchanged. - New predicate `hasHardCPULimit`: NanoCpus > 0 OR CpuQuota > 0 counts as a hard cap; CpuShares and a lone CpuPeriod do not (relative priority, not an absolute ceiling). CpuQuota is accepted without a paired CpuPeriod — confirmed against Docker's docs that the CFS period defaults to 100000us when omitted. - Enforced in containerCreatePolicy.denyResourceLimitReason independently of the base knob; when both are enabled and only CpuShares is set, the stricter hard-cap denial message wins. - Wired through config.go, filter_options.go/ToFilterOptions, and filter/container_create.go (Options + policy struct); no manual v.SetDefault needed — the reflection-based Viper defaults walker (load.go) picks up the new mapstructure-tagged field automatically. - Table-driven tests mirroring the existing require_cpu_limit cases (NanoCpus, CpuQuota-alone, CpuShares-alone rejection, CpuPeriod-alone rejection, both-knobs interaction, boundary mutation coverage) plus a filter_options_test.go propagation check. - Docs: configuration.mdx (YAML example, policy reference table, env var table) and a CIS-benchmark callout explaining why the preset deliberately leaves the hard cap off (CIS 5.11 is satisfied by CpuShares). - README roadmap: closes the CpuShares-vs-hard-cap backlog item; adds container-update re-validation and swarm-service CPU-limit parity as named follow-ups (out of scope here). - CHANGELOG: Unreleased/Added + Tests entries.
- ✨ add `request_body.exec.allowed_env_vars`/`denied_env_vars` config fields, both opt-in and empty-by-default (no restriction), unlike `allowed_commands`' deny-all-when-empty - ✨ enforce name-only, exact, case-sensitive matching on exec-create `Env` entries; denylist checked first and always wins; values are never inspected or logged - ✨ fail closed on wrong-shaped `Env` JSON via a strictly-typed field (whole-body decode fails, same as other malformed exec bodies) - 🧪 table-driven middleware/unit tests for deny-by-denylist precedence, allowlist rejection, passthrough when both empty, name-extraction edge cases, exec-start unaffected (Env never re-checked), config load/validate/YAML-override/per-profile/env-var coverage - 🧪 extend FuzzExec seed corpus + harness with Env-bearing payloads - 📝 document the new fields in configuration.mdx and security.mdx, including an example denylist (LD_PRELOAD, LD_LIBRARY_PATH, LD_AUDIT, DYLD_INSERT_LIBRARIES, PYTHONPATH, PATH) and the create-time-only enforcement boundary - 📝 update CHANGELOG (Unreleased/Added) and README roadmap/feature rows
|
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.
Second pair of the v1.5 spine, built per the specs from the prep workflow — the two parallel-safe items (disjoint config sections), each in its own worktree.
✨
request_body.container_create.require_cpu_limit_hard. New independent opt-in bool that requires a genuine CPU-time cap (HostConfig.NanoCpusorCpuQuota). The existingrequire_cpu_limitacceptsCpuShares, but shares are a relative scheduling weight, not a cap — a shares-only container still eats 100% of an idle host. The new knob closes that gap without changingrequire_cpu_limitat all; enabling it alone is a complete configuration. A loneCpuPerioddoesn't satisfy it (it's just theCpuQuotadenominator).cis-docker-benchmark.yamldeliberately does not enable it — CIS 5.11 is satisfied byCpuSharesper the benchmark text, so forcing a hard cap would reject CIS-compliant workloads.✨
request_body.exec.allowed_env_vars/denied_env_vars. Opt-in name-only restriction of exec-createEnventries. Denylist checked first and always wins; a non-empty allowlist denies unlisted names. Matching is exact and case-sensitive; values after=are never inspected or echoed into logs/deny responses, so secrets in allowed vars never leak. Both default empty = no restriction (deliberately the opposite default fromallowed_commands) — zero behavior change unless configured. Create-time only: exec instances are immutable andGET /exec/{id}/jsonnever returnsEnv, so there's nothing for the/exec/*/startre-check to re-validate. Docs ship a copy-pasteable linker-hijack denylist (LD_PRELOAD,LD_LIBRARY_PATH,LD_AUDIT,DYLD_INSERT_LIBRARIES,PYTHONPATH,PATH).Both worktree-built, diff-reviewed, then integrated and re-gated on the combined branch: go build/test (all packages), golangci-lint 0 issues, full pre-push chain green. CHANGELOG carries both entries under [Unreleased]; README backlog row and configuration/security docs updated.
Remaining spine: namespace-sharing gate (last, serialized behind cpu-cap; pending the
allow_cross_owner_namespace_sharingdefault decision).