Skip to content

fix: allow system resource servers other than the My Account API to be updated - #1485

Open
erdtsieck wants to merge 2 commits into
auth0:masterfrom
erdtsieck:fix/system-resource-server-update
Open

fix: allow system resource servers other than the My Account API to be updated#1485
erdtsieck wants to merge 2 commits into
auth0:masterfrom
erdtsieck:fix/system-resource-server-update

Conversation

@erdtsieck

Copy link
Copy Markdown

🔧 Changes

updateResourceServer() decides whether to send the restricted payload with this guard:

if (update.is_system === true || update.name === 'Auth0 My Account API') {

Neither half holds up:

  • is_system is listed in stripUpdateFields, and stripFields() runs on the payload in
    DefaultHandler.processChanges() before updateResourceServer() is called. update.is_system
    is therefore always undefined and that branch is dead code.
  • The fallback matches one hardcoded name, so the Auth0 My Account API is the only system resource
    server that works. Every other one — the Auth0 My Organization API (https://{domain}/my-org/) in
    our case — takes the full-update path, which includes name, and the Management API rejects it
    with Payload validation error: 'Additional properties not allowed: name'.

Since calculateChanges() puts every matched asset into update whether or not anything changed,
this makes import fail on every run after the first, and it aborts the whole processChanges stage
for resourceServers.

This reads is_system off the existing resource server instead, which is where it actually survives —
getType() keeps is_system in its allowlist when it sanitizes system resource servers, and it runs
before processChanges(). The hardcoded name comparison then has nothing left to do and is removed:
the My Account API is covered by is_system like 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, which
mirrors 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 the name that the
Management API rejects; with this change it passes.

The existing system resource server tests (sanitizing in getType, authorization_policy in the
update payload, should update "Auth0 My Account API" without name and is_system) all still pass, so
the removed name comparison is not load-bearing.

Verified end-to-end against a real tenant as well, with AUTH0_INCLUDED_ONLY: ["resourceServers"] and
a config directory holding both system APIs. On 8.44.0 the first import creates both and the second
one fails on the My Organization API; with this change both runs are clean.

📝 Checklist

  • All new/changed/fixed functionality is covered by tests (or N/A)
  • I have added documentation for all new/changed functionality (or N/A) — N/A, bug fix with no
    public API or config surface change

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.
@erdtsieck
erdtsieck requested a review from a team as a code owner September 4, 2026 10:30
@erdtsieck

Copy link
Copy Markdown
Author

A note on the red E2E tests as Node module check, since it is not caused by this change:

Unit tests with Node LTS, Unit tests with Node current, TypeScript, lint and format are all green, and those cover the added regression test.

Happy to rebase or adjust anything if you would rather see this shaped differently.

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.

resourceServers: system resource servers other than Auth0 My Account API fail on every update (Additional properties not allowed: name)

1 participant