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.
|
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. |
|
Really appreciate this, the fix and the tests both look great and everything's passing on my end. Thank you for the thorough write-up too. Just one thing before I can merge: the commits need to be signed and verified for it to be merge-ready. Could you re-sign and force-push? It'd be good to bring the branch up to date with master while you're at it (we're on node-auth0 v7 now, applies cleanly). Once the commits show as verified, please drop a note here. We'll get this merged. |
🔧 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