fix: allow system resource servers other than the My Account API to be updated - #1485
Open
erdtsieck wants to merge 2 commits into
Open
fix: allow system resource servers other than the My Account API to be updated#1485erdtsieck wants to merge 2 commits into
erdtsieck wants to merge 2 commits into
Conversation
stripUpdateFields removes is_system before updateResourceServer runs, so the guard only ever matched the hardcoded Auth0 My Account API name. Any other system resource server was sent a full update including name, which the Management API rejects.
Author
|
A note on the red E2E tests as Node module check, since it is not caused by this change:
Happy to rebase or adjust anything if you would rather see this shaped differently. |
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.
🔧 Changes
updateResourceServer()decides whether to send the restricted payload with this guard:Neither half holds up:
is_systemis listed instripUpdateFields, andstripFields()runs on the payload inDefaultHandler.processChanges()beforeupdateResourceServer()is called.update.is_systemis therefore always
undefinedand that branch is dead code.server that works. Every other one — the Auth0 My Organization API (
https://{domain}/my-org/) inour case — takes the full-update path, which includes
name, and the Management API rejects itwith
Payload validation error: 'Additional properties not allowed: name'.Since
calculateChanges()puts every matched asset intoupdatewhether or not anything changed,this makes
importfail on every run after the first, and it aborts the wholeprocessChangesstagefor
resourceServers.This reads
is_systemoff the existing resource server instead, which is where it actually survives —getType()keepsis_systemin its allowlist when it sanitizes system resource servers, and it runsbefore
processChanges(). The hardcoded name comparison then has nothing left to do and is removed:the My Account API is covered by
is_systemlike any other system resource server.No change in behaviour for the My Account API or for non-system resource servers.
📚 References
Fixes #1484
🔬 Testing
Added
should update a system resource server other than "Auth0 My Account API" without name, whichmirrors the existing My Account API test with the My Organization API. On master it fails with
expected 'Auth0 My Organization API' to equal undefined, which is exactly thenamethat theManagement API rejects; with this change it passes.
The existing system resource server tests (sanitizing in
getType,authorization_policyin theupdate payload,
should update "Auth0 My Account API" without name and is_system) all still pass, sothe removed name comparison is not load-bearing.
Verified end-to-end against a real tenant as well, with
AUTH0_INCLUDED_ONLY: ["resourceServers"]anda config directory holding both system APIs. On 8.44.0 the first
importcreates both and the secondone fails on the My Organization API; with this change both runs are clean.
📝 Checklist
public API or config surface change