Skip to content

fix(server): rebuild extension proxy registry when secrets change#1

Open
saidsef wants to merge 17 commits intomasterfrom
fix/extension-proxy-rebuild-on-secret-change
Open

fix(server): rebuild extension proxy registry when secrets change#1
saidsef wants to merge 17 commits intomasterfrom
fix/extension-proxy-rebuild-on-secret-change

Conversation

@saidsef
Copy link
Copy Markdown
Owner

@saidsef saidsef commented May 6, 2026

Summary

The watchSettings() loop in server.go only called UpdateExtensionRegistry() when ExtensionConfig (ConfigMap data) changed, but not when settings.Secrets changed. This meant that if the argocd-secret Secret was populated or updated after initial startup — for example by External Secrets Operator — the proxy extension registry was never rebuilt with resolved secret values.

UpdateExtensionRegistry() internally calls parseAndValidateConfig(), which invokes ReplaceMapSecrets() to substitute $key references with actual secret values. Without rebuilding the registry on secret changes, proxies continued sending literal strings like $openai-api-key to backend services, causing 401 authentication errors.

This PR adds a settings.Secrets change check alongside the existing ExtensionConfig check, ensuring the proxy registry is rebuilt whenever either the config or secrets change.

Changes

  • server/server.go: Track prevSecrets and rebuild registry when secrets change
  • server/extension/extension_test.go: Add TestUpdateExtensionRegistryWithSecrets to verify proxy headers update when secrets change

Test plan

  • Unit test added: TestUpdateExtensionRegistryWithSecrets passes
  • All existing extension tests pass
  • Verified locally that the proxy registry is rebuilt when settings.Secrets changes

Checklist

  • I have signed off all my commits as required by DCO
  • I have written unit tests for my change
  • My build is green
  • I have added a brief description of why this PR is necessary and what this PR solves

Related

@saidsef saidsef added the bug Something isn't working label May 6, 2026
@saidsef saidsef self-assigned this May 6, 2026
@saidsef saidsef force-pushed the fix/extension-proxy-rebuild-on-secret-change branch from 6b9fad6 to 17617fc Compare May 6, 2026 23:44
dependabot Bot and others added 15 commits May 7, 2026 10:50
…proj#27728)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
)

Signed-off-by: Rishmis94 <info.rishabhmishra@gmail.com>
…7679) (argoproj#27703)

Signed-off-by: Alexandre Gaudreault <alexandre_gaudreault@intuit.com>
…oj#27674)

Signed-off-by: Marco Groß (Marco Gross) <gross@b1-systems.de>
Co-authored-by: Marco Groß (Marco Gross) <gross@b1-systems.de>
…#25371)

Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: Oliver Gondža <ogondza@gmail.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Signed-off-by: rumstead <37445536+rumstead@users.noreply.github.com>
Signed-off-by: renovate[bot] <renovate[bot]@users.noreply.github.com>
Co-authored-by: argoproj-renovate[bot] <161757507+argoproj-renovate[bot]@users.noreply.github.com>
Signed-off-by: renovate[bot] <renovate[bot]@users.noreply.github.com>
Co-authored-by: argoproj-renovate[bot] <161757507+argoproj-renovate[bot]@users.noreply.github.com>
argoproj#27744)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…iner (argoproj#27748)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…container (argoproj#27747)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…rgoproj#27742)

Signed-off-by: renovate[bot] <renovate[bot]@users.noreply.github.com>
Co-authored-by: argoproj-renovate[bot] <161757507+argoproj-renovate[bot]@users.noreply.github.com>
…j#27745)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…argoproj#27009)

Signed-off-by: boostrack <boostrack@users.noreply.github.com>
Signed-off-by: Alexandre Gaudreault <alexandre_gaudreault@intuit.com>
Co-authored-by: Alexandre Gaudreault <alexandre_gaudreault@intuit.com>
@saidsef saidsef force-pushed the fix/extension-proxy-rebuild-on-secret-change branch from 17617fc to 6b9fad6 Compare May 9, 2026 14:25
The watchSettings() loop only called UpdateExtensionRegistry() when ExtensionConfig (ConfigMap data) changed, but not when settings.Secrets changed. This meant that if secrets were populated after initial startup (e.g. by External Secrets Operator), the proxy registry was never rebuilt with resolved secret values.

UpdateExtensionRegistry() runs parseAndValidateConfig() which calls ReplaceMapSecrets() to substitute $key references with actual secret values. Without rebuilding the registry on secret changes, proxies continued sending literal strings like $openai-api-key to backends, causing 401 errors.

Add a check for settings.Secrets changes alongside ExtensionConfig changes, and update prevSecrets accordingly. Also add a test that verifies proxy headers are updated when secrets change.

Signed-off-by: Said Sef <saidsef@gmail.com>
@saidsef saidsef force-pushed the fix/extension-proxy-rebuild-on-secret-change branch from 6b9fad6 to 28c0dd6 Compare May 9, 2026 14:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants