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
@@ -7,6 +7,7 @@ exports.schema = void 0;
7
7
  const default_1 = __importDefault(require("./default"));
8
8
  const constants_1 = __importDefault(require("../../constants"));
9
9
  const utils_1 = require("../../utils");
10
+ const logger_1 = __importDefault(require("../../../logger"));
10
11
  exports.schema = {
11
12
  type: 'object',
12
13
  properties: {
@@ -48,7 +49,16 @@ class GuardianPoliciesHandler extends default_1.default {
48
49
  }
49
50
  }
50
51
  const data = guardianPolicies.policies;
51
- await this.client.guardian.policies.set(data);
52
+ try {
53
+ await this.client.guardian.policies.set(data);
54
+ }
55
+ catch (err) {
56
+ if ((0, utils_1.isInsufficientEntitlementError)(err)) {
57
+ logger_1.default.warn('Skipping guardianPolicies deploy: tenant does not have Adaptive MFA entitlement (confidence-score requires an Enterprise add-on)');
58
+ return;
59
+ }
60
+ throw err;
61
+ }
52
62
  this.updated += 1;
53
63
  this.didUpdate(guardianPolicies);
54
64
  }
@@ -0,0 +1,30 @@
1
+ import DefaultHandler from './default';
2
+ import { Asset, Assets } from '../../../types';
3
+ export declare const schema: {
4
+ type: string;
5
+ properties: {
6
+ display_remember_me_checkbox: {
7
+ type: string;
8
+ description: string;
9
+ };
10
+ remember_me_default_value: {
11
+ type: string;
12
+ description: string;
13
+ };
14
+ mfa_session_inactivity_timeout: {
15
+ type: string;
16
+ description: string;
17
+ };
18
+ mfa_session_overall_timeout: {
19
+ type: string;
20
+ description: string;
21
+ };
22
+ };
23
+ additionalProperties: boolean;
24
+ };
25
+ export default class GuardianSettingsHandler extends DefaultHandler {
26
+ existing: Asset;
27
+ constructor(options: any);
28
+ getType(): Promise<Asset | null>;
29
+ processChanges(assets: Assets): Promise<void>;
30
+ }
@@ -0,0 +1,85 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.schema = void 0;
7
+ const default_1 = __importDefault(require("./default"));
8
+ const utils_1 = require("../../utils");
9
+ exports.schema = {
10
+ type: 'object',
11
+ properties: {
12
+ display_remember_me_checkbox: {
13
+ type: 'boolean',
14
+ description: 'Determines whether to display the "Remember Me" checkbox on the MFA prompt in Universal Login.',
15
+ },
16
+ remember_me_default_value: {
17
+ type: 'boolean',
18
+ description: 'Determines the default state of the "Remember Me" checkbox on the MFA prompt in Universal Login.',
19
+ },
20
+ mfa_session_inactivity_timeout: {
21
+ type: 'number',
22
+ description: 'Duration of inactivity (seconds) after which the user will be prompted for MFA. Cannot exceed the overall timeout.',
23
+ },
24
+ mfa_session_overall_timeout: {
25
+ type: 'number',
26
+ description: 'Maximum duration (seconds) after which the user will be prompted for MFA regardless of activity.',
27
+ },
28
+ },
29
+ additionalProperties: false,
30
+ };
31
+ class GuardianSettingsHandler extends default_1.default {
32
+ constructor(options) {
33
+ super({
34
+ ...options,
35
+ type: 'guardianSettings',
36
+ });
37
+ }
38
+ async getType() {
39
+ if (this.existing)
40
+ return this.existing;
41
+ try {
42
+ const data = await this.client.guardian.get();
43
+ this.existing = data;
44
+ }
45
+ catch (err) {
46
+ if ((0, utils_1.isFeatureUnavailableError)(err)) {
47
+ // Gracefully skip processing this configuration value.
48
+ return null;
49
+ }
50
+ if ((0, utils_1.isForbiddenFeatureError)(err, this.type)) {
51
+ return null;
52
+ }
53
+ throw err;
54
+ }
55
+ return this.existing;
56
+ }
57
+ async processChanges(assets) {
58
+ // No API to delete or create guardianSettings, we can only update.
59
+ const { guardianSettings } = assets;
60
+ // Do nothing if not set
61
+ if (!guardianSettings) {
62
+ return;
63
+ }
64
+ if ((0, utils_1.isDryRun)(this.config)) {
65
+ const { del, update, create } = await this.calcChanges(assets);
66
+ if (create.length === 0 && update.length === 0 && del.length === 0) {
67
+ return;
68
+ }
69
+ }
70
+ try {
71
+ await this.client.guardian.set(guardianSettings);
72
+ }
73
+ catch (err) {
74
+ if ((0, utils_1.isFeatureUnavailableError)(err) || (0, utils_1.isForbiddenFeatureError)(err, this.type)) {
75
+ // Feature is unavailable (404) or disabled (403) on this tenant; skip instead of failing
76
+ // the import. The 403 path logs a warning via isForbiddenFeatureError; the 404 path is silent.
77
+ return;
78
+ }
79
+ throw err;
80
+ }
81
+ this.updated += 1;
82
+ this.didUpdate(guardianSettings);
83
+ }
84
+ }
85
+ exports.default = GuardianSettingsHandler;
@@ -151,7 +151,7 @@ class HooksHandler extends default_1.default {
151
151
  .get(hook.id)
152
152
  .then((hookWithCode) => this.client.hooks.secrets
153
153
  .get(hook.id)
154
- .then(({ data: secrets }) => ({ ...hookWithCode, secrets })))));
154
+ .then((secrets) => ({ ...hookWithCode, secrets })))));
155
155
  return this.existing;
156
156
  }
157
157
  catch (err) {
@@ -51,6 +51,9 @@ const guardianFactorTemplates = __importStar(require("./guardianFactorTemplates"
51
51
  const guardianPolicies = __importStar(require("./guardianPolicies"));
52
52
  const guardianPhoneFactorSelectedProvider = __importStar(require("./guardianPhoneFactorSelectedProvider"));
53
53
  const guardianPhoneFactorMessageTypes = __importStar(require("./guardianPhoneFactorMessageTypes"));
54
+ const guardianPhoneFactorSettings = __importStar(require("./guardianPhoneFactorSettings"));
55
+ const guardianEmailFactorSettings = __importStar(require("./guardianEmailFactorSettings"));
56
+ const guardianSettings = __importStar(require("./guardianSettings"));
54
57
  const roles = __importStar(require("./roles"));
55
58
  const branding = __importStar(require("./branding"));
56
59
  const phoneProviders = __importStar(require("./phoneProvider"));
@@ -69,12 +72,16 @@ const forms = __importStar(require("./forms"));
69
72
  const flows = __importStar(require("./flows"));
70
73
  const flowVaultConnections = __importStar(require("./flowVaultConnections"));
71
74
  const selfServiceProfiles = __importStar(require("./selfServiceProfiles"));
75
+ const networkACLKeys = __importStar(require("./networkACLKeys"));
72
76
  const networkACLs = __importStar(require("./networkACLs"));
73
77
  const userAttributeProfiles = __importStar(require("./userAttributeProfiles"));
74
78
  const connectionProfiles = __importStar(require("./connectionProfiles"));
75
79
  const tokenExchangeProfiles = __importStar(require("./tokenExchangeProfiles"));
76
80
  const supplementalSignals = __importStar(require("./supplementalSignals"));
81
+ const rateLimitPolicies = __importStar(require("./rateLimitPolicies"));
77
82
  const eventStreams = __importStar(require("./eventStreams"));
83
+ const clientAuthCredentials = __importStar(require("./clientAuthCredentials"));
84
+ const clientAuthCredentialsPre = __importStar(require("./clientAuthCredentialsPre"));
78
85
  const auth0ApiHandlers = {
79
86
  rules,
80
87
  rulesConfigs,
@@ -94,6 +101,9 @@ const auth0ApiHandlers = {
94
101
  guardianPolicies,
95
102
  guardianPhoneFactorSelectedProvider,
96
103
  guardianPhoneFactorMessageTypes,
104
+ guardianPhoneFactorSettings,
105
+ guardianEmailFactorSettings,
106
+ guardianSettings,
97
107
  roles,
98
108
  branding,
99
109
  phoneProviders,
@@ -113,11 +123,17 @@ const auth0ApiHandlers = {
113
123
  flows,
114
124
  flowVaultConnections,
115
125
  selfServiceProfiles,
126
+ networkACLKeys,
116
127
  networkACLs,
117
128
  userAttributeProfiles,
118
129
  connectionProfiles,
119
130
  tokenExchangeProfiles,
120
131
  supplementalSignals,
132
+ rateLimitPolicies,
121
133
  eventStreams,
134
+ clientAuthCredentials,
135
+ // clientAuthCredentialsPre is a deploy-only pre-pass handler (order 40) — not a user-facing
136
+ // asset type so it is not in AssetTypes, but must be registered here to run during deploy.
137
+ ...{ clientAuthCredentialsPre },
122
138
  };
123
139
  exports.default = auth0ApiHandlers; // TODO: apply stronger types to schema properties
@@ -0,0 +1,45 @@
1
+ import { Management } from 'auth0';
2
+ import DefaultAPIHandler from './default';
3
+ import { Asset, Assets, CalculatedChanges } from '../../../types';
4
+ export type NetworkAclKey = Management.NetworkAclKey & {
5
+ value?: string;
6
+ };
7
+ export declare const schema: {
8
+ type: string;
9
+ description: string;
10
+ items: {
11
+ type: string;
12
+ required: string[];
13
+ properties: {
14
+ id: {
15
+ type: string;
16
+ };
17
+ name: {
18
+ type: string;
19
+ maxLength: number;
20
+ };
21
+ alg: {
22
+ type: string;
23
+ enum: string[];
24
+ };
25
+ value: {
26
+ type: string;
27
+ };
28
+ fingerprint: {
29
+ type: string;
30
+ };
31
+ };
32
+ additionalProperties: boolean;
33
+ };
34
+ };
35
+ export default class NetworkACLKeysHandler extends DefaultAPIHandler {
36
+ existing: NetworkAclKey[] | null;
37
+ constructor(config: DefaultAPIHandler);
38
+ objString(key: NetworkAclKey): string;
39
+ getType(): Promise<Asset | null>;
40
+ processChanges(assets: Assets): Promise<void>;
41
+ createNetworkACLKey(key: NetworkAclKey): Promise<void>;
42
+ createNetworkACLKeys(creates: CalculatedChanges['create']): Promise<void>;
43
+ deleteNetworkACLKey(key: NetworkAclKey): Promise<void>;
44
+ deleteNetworkACLKeys(data: Asset[]): Promise<void>;
45
+ }
@@ -0,0 +1,177 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
19
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
20
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
21
+ 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;
22
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
23
+ };
24
+ var __importStar = (this && this.__importStar) || (function () {
25
+ var ownKeys = function(o) {
26
+ ownKeys = Object.getOwnPropertyNames || function (o) {
27
+ var ar = [];
28
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
29
+ return ar;
30
+ };
31
+ return ownKeys(o);
32
+ };
33
+ return function (mod) {
34
+ if (mod && mod.__esModule) return mod;
35
+ var result = {};
36
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
37
+ __setModuleDefault(result, mod);
38
+ return result;
39
+ };
40
+ })();
41
+ var __importDefault = (this && this.__importDefault) || function (mod) {
42
+ return (mod && mod.__esModule) ? mod : { "default": mod };
43
+ };
44
+ Object.defineProperty(exports, "__esModule", { value: true });
45
+ exports.schema = void 0;
46
+ const default_1 = __importStar(require("./default"));
47
+ const logger_1 = __importDefault(require("../../../logger"));
48
+ exports.schema = {
49
+ type: 'array',
50
+ description: 'List of Network ACL keys for HMAC signature verification',
51
+ items: {
52
+ type: 'object',
53
+ required: ['name', 'alg'],
54
+ properties: {
55
+ id: { type: 'string' },
56
+ name: { type: 'string', maxLength: 255 },
57
+ alg: { type: 'string', enum: ['hmac-sha256'] },
58
+ // value is write-only and never returned by the API.
59
+ // Provide it at deploy time via keyword replacement (e.g. ##HMAC_KEY_VALUE##).
60
+ // It is not exported and is omitted from exported configs.
61
+ value: { type: 'string' },
62
+ fingerprint: { type: 'string' },
63
+ },
64
+ additionalProperties: false,
65
+ },
66
+ };
67
+ class NetworkACLKeysHandler extends default_1.default {
68
+ constructor(config) {
69
+ super({
70
+ ...config,
71
+ type: 'networkACLKeys',
72
+ id: 'id',
73
+ identifiers: ['name'],
74
+ // value is write-only (never returned by API) and fingerprint/timestamps are
75
+ // API-generated — ignore all of them when computing dry-run diffs so keys
76
+ // with a local `value` don't show phantom UPDATEs.
77
+ ignoreDryRunFields: ['value', 'fingerprint', 'created_at', 'updated_at'],
78
+ });
79
+ }
80
+ objString(key) {
81
+ return super.objString({ name: key.name, alg: key.alg });
82
+ }
83
+ async getType() {
84
+ if (this.existing)
85
+ return this.existing;
86
+ try {
87
+ // Not paginated — tenant cap is 10 keys. Returns { keys: [...] }.
88
+ const result = await this.client.keys.networkAcls.list();
89
+ this.existing = result.keys;
90
+ return this.existing;
91
+ }
92
+ catch (err) {
93
+ if (err.statusCode === 404 || err.statusCode === 501) {
94
+ return null;
95
+ }
96
+ if (err.statusCode === 403) {
97
+ logger_1.default.debug('Network ACL key management is not enabled for this tenant. Please verify `scope` or contact Auth0 support.');
98
+ return null;
99
+ }
100
+ throw err;
101
+ }
102
+ }
103
+ async processChanges(assets) {
104
+ const { networkACLKeys } = assets;
105
+ // Do nothing if not set
106
+ if (!networkACLKeys)
107
+ return;
108
+ const { del, create } = await this.calcChanges(assets);
109
+ // Keys are immutable after creation — there is no update operation.
110
+ // A detected "update" (same name, different config) is a no-op: the existing key is kept as-is.
111
+ logger_1.default.debug(`Start processChanges for networkACLKeys [delete:${del.length}] [create:${create.length}]`);
112
+ await Promise.all([this.deleteNetworkACLKeys(del), this.createNetworkACLKeys(create)]);
113
+ }
114
+ async createNetworkACLKey(key) {
115
+ if (!key.value) {
116
+ logger_1.default.warn(`Skipping creation of Network ACL key "${key.name}": ` +
117
+ `'value' is required to create a key but is not present in the config. ` +
118
+ `Supply the key material via keyword replacement (e.g. ##HMAC_KEY_VALUE##) or create the key out-of-band.`);
119
+ return;
120
+ }
121
+ await this.client.keys.networkAcls.create({
122
+ name: key.name,
123
+ alg: key.alg,
124
+ value: key.value,
125
+ });
126
+ this.didCreate(key);
127
+ this.created += 1;
128
+ }
129
+ async createNetworkACLKeys(creates) {
130
+ await this.client.pool
131
+ .addEachTask({
132
+ data: creates || [],
133
+ generator: (item) => this.createNetworkACLKey(item).catch((err) => {
134
+ throw new Error(`Problem creating ${this.type} ${this.objString(item)}\n${err}`);
135
+ }),
136
+ })
137
+ .promise();
138
+ }
139
+ async deleteNetworkACLKey(key) {
140
+ if (!key.id) {
141
+ throw new Error(`Missing id for ${this.type} ${this.objString(key)}`);
142
+ }
143
+ await this.client.keys.networkAcls.delete(key.id);
144
+ }
145
+ async deleteNetworkACLKeys(data) {
146
+ if (!data || data.length === 0)
147
+ return;
148
+ if (this.config('AUTH0_ALLOW_DELETE') === 'true' ||
149
+ this.config('AUTH0_ALLOW_DELETE') === true) {
150
+ await this.client.pool
151
+ .addEachTask({
152
+ data: data || [],
153
+ generator: (item) => this.deleteNetworkACLKey(item)
154
+ .then(() => {
155
+ this.didDelete(item);
156
+ this.deleted += 1;
157
+ })
158
+ .catch((err) => {
159
+ if (err.statusCode === 409) {
160
+ throw new Error(`Cannot delete Network ACL key "${item.name}" — it is still referenced by one or more ACL rules. ` +
161
+ `Remove the key reference from all ACL rules first.\n${err}`);
162
+ }
163
+ throw new Error(`Problem deleting ${this.type} ${this.objString(item)}\n${err}`);
164
+ }),
165
+ })
166
+ .promise();
167
+ }
168
+ else {
169
+ logger_1.default.warn(`Detected the following ${this.type} should be deleted. Doing so may be destructive.\nYou can enable deletes by setting 'AUTH0_ALLOW_DELETE' to true in the config
170
+ \n${data.map((i) => this.objString(i)).join('\n')}`);
171
+ }
172
+ }
173
+ }
174
+ exports.default = NetworkACLKeysHandler;
175
+ __decorate([
176
+ (0, default_1.order)(60)
177
+ ], NetworkACLKeysHandler.prototype, "processChanges", null);
@@ -21,7 +21,7 @@ export declare const schema: {
21
21
  minimum: number;
22
22
  };
23
23
  rule: {
24
- anyOf: {
24
+ anyOf: ({
25
25
  type: string;
26
26
  required: string[];
27
27
  properties: {
@@ -85,6 +85,15 @@ export declare const schema: {
85
85
  uniqueItems: boolean;
86
86
  minItems: number;
87
87
  };
88
+ auth0_managed: {
89
+ type: string;
90
+ items: {
91
+ type: string;
92
+ pattern: string;
93
+ };
94
+ uniqueItems: boolean;
95
+ minItems: number;
96
+ };
88
97
  geo_country_codes: {
89
98
  type: string;
90
99
  items: {
@@ -162,6 +171,29 @@ export declare const schema: {
162
171
  };
163
172
  uniqueItems: boolean;
164
173
  };
174
+ http_message_signature: {
175
+ type: string;
176
+ properties: {
177
+ keys: {
178
+ type: string;
179
+ minItems: number;
180
+ maxItems: number;
181
+ uniqueItems: boolean;
182
+ items: {
183
+ type: string;
184
+ properties: {
185
+ id: {
186
+ type: string;
187
+ };
188
+ };
189
+ required: string[];
190
+ additionalProperties: boolean;
191
+ };
192
+ };
193
+ };
194
+ required: string[];
195
+ additionalProperties: boolean;
196
+ };
165
197
  };
166
198
  additionalProperties: boolean;
167
199
  };
@@ -176,6 +208,15 @@ export declare const schema: {
176
208
  uniqueItems: boolean;
177
209
  minItems: number;
178
210
  };
211
+ auth0_managed: {
212
+ type: string;
213
+ items: {
214
+ type: string;
215
+ pattern: string;
216
+ };
217
+ uniqueItems: boolean;
218
+ minItems: number;
219
+ };
179
220
  geo_country_codes: {
180
221
  type: string;
181
222
  items: {
@@ -253,6 +294,29 @@ export declare const schema: {
253
294
  };
254
295
  uniqueItems: boolean;
255
296
  };
297
+ http_message_signature: {
298
+ type: string;
299
+ properties: {
300
+ keys: {
301
+ type: string;
302
+ minItems: number;
303
+ maxItems: number;
304
+ uniqueItems: boolean;
305
+ items: {
306
+ type: string;
307
+ properties: {
308
+ id: {
309
+ type: string;
310
+ };
311
+ };
312
+ required: string[];
313
+ additionalProperties: boolean;
314
+ };
315
+ };
316
+ };
317
+ required: string[];
318
+ additionalProperties: boolean;
319
+ };
256
320
  };
257
321
  additionalProperties: boolean;
258
322
  };
@@ -260,9 +324,75 @@ export declare const schema: {
260
324
  enum: string[];
261
325
  type: string;
262
326
  };
327
+ match_all?: undefined;
328
+ };
329
+ additionalProperties: boolean;
330
+ } | {
331
+ type: string;
332
+ required: string[];
333
+ properties: {
334
+ action: {
335
+ type: string;
336
+ anyOf: ({
337
+ type: string;
338
+ required: string[];
339
+ properties: {
340
+ block: {
341
+ type: string;
342
+ enum: boolean[];
343
+ };
344
+ };
345
+ additionalProperties: boolean;
346
+ } | {
347
+ type: string;
348
+ required: string[];
349
+ properties: {
350
+ allow: {
351
+ type: string;
352
+ enum: boolean[];
353
+ };
354
+ };
355
+ additionalProperties: boolean;
356
+ } | {
357
+ type: string;
358
+ required: string[];
359
+ properties: {
360
+ log: {
361
+ type: string;
362
+ enum: boolean[];
363
+ };
364
+ };
365
+ additionalProperties: boolean;
366
+ } | {
367
+ type: string;
368
+ required: string[];
369
+ properties: {
370
+ redirect: {
371
+ type: string;
372
+ enum: boolean[];
373
+ };
374
+ redirect_uri: {
375
+ type: string;
376
+ minLength: number;
377
+ maxLength: number;
378
+ };
379
+ };
380
+ additionalProperties: boolean;
381
+ })[];
382
+ };
383
+ match_all: {
384
+ type: string;
385
+ enum: boolean[];
386
+ };
387
+ scope: {
388
+ enum: string[];
389
+ type: string;
390
+ };
391
+ match?: undefined;
392
+ not_match?: undefined;
263
393
  };
264
394
  additionalProperties: boolean;
265
- }[];
395
+ })[];
266
396
  };
267
397
  };
268
398
  additionalProperties: boolean;