Repository navigation
Conversation
policy.Config.Validate already refused a negative refresh_interval, but no loader called it, so the server and daemon started with an interval that made every enforcement stale on arrival and refreshed on each request. Split the check into ValidateRefreshInterval and call it from the server and daemon loaders after unmarshal. The rest of Validate is not wired in, so configurations that load today keep loading. The reconciler does not bind refresh_interval (it has no gate) and is unchanged. Fixes agntcy#2466 Signed-off-by: sarankumar1325 <[email protected]>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
github-merge-queue
Bot
removed this pull request from the merge queue due to a conflict with the base branch
Nov 11, 2026
github-merge-queue
Bot
removed this pull request from the merge queue due to a conflict with the base branch
Nov 11, 2026
…-policy-refresh-interval Signed-off-by: sarankumar1325 <[email protected]> # Conflicts: # cli/cmd/daemon/config_fileonly_test.go
tkircsi
approved these changes
Nov 12, 2026
tkircsi
left a comment
Contributor
There was a problem hiding this comment.
LGTM. Thanks @sarankumar1325 !
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.
Fixes #2466.
policy.Config.Validate()already refuses a negativerefresh_interval, but no loader calls it, sorefresh_interval: -5sloads without complaint.Resolver.Current()treatsage >= intervalas stale, so a negative interval makes every enforcement stale and a request starts a refresh each time.Change
Of the two options in the issue, this takes refuse, and keeps it narrow:
server/policy/config: the negative check moves intoValidateRefreshInterval().Validate()still calls it, so its behaviour doesn't change.server/config.LoadConfigand the daemon'sloadConfigcallValidateRefreshInterval()after unmarshal. A negative value now stops the start with the existing message (policy: refresh_interval must not be negative).Validate()(lists, name uniqueness) is not wired into the loaders. That's the broader behaviour change the issue warns about, so configurations that load today still load.refresh_intervaland has no gate (see the comment inreconciler/config/config_test.go).GetRefreshInterval()still treats only0as unset. A negative value no longer gets past the loaders, so nothing gets silently swapped for the default.Tests
server/config:TestLoadConfig_RefusesANegativePolicyRefreshInterval(DIRECTORY_SERVER_POLICY_REFRESH_INTERVAL=-5s). It fails without the loader change.cli/cmd/daemon: the same case forDIRECTORY_DAEMON_SERVER_POLICY_REFRESH_INTERVALwith the file that carries the policies.server/policy/config:TestValidateRefreshInterval(unset, positive, negative).go test ./config/ ./policy/config/(server) andgo test ./cmd/daemon/(cli) pass.