Repository navigation
fix(identityconfig): bound the installed identity-config snapshot across refreshes - #598
sujanchalla0510 wants to merge 1 commit into
Conversation
| if err != nil { | ||
| errs = append(errs, err) | ||
| } | ||
| configMaxSnapshotEntries, err := lookupInt("CONFIG_MAX_SNAPSHOT_ENTRIES", 0) |
There was a problem hiding this comment.
(non-blocking) Env var prefix diverges from its sibling cap. MaxSnapshotEntries lands in the same IdentityConfigSourceConfig struct as MaxConfigEntries (env CONFIG_SOURCE_MAX_CONFIG_ENTRIES, line 522), but reads from CONFIG_MAX_SNAPSHOT_ENTRIES — dropping the SOURCE_ segment. Operators setting the natural-by-analogy CONFIG_SOURCE_MAX_SNAPSHOT_ENTRIES get the default silently, i.e. the safety cap stays off. This is fresh wire; aligning to CONFIG_SOURCE_MAX_SNAPSHOT_ENTRIES now is free and avoids a permanent inconsistency.
There was a problem hiding this comment.
Ladon verdict: Approve
Approve — clean additive change.
Adds an opt-in cumulative snapshot-entry cap (CONFIG_MAX_SNAPSHOT_ENTRIES) to identityconfig.Service, default-disabled so prior unbounded behavior is preserved. Cap logic in loadAllOnce/refreshDelta is fail-closed (no partial snapshot stored, watermark left unadvanced so a later under-cap delta applies), rejection is observable via RefreshOutcomeError + warn log, and all three branches are tested.
Checked against repo-specific gates: not a schema/types_gen/wire-field change (no regen or pathway-back obligation), no TMP signing/verification impact, no identity-agent TEE boundary widening, no protocol-managed skill edits, and no exported-symbol removal/rename requiring a breaking marker.
High-risk flag is set only because files match targeting/** and are all (modified) — no deletions and no medium-or-higher findings, so the modifications are presumed safe. gated_paths is false and the author is not on a no-auto-approve team.
Decision table: no critical/high/medium findings (only 1 low nit), no gated-path or deletion trigger — falls through to row 9.
Nit (non-blocking): targeting/identityagent/config.go:537 — the new env var drops the SOURCE_ prefix used by its sibling cap; worth aligning before it ships to avoid a silent footgun.
Fixes #570.
The per-response cap (scope3.DefaultMaxConfigEntries, 250k) bounds one config-source response, but applyDeltaWithLogger merges every delta into a copy of the current snapshot, so the installed snapshot is cumulative and unbounded over the process's life (measured in #570: 250k new keys per refresh, linear memory growth, RefreshOutcomeSuccess throughout).
What changed:
How it was tested: