Repository navigation
docs(adr): propose CPU, memory and PID limits for the edge container (ADR-022, proposed) - #44
Draft
knittingcode wants to merge 1 commit into
Draft
knittingcode wants to merge 1 commit into
knittingcode wants to merge 1 commit into
Conversation
Add ADR-022 with status proposed: service-level cpus, mem_limit and pids_limit for the edge in compose.yaml as defence in depth for the availability risk accepted in ADR-021. The values are conservative ceilings because edge usage has not been measured; the ADR lists the measurement, guard, Compose and runtime checks an activating change must pass, and the risks (OOM kill, reload headroom, slower tests). Record the missing resource limits as a deferred hardening item in the container vulnerabilities document. No Compose or executable file changes; ADR-021 and the trivyignore exception are unchanged.
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
Documentation only. Adds ADR-022 (status: proposed, not implemented, not activated), which proposes CPU, memory and PID limits for the edge container as defence in depth for the availability risk accepted in ADR-021. It also records the missing limits as a deferred hardening item in
docs/security/container-vulnerabilities.md.Motivation and context
ADR-021 (accepted 2026-10-28) states a residual availability risk: if a configuration enabled
acme_serveror a mutable admin API, a remote client could exhaust the edge's CPU (about 2.2 s CPU per crafted request in the runtime check), and "the edge has no CPU or memory limits, so the API and database on the same host could suffer too". No Compose file onmain(1badf76) setscpus,mem_limit,pids_limit,deploy.resourcesorulimitsfor any service. The security document's lists did not mention this.The proposal is a separate ADR rather than a new section in ADR-021. That way the accepted ADR-021 text stays unchanged, and the limits remain their own decision, which the owner can accept or reject without touching the exception.
Content
docs/architecture/adr/ADR-022-edge-resource-limits.md:edgeservice incompose.yamlonly (inherited by the prod-like, test and HTTPS test overrides):cpus: "1.0",mem_limit: 256m,pids_limit: 256.GOMAXPROCS(automaxprocs) and a softGOMEMLIMITof 0.9 x the cgroup limit (automemlimit 1.0.0) from the limits. I checked this againstcmd/main.goin the module cache.${VAR}interpolation outside ports, volume sources and secret files.deploy.resources.limits,memswap_limit, limits on other services, Caddy timeouts and body limits (out of scope), or no limits.docker statsduringstack.shandprodlike.sh, withmem_limitat least 4 x the peak; guard andconfig --quietchecks stay green; a newhardening_problemsassertion onNanoCpus,MemoryandPidsLimitwith a negative control; no healthcheck or timing regression; the gate stays fail-closed across the edge recreate.GOMEMLIMITis soft), configuration reload (not possible today becauseadmin offis set and--watch/--resumeare rejected; a future reload would need re-measured headroom), slower tests, not a DoS fix, platform differences.docs/security/container-vulnerabilities.md: one bullet under "Deferred hardening items" that states the current state (no limits) and links to ADR-022.What is NOT changed
security/trivyignore.yamlis unchanged: same entry, scope and expiry (2026-11-30). This PR does not broaden, extend or renew the exception.Testing performed
scripts/ci/guard-trivyignore.sh: OK (1 exception follows the policy, checked on 2026-10-29).scripts/ci/guard-tracked-files.sh: OK.tests/app/*.sh,bin/devenvor integration tests were run. Nothing in the PR is executable.Security considerations
None of this is active. The residual risk stated in ADR-021 is unchanged until an activating change is merged.
Owner decisions needed
deploy.resources.limits, and whether to setmemswap_limit).Known limitations
The proposed values are not based on measured edge usage. The ADR makes measurement a precondition for activation.