Repository navigation
✨ feat(v1.5): config-defaults reflection + default upstream request_timeout - #120
Merged
Merged
Conversation
- setLoadDefaults's ~199-line hand-written v.SetDefault block is replaced
with registerDefaults, a small recursive reflect walker driven by
Config's mapstructure tags, so a new config field can never again
silently miss its Viper registration (and with it its SOCKGUARD_* env
var override) — this exact bug class has already shipped three times
(allow_sysctls, four service-hardening rails, the SELinux/
deny_unconfined_system_paths trio)
- auditing the walker's output against the old hand-written list surfaced
two more, previously-unknown instances of the same gap, now closed as a
side effect: request_body.{container_create,service}.image_trust.
{mode,allowed_signing_keys,allowed_keyless} and request_body.
container_create.{allowed_device_cgroup_rules,allowed_device_requests}
had no v.SetDefault registration either
- adds load_defaults_completeness_test.go: TestLoadDefaultsCoversEvery
MapstructureLeaf (Load("") deep-equals Defaults(), field by field),
TestLoadDefaultsEnvOverrideSweep (generalizes the one-off regression
tests in load_env_defaults_test.go into an exhaustive SOCKGUARD_<PATH>
sweep), and TestConfigFieldsHaveMapstructureTags (fails CI if any
Config field, at any depth, lacks a mapstructure tag)
- clients.global_concurrency and clients.profiles[].limits.rate/
concurrency stay deliberately non-env-configurable: nil pointer leaves
are skipped rather than registered, and Profiles is a slice leaf the
walker never recurses into
- no YAML key, env var, CLI flag, or default value changes otherwise;
documents the new registration path in CONTRIBUTING.md and README.md
- config.Defaults().Upstream.RequestTimeout now "60s" (was "" / unlimited);
a wedged daemon that hangs the response body is now caught by default
instead of pinning a request indefinitely.
- Add the "off" sentinel (exact-lowercase) to explicitly disable the
deadline; legacy empty string "" still works for backward compat.
Centralized in UpstreamConfig.RequestTimeoutDisabled(), the single
source of truth used by both validate.go and cmd/serve.go.
- Add GET/PUT /containers/{id}/archive (docker cp, both directions) to
proxy/timeout.go's long-lived exemption list, closing the large-copy
regression the new default would otherwise introduce.
- Log the effective value ("off" or the duration) as
upstream_request_timeout on the "sockguard started" INFO line.
- CHANGELOG: migration note under a new [Unreleased] heading — who's
affected, and how to opt back out with request_timeout: "off" (env var
callers must use "off", not an empty string, per Viper's empty-env
semantics).
- Update README feature table + roadmap, and configuration.mdx /
multi-host.mdx docs to match the new default and "off" opt-out.
|
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.
First two items of the v1.5 spine, built per the specs from the prep workflow and sequenced consolidation-first.
🔄 Config Viper-default registration by reflection. load.go's ~200-line hand-written v.SetDefault block is replaced with a reflection walker driven by Defaults() + mapstructure tags. Closes the silently-dead-env-var bug class that has shipped three times — and the parity audit found two more pre-existing instances (8 keys total: the container_create/service image_trust mode/keys fields and the allowed_device_cgroup_rules/allowed_device_requests fields had no registration, so their SOCKGUARD_* env vars did nothing). Those env vars are now live; default values are bit-for-bit unchanged. New completeness tests: Load('') deep-equals Defaults(), an exhaustive SOCKGUARD_ env-override sweep, and a fail-on-missing-mapstructure-tag check. The intentionally env-inaccessible pointer blocks (clients.global_concurrency, profile limits) stay inaccessible.
✨ upstream.request_timeout defaults to 60s (was unlimited). The v1.2.0 opt-in deadline that turns a hung upstream body into a fast 504 is now on by default. Migration: set request_timeout: "off" to restore unlimited (legacy "" still works in YAML; use "off" via env var since an empty env var reads as unset). GET/PUT /containers/{id}/archive added to the long-lived exemption list in the same change so a large docker cp doesn't regress under the new ceiling. Effective value logged on the startup line. All 16 presets validate unchanged.
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] with the migration story.
Remaining spine per the sequencing plan: cpu-hard-cap → exec-env allowlist → namespace-sharing gate (last two collide with cpu-cap on ContainerCreateRequestBodyConfig, so they serialize).