Skip to content

Fix panic when resolving secrets on first reconcile#459

Merged
henderiw merged 1 commit into
sensitivefrom
fix/configresolver-nil-fetched-map
Jun 30, 2026
Merged

Fix panic when resolving secrets on first reconcile#459
henderiw merged 1 commit into
sensitivefrom
fix/configresolver-nil-fetched-map

Conversation

@steiler

@steiler steiler commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Initialize the pre-fetched secret map in detectChange when no SensitiveConfig exists yet, instead of returning nil
  • Add a defensive nil-map guard in buildLeafResolver so callers cannot trigger a panic on map assignment
  • Add a regression test covering the nil fetched map path

Context

On first reconcile (configChanged: true, no existing SensitiveConfig), the resolver passed a nil fetched map into buildLeafResolver, which panicked with assignment to entry in nil map when caching a fetched secret.

Test plan

  • go test ./pkg/reconcilers/configresolver/... -run Test_buildLeafResolver
  • Apply a Config with vars.secretRef on a fresh cluster (no existing SensitiveConfig) and confirm the resolver reconciles without panic

Made with Cursor

Initialize the pre-fetched secret map on first-time SensitiveConfig resolution so buildLeafResolver does not write to a nil map.

Co-authored-by: Cursor <cursoragent@cursor.com>
@steiler steiler requested a review from a team as a code owner June 29, 2026 12:11

@severindellsperger severindellsperger left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@henderiw henderiw merged commit 9070056 into sensitive Jun 30, 2026
5 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants