auth0-deploy-cli 9.0.0-beta.2 → 9.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (129) hide show
  1. package/AGENTS.md +2 -357
  2. package/CHANGELOG.md +185 -10
  3. package/CLAUDE.md +138 -2
  4. package/README.md +1 -1
  5. package/lib/context/defaults.d.ts +7 -0
  6. package/lib/context/defaults.js +74 -30
  7. package/lib/context/directory/handlers/actionModules.js +1 -4
  8. package/lib/context/directory/handlers/actions.js +1 -4
  9. package/lib/context/directory/handlers/attackProtection.js +11 -1
  10. package/lib/context/directory/handlers/branding.js +4 -1
  11. package/lib/context/directory/handlers/clientAuthCredentials.d.ts +5 -0
  12. package/lib/context/directory/handlers/clientAuthCredentials.js +13 -0
  13. package/lib/context/directory/handlers/clientGrants.js +78 -24
  14. package/lib/context/directory/handlers/clients.js +20 -3
  15. package/lib/context/directory/handlers/connections.js +19 -5
  16. package/lib/context/directory/handlers/databases.js +1 -4
  17. package/lib/context/directory/handlers/emailTemplates.js +5 -0
  18. package/lib/context/directory/handlers/guardianEmailFactorSettings.d.ts +5 -0
  19. package/lib/context/directory/handlers/guardianEmailFactorSettings.js +38 -0
  20. package/lib/context/directory/handlers/guardianPhoneFactorSettings.d.ts +5 -0
  21. package/lib/context/directory/handlers/guardianPhoneFactorSettings.js +38 -0
  22. package/lib/context/directory/handlers/guardianSettings.d.ts +5 -0
  23. package/lib/context/directory/handlers/guardianSettings.js +38 -0
  24. package/lib/context/directory/handlers/hooks.js +1 -4
  25. package/lib/context/directory/handlers/index.js +12 -0
  26. package/lib/context/directory/handlers/networkACLKeys.d.ts +6 -0
  27. package/lib/context/directory/handlers/networkACLKeys.js +54 -0
  28. package/lib/context/directory/handlers/prompts.js +7 -3
  29. package/lib/context/directory/handlers/rateLimitPolicies.d.ts +6 -0
  30. package/lib/context/directory/handlers/rateLimitPolicies.js +53 -0
  31. package/lib/context/directory/handlers/rules.js +1 -4
  32. package/lib/context/directory/index.js +1 -4
  33. package/lib/context/index.js +32 -31
  34. package/lib/context/yaml/handlers/attackProtection.js +5 -2
  35. package/lib/context/yaml/handlers/branding.js +4 -1
  36. package/lib/context/yaml/handlers/clientAuthCredentials.d.ts +5 -0
  37. package/lib/context/yaml/handlers/clientAuthCredentials.js +13 -0
  38. package/lib/context/yaml/handlers/clients.js +19 -1
  39. package/lib/context/yaml/handlers/connections.js +8 -1
  40. package/lib/context/yaml/handlers/flows.js +3 -0
  41. package/lib/context/yaml/handlers/forms.js +3 -0
  42. package/lib/context/yaml/handlers/guardianEmailFactorSettings.d.ts +5 -0
  43. package/lib/context/yaml/handlers/guardianEmailFactorSettings.js +15 -0
  44. package/lib/context/yaml/handlers/guardianPhoneFactorSettings.d.ts +5 -0
  45. package/lib/context/yaml/handlers/guardianPhoneFactorSettings.js +15 -0
  46. package/lib/context/yaml/handlers/guardianSettings.d.ts +5 -0
  47. package/lib/context/yaml/handlers/guardianSettings.js +15 -0
  48. package/lib/context/yaml/handlers/index.js +12 -0
  49. package/lib/context/yaml/handlers/networkACLKeys.d.ts +6 -0
  50. package/lib/context/yaml/handlers/networkACLKeys.js +42 -0
  51. package/lib/context/yaml/handlers/prompts.js +3 -1
  52. package/lib/context/yaml/handlers/rateLimitPolicies.d.ts +6 -0
  53. package/lib/context/yaml/handlers/rateLimitPolicies.js +27 -0
  54. package/lib/context/yaml/index.js +85 -7
  55. package/lib/keywordPreservation.d.ts +1 -1
  56. package/lib/keywordPreservation.js +2 -1
  57. package/lib/readonly.js +5 -0
  58. package/lib/tools/auth0/handlers/attackProtection.d.ts +12 -0
  59. package/lib/tools/auth0/handlers/attackProtection.js +66 -6
  60. package/lib/tools/auth0/handlers/clientAuthCredentials.d.ts +27 -0
  61. package/lib/tools/auth0/handlers/clientAuthCredentials.js +234 -0
  62. package/lib/tools/auth0/handlers/clientAuthCredentialsPre.d.ts +38 -0
  63. package/lib/tools/auth0/handlers/clientAuthCredentialsPre.js +123 -0
  64. package/lib/tools/auth0/handlers/clientGrants.d.ts +1 -1
  65. package/lib/tools/auth0/handlers/clients.d.ts +106 -0
  66. package/lib/tools/auth0/handlers/clients.js +207 -3
  67. package/lib/tools/auth0/handlers/connectionProfiles.d.ts +27 -0
  68. package/lib/tools/auth0/handlers/connectionProfiles.js +30 -0
  69. package/lib/tools/auth0/handlers/connections.d.ts +34 -6
  70. package/lib/tools/auth0/handlers/connections.js +75 -11
  71. package/lib/tools/auth0/handlers/databases.d.ts +28 -0
  72. package/lib/tools/auth0/handlers/databases.js +58 -24
  73. package/lib/tools/auth0/handlers/default.d.ts +23 -0
  74. package/lib/tools/auth0/handlers/default.js +47 -29
  75. package/lib/tools/auth0/handlers/eventStreams.js +10 -2
  76. package/lib/tools/auth0/handlers/guardianEmailFactorSettings.d.ts +22 -0
  77. package/lib/tools/auth0/handlers/guardianEmailFactorSettings.js +77 -0
  78. package/lib/tools/auth0/handlers/guardianFactorTemplates.js +13 -4
  79. package/lib/tools/auth0/handlers/guardianPhoneFactorMessageTypes.js +11 -9
  80. package/lib/tools/auth0/handlers/guardianPhoneFactorSelectedProvider.js +11 -9
  81. package/lib/tools/auth0/handlers/guardianPhoneFactorSettings.d.ts +22 -0
  82. package/lib/tools/auth0/handlers/guardianPhoneFactorSettings.js +77 -0
  83. package/lib/tools/auth0/handlers/guardianPolicies.js +11 -1
  84. package/lib/tools/auth0/handlers/guardianSettings.d.ts +30 -0
  85. package/lib/tools/auth0/handlers/guardianSettings.js +85 -0
  86. package/lib/tools/auth0/handlers/hooks.js +1 -1
  87. package/lib/tools/auth0/handlers/index.js +16 -0
  88. package/lib/tools/auth0/handlers/networkACLKeys.d.ts +45 -0
  89. package/lib/tools/auth0/handlers/networkACLKeys.js +177 -0
  90. package/lib/tools/auth0/handlers/networkACLs.d.ts +132 -2
  91. package/lib/tools/auth0/handlers/networkACLs.js +100 -16
  92. package/lib/tools/auth0/handlers/organizations.d.ts +33 -1
  93. package/lib/tools/auth0/handlers/organizations.js +177 -19
  94. package/lib/tools/auth0/handlers/phoneProvider.js +10 -2
  95. package/lib/tools/auth0/handlers/phoneTemplates.d.ts +4 -1
  96. package/lib/tools/auth0/handlers/phoneTemplates.js +67 -10
  97. package/lib/tools/auth0/handlers/prompts.d.ts +17 -0
  98. package/lib/tools/auth0/handlers/prompts.js +47 -14
  99. package/lib/tools/auth0/handlers/rateLimitPolicies.d.ts +81 -0
  100. package/lib/tools/auth0/handlers/rateLimitPolicies.js +203 -0
  101. package/lib/tools/auth0/handlers/resourceServers.d.ts +48 -0
  102. package/lib/tools/auth0/handlers/resourceServers.js +56 -2
  103. package/lib/tools/auth0/handlers/riskAssessment.d.ts +1 -1
  104. package/lib/tools/auth0/handlers/riskAssessment.js +19 -1
  105. package/lib/tools/auth0/handlers/roles.d.ts +4 -0
  106. package/lib/tools/auth0/handlers/roles.js +27 -9
  107. package/lib/tools/auth0/handlers/rules.js +19 -7
  108. package/lib/tools/auth0/handlers/scimHandler.js +8 -3
  109. package/lib/tools/auth0/handlers/tenant.d.ts +45 -0
  110. package/lib/tools/auth0/handlers/tenant.js +48 -0
  111. package/lib/tools/auth0/handlers/themes.d.ts +37 -1
  112. package/lib/tools/auth0/handlers/themes.js +64 -0
  113. package/lib/tools/auth0/handlers/tokenExchangeProfiles.js +3 -1
  114. package/lib/tools/auth0/index.js +12 -6
  115. package/lib/tools/calculateDryRunChanges.js +12 -8
  116. package/lib/tools/constants.d.ts +3 -0
  117. package/lib/tools/constants.js +8 -0
  118. package/lib/tools/utils.d.ts +3 -0
  119. package/lib/tools/utils.js +41 -2
  120. package/lib/types.d.ts +10 -1
  121. package/lib/utils.d.ts +6 -0
  122. package/lib/utils.js +17 -2
  123. package/package.json +2 -2
  124. package/references/code-style.md +133 -0
  125. package/references/commands.md +98 -0
  126. package/references/docs-update.md +34 -0
  127. package/references/git-workflow.md +135 -0
  128. package/references/pitfalls.md +62 -0
  129. package/references/testing.md +118 -0
@@ -0,0 +1,234 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __importDefault = (this && this.__importDefault) || function (mod) {
9
+ return (mod && mod.__esModule) ? mod : { "default": mod };
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.schema = void 0;
13
+ const default_1 = require("./default");
14
+ const client_1 = require("../client");
15
+ const logger_1 = __importDefault(require("../../../logger"));
16
+ exports.schema = {
17
+ type: 'array',
18
+ items: { type: 'object' },
19
+ };
20
+ const CREDENTIAL_TYPE_TO_METHOD = {
21
+ public_key: 'private_key_jwt',
22
+ x509_cert: 'self_signed_tls_client_auth',
23
+ cert_subject_dn: 'tls_client_auth',
24
+ };
25
+ class ClientAuthCredentialsHandler {
26
+ constructor({ client, config }) {
27
+ this.type = 'clientAuthCredentials';
28
+ this.existing = null;
29
+ this.client = client;
30
+ this.config = config;
31
+ }
32
+ async getType() {
33
+ return null;
34
+ }
35
+ async load() {
36
+ logger_1.default.info(`Retrieving ${this.type} data from Auth0`);
37
+ return { [this.type]: null };
38
+ }
39
+ async validate() {
40
+ return null;
41
+ }
42
+ // Credentials are per-client sub-resources with no top-level asset list, so they are not
43
+ // modeled in the dry-run diff. Return empty changes so the dry-run loop (which calls
44
+ // dryRunChanges on every handler) does not crash. Credential changes are still applied
45
+ // during a real import via processChanges.
46
+ async dryRunChanges(_assets) {
47
+ return { del: [], create: [], conflicts: [], update: [] };
48
+ }
49
+ async processChanges(assets) {
50
+ const { clients } = assets;
51
+ if (!clients)
52
+ return;
53
+ const allowDelete = this.config('AUTH0_ALLOW_DELETE') === true || this.config('AUTH0_ALLOW_DELETE') === 'true';
54
+ // Only process clients that have client_authentication_methods in config.
55
+ // Full deletion (absent field) is handled by ClientAuthCredentialsPreHandler at order 40,
56
+ // before clients.ts runs. This handler only manages create and partial delete.
57
+ const clientsWithCam = clients.filter((c) => c.client_authentication_methods !== undefined);
58
+ if (clientsWithCam.length === 0)
59
+ return;
60
+ // In directory mode client_id is stripped. Resolve names for PKI clients only.
61
+ const needsNameResolution = clientsWithCam.some((c) => !c.client_id);
62
+ let clientIdByName = new Map();
63
+ if (needsNameResolution) {
64
+ const existingClients = await (0, client_1.paginate)(this.client.clients.list, {
65
+ paginate: true,
66
+ is_global: false,
67
+ });
68
+ clientIdByName = new Map(existingClients.map((c) => [c.name, c.client_id]));
69
+ }
70
+ for (const client of clientsWithCam) {
71
+ const clientId = client.client_id || (client.name && clientIdByName.get(client.name));
72
+ if (!clientId)
73
+ continue;
74
+ client.client_id = clientId;
75
+ const clientName = client.name || clientId;
76
+ // Collect all desired credentials across all auth methods (only pem-bearing entries)
77
+ const desired = [];
78
+ if (client.client_authentication_methods) {
79
+ for (const [methodKey, methodVal] of Object.entries(client.client_authentication_methods)) {
80
+ const credentials = methodVal?.credentials || [];
81
+ for (const cred of credentials) {
82
+ if (!cred.pem)
83
+ continue;
84
+ desired.push({
85
+ name: cred.name,
86
+ pem: cred.pem,
87
+ credential_type: cred.credential_type || this.inferCredentialType(methodKey),
88
+ method: methodKey,
89
+ kid: cred.kid,
90
+ alg: cred.alg,
91
+ expires_at: cred.expires_at,
92
+ parse_expiry_from_cert: cred.parse_expiry_from_cert,
93
+ });
94
+ }
95
+ }
96
+ }
97
+ // pem is the opt-in signal: present field with no pem = skip (safe export→deploy);
98
+ // absent field = fall through to delete path (intentional removal).
99
+ if (desired.length === 0 && client.client_authentication_methods)
100
+ continue;
101
+ let existing = [];
102
+ try {
103
+ existing = (await this.client.clients.credentials.list(clientId));
104
+ }
105
+ catch (err) {
106
+ logger_1.default.warn(`clientAuthCredentials: failed to list credentials for client "${clientName}": ${err}`);
107
+ continue;
108
+ }
109
+ // No credentials in Auth0 and none desired — nothing to do.
110
+ if (existing.length === 0 && desired.length === 0)
111
+ continue;
112
+ // Warn if duplicate names exist in Auth0 — we can't match safely
113
+ const existingNames = existing.map((c) => c.name);
114
+ const duplicateNames = existingNames.filter((n, i) => existingNames.indexOf(n) !== i);
115
+ if (duplicateNames.length > 0) {
116
+ logger_1.default.warn(`clientAuthCredentials: client "${clientName}" has duplicate credential names in Auth0 [${duplicateNames.join(', ')}] — skipping credential reconciliation for this client`);
117
+ continue;
118
+ }
119
+ const existingByName = new Map(existing.map((c) => [c.name, c]));
120
+ const desiredNames = new Set(desired.map((d) => d.name));
121
+ const toCreate = desired.filter((d) => !existingByName.has(d.name));
122
+ const toDelete = existing.filter((e) => !desiredNames.has(e.name));
123
+ // Creates first — Auth0 allows max 2 credentials; both must exist simultaneously during rotation
124
+ // Track name→id so we can correctly attribute each created credential to its method later.
125
+ const createdIdByName = new Map();
126
+ for (const cred of toCreate) {
127
+ try {
128
+ // Forward all API-accepted fields. `!= null` drops unset (undefined) and empty
129
+ // (YAML `kid:` → null) values the API rejects, while keeping an explicit `false`.
130
+ const createPayload = Object.fromEntries(Object.entries({
131
+ name: cred.name,
132
+ pem: cred.pem,
133
+ credential_type: cred.credential_type,
134
+ kid: cred.kid,
135
+ alg: cred.alg,
136
+ expires_at: cred.expires_at,
137
+ parse_expiry_from_cert: cred.parse_expiry_from_cert,
138
+ }).filter(([, v]) => v != null));
139
+ const created = await this.client.clients.credentials.create(clientId, createPayload);
140
+ logger_1.default.info(`clientAuthCredentials: created credential "${cred.name}" on client "${clientName}"`);
141
+ createdIdByName.set(cred.name, created.id);
142
+ }
143
+ catch (err) {
144
+ logger_1.default.warn(`clientAuthCredentials: failed to create credential "${cred.name}" on client "${clientName}": ${err}`);
145
+ }
146
+ }
147
+ // Re-wire client_authentication_methods with final IDs (kept + newly created).
148
+ // This must happen BEFORE deletes — Auth0 rejects deleting a credential that
149
+ // is still referenced in client_authentication_methods.
150
+ const keptIds = existing.filter((e) => desiredNames.has(e.name)).map((e) => e.id);
151
+ const createdIds = [...createdIdByName.values()];
152
+ const finalIds = [...keptIds, ...createdIds];
153
+ let updatedAuthMethods = null;
154
+ if (finalIds.length > 0) {
155
+ // Build method→ids map. For kept credentials use Auth0's stored type to infer method;
156
+ // for created credentials use the method from the user's config entry (by name).
157
+ const methodToIds = {};
158
+ for (const id of finalIds) {
159
+ const fromExisting = existing.find((e) => e.id === id);
160
+ const createdName = [...createdIdByName.entries()].find(([, cid]) => cid === id)?.[0];
161
+ const fromDesired = createdName ? desired.find((d) => d.name === createdName) : undefined;
162
+ const methodKey = (fromExisting && this.inferMethodFromType(fromExisting.credential_type)) ||
163
+ (fromDesired && fromDesired.method) ||
164
+ Object.keys(client.client_authentication_methods)[0];
165
+ if (!methodToIds[methodKey])
166
+ methodToIds[methodKey] = [];
167
+ methodToIds[methodKey].push(id);
168
+ }
169
+ updatedAuthMethods = {};
170
+ for (const [methodKey, ids] of Object.entries(methodToIds)) {
171
+ updatedAuthMethods[methodKey] = { credentials: ids.map((id) => ({ id })) };
172
+ }
173
+ }
174
+ // Always update client_authentication_methods before deletes:
175
+ // - When finalIds > 0: re-wire to the remaining credentials
176
+ // - When finalIds === 0 but toDelete > 0: set to null so Auth0 de-references them first
177
+ if (finalIds.length > 0 || toDelete.length > 0) {
178
+ try {
179
+ const payload = {
180
+ client_authentication_methods: updatedAuthMethods ?? null,
181
+ };
182
+ // Auth0 requires token_endpoint_auth_method: null when setting client_authentication_methods,
183
+ // and a non-null value when clearing it.
184
+ if (updatedAuthMethods) {
185
+ payload.token_endpoint_auth_method = null;
186
+ }
187
+ else {
188
+ payload.token_endpoint_auth_method =
189
+ client.token_endpoint_auth_method || 'client_secret_post';
190
+ }
191
+ await this.client.clients.update(clientId, payload);
192
+ logger_1.default.info(`clientAuthCredentials: updated client_authentication_methods on client "${clientName}"`);
193
+ }
194
+ catch (err) {
195
+ logger_1.default.warn(`clientAuthCredentials: failed to update client_authentication_methods on client "${clientName}": ${err}`);
196
+ }
197
+ }
198
+ // Deletes last — after client_authentication_methods no longer references them
199
+ if (toDelete.length > 0) {
200
+ if (!allowDelete) {
201
+ logger_1.default.warn(`clientAuthCredentials: the following credentials on client "${clientName}" would be deleted but AUTH0_ALLOW_DELETE is not set:\n${toDelete
202
+ .map((c) => ` ${c.name} (${c.id})`)
203
+ .join('\n')}`);
204
+ }
205
+ else {
206
+ for (const cred of toDelete) {
207
+ try {
208
+ await this.client.clients.credentials.delete(clientId, cred.id);
209
+ logger_1.default.info(`clientAuthCredentials: deleted credential "${cred.name}" on client "${clientName}"`);
210
+ }
211
+ catch (err) {
212
+ logger_1.default.warn(`clientAuthCredentials: failed to delete credential "${cred.name}" on client "${clientName}": ${err}`);
213
+ }
214
+ }
215
+ }
216
+ }
217
+ }
218
+ }
219
+ inferCredentialType(methodKey) {
220
+ const map = {
221
+ private_key_jwt: 'public_key',
222
+ self_signed_tls_client_auth: 'x509_cert',
223
+ tls_client_auth: 'cert_subject_dn',
224
+ };
225
+ return map[methodKey] || 'public_key';
226
+ }
227
+ inferMethodFromType(credentialType) {
228
+ return CREDENTIAL_TYPE_TO_METHOD[credentialType] || 'private_key_jwt';
229
+ }
230
+ }
231
+ exports.default = ClientAuthCredentialsHandler;
232
+ __decorate([
233
+ (0, default_1.order)('70')
234
+ ], ClientAuthCredentialsHandler.prototype, "processChanges", null);
@@ -0,0 +1,38 @@
1
+ import { Assets, Auth0APIClient, CalculatedChanges } from '../../../types';
2
+ import { ConfigFunction } from '../../../configFactory';
3
+ export declare const schema: {
4
+ type: string;
5
+ items: {
6
+ type: string;
7
+ };
8
+ };
9
+ /**
10
+ * Handles full credential deletion BEFORE clients.ts (order 50) patches the client.
11
+ *
12
+ * Auth0 rejects a client PATCH containing token_endpoint_auth_method while that client still
13
+ * has active credentials. By running at order 40, this handler clears credentials (and
14
+ * client_authentication_methods) for any client where the field is absent from config, so
15
+ * that clients.ts can safely include token_endpoint_auth_method in its PATCH.
16
+ *
17
+ * Partial deletion (some credentials removed, others kept) is handled by
18
+ * ClientAuthCredentialsHandler at order 70, because those clients still have
19
+ * client_authentication_methods present in config and clients.ts strips token_endpoint_auth_method
20
+ * for them anyway.
21
+ */
22
+ export default class ClientAuthCredentialsPreHandler {
23
+ client: Auth0APIClient;
24
+ config: ConfigFunction;
25
+ type: string;
26
+ existing: null;
27
+ constructor({ client, config }: {
28
+ client: Auth0APIClient;
29
+ config: ConfigFunction;
30
+ });
31
+ getType(): Promise<null>;
32
+ load(): Promise<{
33
+ [x: string]: null;
34
+ }>;
35
+ validate(): Promise<null>;
36
+ dryRunChanges(_assets: Assets): Promise<CalculatedChanges>;
37
+ processChanges(assets: Assets): Promise<void>;
38
+ }
@@ -0,0 +1,123 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __importDefault = (this && this.__importDefault) || function (mod) {
9
+ return (mod && mod.__esModule) ? mod : { "default": mod };
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.schema = void 0;
13
+ const default_1 = require("./default");
14
+ const client_1 = require("../client");
15
+ const logger_1 = __importDefault(require("../../../logger"));
16
+ exports.schema = {
17
+ type: 'array',
18
+ items: { type: 'object' },
19
+ };
20
+ /**
21
+ * Handles full credential deletion BEFORE clients.ts (order 50) patches the client.
22
+ *
23
+ * Auth0 rejects a client PATCH containing token_endpoint_auth_method while that client still
24
+ * has active credentials. By running at order 40, this handler clears credentials (and
25
+ * client_authentication_methods) for any client where the field is absent from config, so
26
+ * that clients.ts can safely include token_endpoint_auth_method in its PATCH.
27
+ *
28
+ * Partial deletion (some credentials removed, others kept) is handled by
29
+ * ClientAuthCredentialsHandler at order 70, because those clients still have
30
+ * client_authentication_methods present in config and clients.ts strips token_endpoint_auth_method
31
+ * for them anyway.
32
+ */
33
+ class ClientAuthCredentialsPreHandler {
34
+ constructor({ client, config }) {
35
+ // Same type as ClientAuthCredentialsHandler so AUTH0_EXCLUDED / AUTH0_INCLUDED_ONLY
36
+ // applies to both handlers together without needing a separate AssetTypes entry.
37
+ this.type = 'clientAuthCredentials';
38
+ this.existing = null;
39
+ this.client = client;
40
+ this.config = config;
41
+ }
42
+ async getType() {
43
+ return null;
44
+ }
45
+ async load() {
46
+ return { [this.type]: null };
47
+ }
48
+ async validate() {
49
+ return null;
50
+ }
51
+ // Deploy-only pre-pass handler with no dry-run representation. Return empty changes so the
52
+ // dry-run loop (which calls dryRunChanges on every registered handler) does not crash.
53
+ async dryRunChanges(_assets) {
54
+ return { del: [], create: [], conflicts: [], update: [] };
55
+ }
56
+ async processChanges(assets) {
57
+ const { clients } = assets;
58
+ if (!clients)
59
+ return;
60
+ const allowDelete = this.config('AUTH0_ALLOW_DELETE') === true || this.config('AUTH0_ALLOW_DELETE') === 'true';
61
+ // When allowDelete is false no deletion will happen — skip entirely to avoid
62
+ // unnecessary GET /credentials calls for every client.
63
+ if (!allowDelete)
64
+ return;
65
+ // Only act on clients where client_authentication_methods is absent from config.
66
+ // Absent = intentional full deletion. Clients with the field present (including partial
67
+ // deletion) are fully handled by ClientAuthCredentialsHandler at order 70.
68
+ const deletionCandidates = clients.filter((c) => c.client_authentication_methods === undefined);
69
+ if (deletionCandidates.length === 0)
70
+ return;
71
+ // In directory mode client_id is stripped. Resolve names once for all candidates.
72
+ const needsNameResolution = deletionCandidates.some((c) => !c.client_id);
73
+ let clientIdByName = new Map();
74
+ if (needsNameResolution) {
75
+ const existingClients = await (0, client_1.paginate)(this.client.clients.list, {
76
+ paginate: true,
77
+ is_global: false,
78
+ });
79
+ clientIdByName = new Map(existingClients.map((c) => [c.name, c.client_id]));
80
+ }
81
+ for (const client of deletionCandidates) {
82
+ const clientId = client.client_id || (client.name && clientIdByName.get(client.name));
83
+ if (!clientId)
84
+ continue;
85
+ const clientName = client.name || clientId;
86
+ let existing = [];
87
+ try {
88
+ existing = (await this.client.clients.credentials.list(clientId));
89
+ }
90
+ catch (err) {
91
+ logger_1.default.warn(`clientAuthCredentials: failed to list credentials for client "${clientName}": ${err}`);
92
+ continue;
93
+ }
94
+ if (existing.length === 0)
95
+ continue;
96
+ // De-reference credentials from client_authentication_methods before deleting them —
97
+ // Auth0 rejects deleting a credential that is still referenced.
98
+ try {
99
+ await this.client.clients.update(clientId, {
100
+ client_authentication_methods: null,
101
+ token_endpoint_auth_method: client.token_endpoint_auth_method || 'client_secret_post',
102
+ });
103
+ }
104
+ catch (err) {
105
+ logger_1.default.warn(`clientAuthCredentials: failed to clear client_authentication_methods on client "${clientName}": ${err}`);
106
+ continue;
107
+ }
108
+ for (const cred of existing) {
109
+ try {
110
+ await this.client.clients.credentials.delete(clientId, cred.id);
111
+ logger_1.default.info(`clientAuthCredentials: deleted credential "${cred.name}" on client "${clientName}"`);
112
+ }
113
+ catch (err) {
114
+ logger_1.default.warn(`clientAuthCredentials: failed to delete credential "${cred.name}" on client "${clientName}": ${err}`);
115
+ }
116
+ }
117
+ }
118
+ }
119
+ }
120
+ exports.default = ClientAuthCredentialsPreHandler;
121
+ __decorate([
122
+ (0, default_1.order)('40')
123
+ ], ClientAuthCredentialsPreHandler.prototype, "processChanges", null);
@@ -22,7 +22,7 @@ export declare const schema: {
22
22
  };
23
23
  subject_type: {
24
24
  type: string;
25
- enum: ("client" | "user")[];
25
+ enum: ("client" | "user" | "anonymous_user")[];
26
26
  description: string;
27
27
  };
28
28
  authorization_details_types: {
@@ -193,10 +193,53 @@ export declare const schema: {
193
193
  };
194
194
  additionalProperties: boolean;
195
195
  };
196
+ identity_assertion_authorization_grant: {
197
+ type: string;
198
+ description: string;
199
+ properties: {
200
+ active: {
201
+ type: string;
202
+ description: string;
203
+ };
204
+ };
205
+ required: string[];
206
+ additionalProperties: boolean;
207
+ };
208
+ anonymous_sessions: {
209
+ type: string;
210
+ description: string;
211
+ properties: {
212
+ active: {
213
+ type: string;
214
+ description: string;
215
+ };
216
+ };
217
+ required: string[];
218
+ additionalProperties: boolean;
219
+ };
196
220
  app_type: {
197
221
  type: string;
198
222
  description: string;
199
223
  };
224
+ b2b_integration_configuration: {
225
+ type: string[];
226
+ description: string;
227
+ properties: {
228
+ integration_type: {
229
+ type: string;
230
+ enum: string[];
231
+ description: string;
232
+ };
233
+ sso_profiles: {
234
+ type: string;
235
+ description: string;
236
+ items: {
237
+ type: string;
238
+ };
239
+ };
240
+ };
241
+ additionalProperties: boolean;
242
+ };
200
243
  resource_server_identifier: {
201
244
  type: string;
202
245
  description: string;
@@ -242,10 +285,39 @@ export declare const schema: {
242
285
  enum: ("allow" | "allow_if_empty")[];
243
286
  description: string;
244
287
  };
288
+ third_party_client_access: {
289
+ type: string;
290
+ description: string;
291
+ properties: {
292
+ default_value: {
293
+ type: string;
294
+ enum: "block"[];
295
+ description: string;
296
+ };
297
+ allowed_values: {
298
+ type: string;
299
+ items: {
300
+ type: string;
301
+ enum: ("allow" | "block")[];
302
+ };
303
+ uniqueItems: boolean;
304
+ description: string;
305
+ };
306
+ };
307
+ required: string[];
308
+ };
245
309
  invitation_landing_client_id: {
246
310
  type: string;
247
311
  description: string;
248
312
  };
313
+ enforce_permission_ceiling: {
314
+ type: string;
315
+ description: string;
316
+ };
317
+ enforce_self_assignment_restriction: {
318
+ type: string;
319
+ description: string;
320
+ };
249
321
  };
250
322
  required: string[];
251
323
  };
@@ -328,6 +400,40 @@ export declare const schema: {
328
400
  };
329
401
  };
330
402
  };
403
+ token_vault_privileged_access: {
404
+ type: string[];
405
+ description: string;
406
+ properties: {
407
+ ip_allowlist: {
408
+ type: string;
409
+ description: string;
410
+ items: {
411
+ type: string;
412
+ };
413
+ };
414
+ grants: {
415
+ type: string;
416
+ description: string;
417
+ items: {
418
+ type: string;
419
+ properties: {
420
+ connection: {
421
+ type: string;
422
+ description: string;
423
+ };
424
+ scopes: {
425
+ type: string;
426
+ description: string;
427
+ items: {
428
+ type: string;
429
+ };
430
+ };
431
+ };
432
+ required: string[];
433
+ };
434
+ };
435
+ };
436
+ };
331
437
  third_party_security_mode: {
332
438
  type: string;
333
439
  enum: string[];