Skip to content

fix: accept scopes on identity provider update - #101

Open
atbagan wants to merge 1 commit into
mainfrom
fix/idp-update-scopes
Open

atbagan wants to merge 1 commit into
mainfrom
fix/idp-update-scopes

Conversation

@atbagan

@atbagan atbagan commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

Summary

PUT /admin/identity-providers/{name} answered an empty 500 whenever the body carried scopes. The handler stored the request's []string inside the unstructured object and unstructured.SetNestedMap deep-copies its argument with runtime.DeepCopyJSONValue, which panics on a Go string slice.

  • convert scopes to []interface{} on create and update
  • tests: the converted form survives SetNestedMap and reads back; a raw []string still panics (so the helper is provably needed); empty input

Reproduced live on butler-beta: an update with the provider's own current scopes returned 500; the same update without scopes returned 200 with an identical spec. Found while staging the Portal identity provider edit slice (butler-portal #79).

Not for merge as part of the parity train; staged for maintainer review.

Test plan

  • go build ./...
  • go test ./internal/api/handlers/ -run 'Scopes|SetNestedMap|ToUnstructured'
  • after deploy: PUT an identity provider with scopes set and confirm 200 and the scopes on the object

🤖 Generated with Claude Code

https://claude.ai/code/session_01APpgCYzvB1vEntdFm3py2n

Update stored the request's scopes as a Go string slice inside the
unstructured object. SetNestedMap deep-copies what it is given and the
deep copy only accepts JSON-shaped values, so it panicked and every
update that carried scopes answered an empty 500. Scopes are now
converted to the interface slice form on both create and update, and
tests pin the conversion and the panic it avoids.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01APpgCYzvB1vEntdFm3py2n
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.

1 participant