Skip to content

Fix integration pointer aliasing during config reload#609

Merged
winhowes merged 1 commit intomainfrom
codex/fix-authentication/authorization-confusion-bug
Apr 11, 2026
Merged

Fix integration pointer aliasing during config reload#609
winhowes merged 1 commit intomainfrom
codex/fix-authentication/authorization-confusion-bug

Conversation

@winhowes
Copy link
Copy Markdown
Owner

Motivation

  • A reload bug caused each map entry to store the address of a loop-local copy, making all integrations alias the same object and behave like the final integration in the config.
  • This could cause incorrect auth/allowlist enforcement and route traffic to the wrong upstreams after a reload, so integrations must keep distinct pointers.

Description

  • Stop taking the address of the loop-local copy and instead take a pointer to the slice element with integ := &cfg.Integrations[i] and store that in the map via newMap[integ.Name] = integ in reload() (app/main.go).
  • Add a regression test TestReloadMultipleIntegrationsRemainDistinct in app/reload_test.go that reloads two integrations and asserts they are distinct pointers and have different destinations.

Testing

  • Ran go test ./app -run TestReloadMultipleIntegrationsRemainDistinct -count=1 -v and it passed.
  • Ran go test ./app -run TestReload -count=1 and it passed.

Codex Task

@winhowes winhowes merged commit d1569b6 into main Apr 11, 2026
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant