Repository navigation
fix(resourceServers): scope require_consent_non_repudiation to customer resource servers - #1533
Conversation
…er resource servers
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1533 +/- ##
==========================================
+ Coverage 82.54% 82.58% +0.03%
==========================================
Files 193 193
Lines 9289 9301 +12
Branches 2059 2061 +2
==========================================
+ Hits 7668 7681 +13
Misses 819 819
+ Partials 802 801 -1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Since this field is entitlement-gated, could you add a note to the PR description on the API shape this relies on? Specifically: does the resource server list endpoint return require_consent_non_repudiation for custom APIs (and as false or omitted when unset)? If it returns false on every API, export would write it into every custom API file, and re-importing to a tenant without my_account_consents would then 400.
Thanks!
| @@ -268,7 +267,6 @@ export default class ResourceServersHandler extends DefaultHandler { | |||
| update.skip_consent_for_verifiable_first_party_clients, | |||
| subject_type_authorization: update.subject_type_authorization, | |||
| authorization_policy: update.authorization_policy, | |||
There was a problem hiding this comment.
Minor: a config that still has require_consent_non_repudiation: true on Auth0 My Account API (e.g. copied from the #1508 example) is now dropped silently on import. The dry-run also reports a permanent UPDATE for it, because the remote side no longer carries the field (debug log: found in 'localObj' but not in 'remoteObj'). Could you add a log.warn when a system resource server config includes this field, and ideally ignore it in the dry-run comparison so it doesn't show a false UPDATE?
There was a problem hiding this comment.
Good catch, thanks! Reproduced the dry-run UPDATE. The field is now stripped from system resource servers with a log.warn before both the dry-run comparison and the real import, so there's no false UPDATE. I didn't use ignoreDryRunFields, because it applies to every resource server and would also hide real changes on custom APIs. Added tests for the warning, the dry-run result, and the custom-API case.
|
LGTM(pending merge conflicts) |
# Conflicts: # src/tools/auth0/handlers/resourceServers.ts # test/tools/auth0/handlers/resourceServers.tests.js
🔧 Changes
require_consent_non_repudiationis configured on customer resource servers (the APIs that rich authorization requests are made for). The system Auth0 My Account API resource server does not accept it: the Management API returns400 Additional properties not allowed. This PR aligns deploy-cli with that behaviour.src/tools/auth0/handlers/resourceServers.tsrequire_consent_non_repudiationfrom the system resource server export allowlist (sanitizeResourceServersFields) and update payload (updateResourceServer).stripSystemResourceServerFields. When a config sets the field on a system resource server (e.g. copied from the feat: support consent non-repudiation fields on resource server and client models #1508 example), it logs a warning and drops the field. It runs before both the real import (processChanges) and the dry-run comparison (dryRunChanges), so the dry run no longer reports a permanentUPDATE.ignoreDryRunFieldswasn't used because it applies to every resource server and would hide real changes on custom APIs.docs/resource-specific-documentation.md: therequire_consent_non_repudiationsection now shows the field on a customer API, with a note that the Auth0 My Account API does not currently accept it.My APIinexamples/yaml/tenant.yamlandexamples/directory/resource-servers/.API shape (EA)
Verified on a tenant with
my_account_consents/consent_non_repudiationenabled and with them disabled:GET /api/v2/resource-serversomitsrequire_consent_non_repudiationunless it has been set on that resource server, so export only writes it for APIs where it was configured.false.400 Additional properties not allowed, even withfalse.📚 References
🔬 Testing
Unit tests (
npm test, full suite passing):resourceServers.tests.jsrequire_consent_non_repudiationis not kept on export and not sent in the update payload.UPDATE.require_consent_non_repudiationis sent on create and update.UPDATE, with no warning.Manual verification, with the entitlement enabled:
true.true.false, value confirmed via the Management API.UPDATE.Manual verification, with the entitlement disabled:
📝 Checklist