auth0-deploy-cli 9.0.0-beta.2 → 9.0.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.
- package/AGENTS.md +2 -357
- package/CHANGELOG.md +158 -10
- package/CLAUDE.md +138 -2
- package/README.md +1 -1
- package/lib/context/defaults.d.ts +7 -0
- package/lib/context/defaults.js +74 -30
- package/lib/context/directory/handlers/actionModules.js +1 -4
- package/lib/context/directory/handlers/actions.js +1 -4
- package/lib/context/directory/handlers/attackProtection.js +1 -1
- package/lib/context/directory/handlers/branding.js +4 -1
- package/lib/context/directory/handlers/clientAuthCredentials.d.ts +5 -0
- package/lib/context/directory/handlers/clientAuthCredentials.js +13 -0
- package/lib/context/directory/handlers/clientGrants.js +78 -24
- package/lib/context/directory/handlers/clients.js +20 -3
- package/lib/context/directory/handlers/connections.js +19 -5
- package/lib/context/directory/handlers/databases.js +1 -4
- package/lib/context/directory/handlers/emailTemplates.js +5 -0
- package/lib/context/directory/handlers/guardianEmailFactorSettings.d.ts +5 -0
- package/lib/context/directory/handlers/guardianEmailFactorSettings.js +38 -0
- package/lib/context/directory/handlers/guardianPhoneFactorSettings.d.ts +5 -0
- package/lib/context/directory/handlers/guardianPhoneFactorSettings.js +38 -0
- package/lib/context/directory/handlers/guardianSettings.d.ts +5 -0
- package/lib/context/directory/handlers/guardianSettings.js +38 -0
- package/lib/context/directory/handlers/hooks.js +1 -4
- package/lib/context/directory/handlers/index.js +12 -0
- package/lib/context/directory/handlers/networkACLKeys.d.ts +6 -0
- package/lib/context/directory/handlers/networkACLKeys.js +54 -0
- package/lib/context/directory/handlers/prompts.js +7 -3
- package/lib/context/directory/handlers/rateLimitPolicies.d.ts +6 -0
- package/lib/context/directory/handlers/rateLimitPolicies.js +53 -0
- package/lib/context/directory/handlers/rules.js +1 -4
- package/lib/context/directory/index.js +1 -4
- package/lib/context/index.js +31 -31
- package/lib/context/yaml/handlers/attackProtection.js +1 -1
- package/lib/context/yaml/handlers/branding.js +4 -1
- package/lib/context/yaml/handlers/clientAuthCredentials.d.ts +5 -0
- package/lib/context/yaml/handlers/clientAuthCredentials.js +13 -0
- package/lib/context/yaml/handlers/clients.js +19 -1
- package/lib/context/yaml/handlers/connections.js +8 -1
- package/lib/context/yaml/handlers/flows.js +3 -0
- package/lib/context/yaml/handlers/forms.js +3 -0
- package/lib/context/yaml/handlers/guardianEmailFactorSettings.d.ts +5 -0
- package/lib/context/yaml/handlers/guardianEmailFactorSettings.js +15 -0
- package/lib/context/yaml/handlers/guardianPhoneFactorSettings.d.ts +5 -0
- package/lib/context/yaml/handlers/guardianPhoneFactorSettings.js +15 -0
- package/lib/context/yaml/handlers/guardianSettings.d.ts +5 -0
- package/lib/context/yaml/handlers/guardianSettings.js +15 -0
- package/lib/context/yaml/handlers/index.js +12 -0
- package/lib/context/yaml/handlers/networkACLKeys.d.ts +6 -0
- package/lib/context/yaml/handlers/networkACLKeys.js +42 -0
- package/lib/context/yaml/handlers/prompts.js +3 -1
- package/lib/context/yaml/handlers/rateLimitPolicies.d.ts +6 -0
- package/lib/context/yaml/handlers/rateLimitPolicies.js +27 -0
- package/lib/context/yaml/index.js +1 -4
- package/lib/keywordPreservation.d.ts +1 -1
- package/lib/keywordPreservation.js +2 -1
- package/lib/readonly.js +5 -0
- package/lib/tools/auth0/handlers/attackProtection.js +19 -6
- package/lib/tools/auth0/handlers/clientAuthCredentials.d.ts +27 -0
- package/lib/tools/auth0/handlers/clientAuthCredentials.js +234 -0
- package/lib/tools/auth0/handlers/clientAuthCredentialsPre.d.ts +38 -0
- package/lib/tools/auth0/handlers/clientAuthCredentialsPre.js +123 -0
- package/lib/tools/auth0/handlers/clientGrants.d.ts +1 -1
- package/lib/tools/auth0/handlers/clients.d.ts +106 -0
- package/lib/tools/auth0/handlers/clients.js +206 -2
- package/lib/tools/auth0/handlers/connectionProfiles.d.ts +27 -0
- package/lib/tools/auth0/handlers/connectionProfiles.js +30 -0
- package/lib/tools/auth0/handlers/connections.d.ts +32 -6
- package/lib/tools/auth0/handlers/connections.js +49 -7
- package/lib/tools/auth0/handlers/databases.d.ts +28 -0
- package/lib/tools/auth0/handlers/databases.js +58 -24
- package/lib/tools/auth0/handlers/default.d.ts +23 -0
- package/lib/tools/auth0/handlers/default.js +47 -29
- package/lib/tools/auth0/handlers/eventStreams.js +10 -2
- package/lib/tools/auth0/handlers/guardianEmailFactorSettings.d.ts +22 -0
- package/lib/tools/auth0/handlers/guardianEmailFactorSettings.js +77 -0
- package/lib/tools/auth0/handlers/guardianFactorTemplates.js +13 -4
- package/lib/tools/auth0/handlers/guardianPhoneFactorMessageTypes.js +11 -9
- package/lib/tools/auth0/handlers/guardianPhoneFactorSelectedProvider.js +11 -9
- package/lib/tools/auth0/handlers/guardianPhoneFactorSettings.d.ts +22 -0
- package/lib/tools/auth0/handlers/guardianPhoneFactorSettings.js +77 -0
- package/lib/tools/auth0/handlers/guardianPolicies.js +11 -1
- package/lib/tools/auth0/handlers/guardianSettings.d.ts +30 -0
- package/lib/tools/auth0/handlers/guardianSettings.js +85 -0
- package/lib/tools/auth0/handlers/hooks.js +1 -1
- package/lib/tools/auth0/handlers/index.js +16 -0
- package/lib/tools/auth0/handlers/networkACLKeys.d.ts +45 -0
- package/lib/tools/auth0/handlers/networkACLKeys.js +177 -0
- package/lib/tools/auth0/handlers/networkACLs.d.ts +132 -2
- package/lib/tools/auth0/handlers/networkACLs.js +100 -16
- package/lib/tools/auth0/handlers/organizations.d.ts +33 -1
- package/lib/tools/auth0/handlers/organizations.js +177 -19
- package/lib/tools/auth0/handlers/phoneProvider.js +10 -2
- package/lib/tools/auth0/handlers/phoneTemplates.d.ts +4 -1
- package/lib/tools/auth0/handlers/phoneTemplates.js +67 -10
- package/lib/tools/auth0/handlers/prompts.js +1 -1
- package/lib/tools/auth0/handlers/rateLimitPolicies.d.ts +81 -0
- package/lib/tools/auth0/handlers/rateLimitPolicies.js +203 -0
- package/lib/tools/auth0/handlers/resourceServers.d.ts +44 -0
- package/lib/tools/auth0/handlers/resourceServers.js +44 -0
- package/lib/tools/auth0/handlers/riskAssessment.d.ts +1 -1
- package/lib/tools/auth0/handlers/riskAssessment.js +19 -1
- package/lib/tools/auth0/handlers/roles.d.ts +4 -0
- package/lib/tools/auth0/handlers/roles.js +10 -0
- package/lib/tools/auth0/handlers/rules.js +19 -7
- package/lib/tools/auth0/handlers/tenant.d.ts +45 -0
- package/lib/tools/auth0/handlers/tenant.js +48 -0
- package/lib/tools/auth0/handlers/themes.d.ts +37 -1
- package/lib/tools/auth0/handlers/themes.js +64 -0
- package/lib/tools/auth0/handlers/tokenExchangeProfiles.js +3 -1
- package/lib/tools/auth0/index.js +12 -6
- package/lib/tools/calculateDryRunChanges.js +12 -8
- package/lib/tools/constants.d.ts +2 -0
- package/lib/tools/constants.js +3 -0
- package/lib/tools/utils.d.ts +3 -0
- package/lib/tools/utils.js +41 -2
- package/lib/types.d.ts +9 -1
- package/lib/utils.d.ts +6 -0
- package/lib/utils.js +17 -2
- package/package.json +2 -2
- package/references/code-style.md +133 -0
- package/references/commands.md +98 -0
- package/references/docs-update.md +34 -0
- package/references/git-workflow.md +135 -0
- package/references/pitfalls.md +62 -0
- package/references/testing.md +118 -0
|
@@ -0,0 +1,203 @@
|
|
|
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 auth0_1 = require("auth0");
|
|
8
|
+
const default_1 = __importDefault(require("./default"));
|
|
9
|
+
const client_1 = require("../client");
|
|
10
|
+
const utils_1 = require("../../utils");
|
|
11
|
+
const logger_1 = __importDefault(require("../../../logger"));
|
|
12
|
+
exports.schema = {
|
|
13
|
+
type: 'array',
|
|
14
|
+
items: {
|
|
15
|
+
type: 'object',
|
|
16
|
+
properties: {
|
|
17
|
+
resource: {
|
|
18
|
+
type: 'string',
|
|
19
|
+
enum: Object.values(auth0_1.Management.RateLimitPolicyResourceEnum),
|
|
20
|
+
},
|
|
21
|
+
consumer: {
|
|
22
|
+
type: 'string',
|
|
23
|
+
enum: Object.values(auth0_1.Management.RateLimitPolicyConsumerEnum),
|
|
24
|
+
},
|
|
25
|
+
consumer_selector: {
|
|
26
|
+
type: 'string',
|
|
27
|
+
},
|
|
28
|
+
configuration: {
|
|
29
|
+
type: 'object',
|
|
30
|
+
oneOf: [
|
|
31
|
+
{
|
|
32
|
+
required: ['action'],
|
|
33
|
+
properties: {
|
|
34
|
+
action: { type: 'string', enum: ['allow'] },
|
|
35
|
+
},
|
|
36
|
+
additionalProperties: false,
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
required: ['action', 'limit'],
|
|
40
|
+
properties: {
|
|
41
|
+
action: { type: 'string', enum: ['block', 'log'] },
|
|
42
|
+
limit: { type: 'number' },
|
|
43
|
+
},
|
|
44
|
+
additionalProperties: false,
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
required: ['action', 'limit', 'redirect_uri'],
|
|
48
|
+
properties: {
|
|
49
|
+
action: { type: 'string', enum: ['redirect'] },
|
|
50
|
+
limit: { type: 'number' },
|
|
51
|
+
redirect_uri: { type: 'string' },
|
|
52
|
+
},
|
|
53
|
+
additionalProperties: false,
|
|
54
|
+
},
|
|
55
|
+
],
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
required: ['resource', 'consumer', 'consumer_selector', 'configuration'],
|
|
59
|
+
},
|
|
60
|
+
};
|
|
61
|
+
class RateLimitPoliciesHandler extends default_1.default {
|
|
62
|
+
constructor(config) {
|
|
63
|
+
super({
|
|
64
|
+
...config,
|
|
65
|
+
type: 'rateLimitPolicies',
|
|
66
|
+
id: 'id',
|
|
67
|
+
identifiers: ['id', 'consumer_selector'],
|
|
68
|
+
stripCreateFields: ['id', 'created_at', 'updated_at'],
|
|
69
|
+
stripUpdateFields: [
|
|
70
|
+
'id',
|
|
71
|
+
'resource',
|
|
72
|
+
'consumer',
|
|
73
|
+
'consumer_selector',
|
|
74
|
+
'created_at',
|
|
75
|
+
'updated_at',
|
|
76
|
+
],
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
objString(policy) {
|
|
80
|
+
return super.objString({
|
|
81
|
+
consumer_selector: policy.consumer_selector,
|
|
82
|
+
resource: policy.resource,
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
async getType() {
|
|
86
|
+
if (this.existing)
|
|
87
|
+
return this.existing;
|
|
88
|
+
try {
|
|
89
|
+
const rateLimitPolicies = await (0, client_1.paginate)(this.client.rateLimitPolicies.list, { checkpoint: true });
|
|
90
|
+
this.existing = rateLimitPolicies;
|
|
91
|
+
return this.existing;
|
|
92
|
+
}
|
|
93
|
+
catch (err) {
|
|
94
|
+
if (err.statusCode === 404 || err.statusCode === 501) {
|
|
95
|
+
return null;
|
|
96
|
+
}
|
|
97
|
+
if (err.statusCode === 403) {
|
|
98
|
+
logger_1.default.debug('Rate Limit Policies feature is not enabled for this tenant. Please contact Auth0 support to enable this feature.');
|
|
99
|
+
return null;
|
|
100
|
+
}
|
|
101
|
+
throw err;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
async processChanges(assets) {
|
|
105
|
+
const { rateLimitPolicies } = assets;
|
|
106
|
+
if (!rateLimitPolicies)
|
|
107
|
+
return;
|
|
108
|
+
const { del, update, create } = await this.calcChanges(assets);
|
|
109
|
+
if ((0, utils_1.isDryRun)(this.config)) {
|
|
110
|
+
if (create.length === 0 && update.length === 0 && del.length === 0) {
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
logger_1.default.debug(`Start processChanges for rateLimitPolicies [delete:${del.length}] [update:${update.length}], [create:${create.length}]`);
|
|
115
|
+
const changes = [{ del }, { create }, { update }];
|
|
116
|
+
await Promise.all(changes.map(async (change) => {
|
|
117
|
+
switch (true) {
|
|
118
|
+
case change.del && change.del.length > 0:
|
|
119
|
+
await this.deleteRateLimitPolicies(change.del);
|
|
120
|
+
break;
|
|
121
|
+
case change.create && change.create.length > 0:
|
|
122
|
+
await this.createRateLimitPolicies(change.create);
|
|
123
|
+
break;
|
|
124
|
+
case change.update && change.update.length > 0:
|
|
125
|
+
await this.updateRateLimitPolicies(change.update);
|
|
126
|
+
break;
|
|
127
|
+
default:
|
|
128
|
+
break;
|
|
129
|
+
}
|
|
130
|
+
}));
|
|
131
|
+
}
|
|
132
|
+
async createRateLimitPolicy(policy) {
|
|
133
|
+
const created = await this.client.rateLimitPolicies.create(policy);
|
|
134
|
+
return created;
|
|
135
|
+
}
|
|
136
|
+
async createRateLimitPolicies(creates) {
|
|
137
|
+
await this.client.pool
|
|
138
|
+
.addEachTask({
|
|
139
|
+
data: creates || [],
|
|
140
|
+
generator: (item) => this.createRateLimitPolicy(item)
|
|
141
|
+
.then((data) => {
|
|
142
|
+
this.didCreate(data);
|
|
143
|
+
this.created += 1;
|
|
144
|
+
})
|
|
145
|
+
.catch((err) => {
|
|
146
|
+
throw new Error(`Problem creating ${this.type} ${this.objString(item)}\n${err}`);
|
|
147
|
+
}),
|
|
148
|
+
})
|
|
149
|
+
.promise();
|
|
150
|
+
}
|
|
151
|
+
async updateRateLimitPolicy(policy) {
|
|
152
|
+
const { id, configuration } = policy;
|
|
153
|
+
if (!id) {
|
|
154
|
+
throw new Error(`Missing id for ${this.type} ${this.objString(policy)}`);
|
|
155
|
+
}
|
|
156
|
+
await this.client.rateLimitPolicies.update(id, { configuration });
|
|
157
|
+
}
|
|
158
|
+
async updateRateLimitPolicies(updates) {
|
|
159
|
+
await this.client.pool
|
|
160
|
+
.addEachTask({
|
|
161
|
+
data: updates || [],
|
|
162
|
+
generator: (item) => this.updateRateLimitPolicy(item)
|
|
163
|
+
.then(() => {
|
|
164
|
+
this.didUpdate(item);
|
|
165
|
+
this.updated += 1;
|
|
166
|
+
})
|
|
167
|
+
.catch((err) => {
|
|
168
|
+
throw new Error(`Problem updating ${this.type} ${this.objString(item)}\n${err}`);
|
|
169
|
+
}),
|
|
170
|
+
})
|
|
171
|
+
.promise();
|
|
172
|
+
}
|
|
173
|
+
async deleteRateLimitPolicy(policy) {
|
|
174
|
+
if (!policy.id) {
|
|
175
|
+
throw new Error(`Missing id for ${this.type} ${this.objString(policy)}`);
|
|
176
|
+
}
|
|
177
|
+
await this.client.rateLimitPolicies.delete(policy.id);
|
|
178
|
+
}
|
|
179
|
+
async deleteRateLimitPolicies(data) {
|
|
180
|
+
if (this.config('AUTH0_ALLOW_DELETE') === 'true' ||
|
|
181
|
+
this.config('AUTH0_ALLOW_DELETE') === true) {
|
|
182
|
+
await this.client.pool
|
|
183
|
+
.addEachTask({
|
|
184
|
+
data: data || [],
|
|
185
|
+
generator: (item) => this.deleteRateLimitPolicy(item)
|
|
186
|
+
.then(() => {
|
|
187
|
+
this.didDelete(item);
|
|
188
|
+
this.deleted += 1;
|
|
189
|
+
})
|
|
190
|
+
.catch((err) => {
|
|
191
|
+
throw new Error(`Problem deleting ${this.type} ${this.objString(item)}\n${err}`);
|
|
192
|
+
}),
|
|
193
|
+
})
|
|
194
|
+
.promise();
|
|
195
|
+
}
|
|
196
|
+
else {
|
|
197
|
+
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\n${data
|
|
198
|
+
.map((i) => this.objString(i))
|
|
199
|
+
.join('\n')}`);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
exports.default = RateLimitPoliciesHandler;
|
|
@@ -85,9 +85,53 @@ export declare const schema: {
|
|
|
85
85
|
};
|
|
86
86
|
};
|
|
87
87
|
};
|
|
88
|
+
anonymous_user: {
|
|
89
|
+
type: string;
|
|
90
|
+
description: string;
|
|
91
|
+
properties: {
|
|
92
|
+
policy: {
|
|
93
|
+
type: string;
|
|
94
|
+
enum: ("deny_all" | "require_client_grant")[];
|
|
95
|
+
};
|
|
96
|
+
};
|
|
97
|
+
};
|
|
88
98
|
};
|
|
89
99
|
additionalProperties: boolean;
|
|
90
100
|
};
|
|
101
|
+
token_lifetime_for_anonymous_access_tokens: {
|
|
102
|
+
type: string;
|
|
103
|
+
description: string;
|
|
104
|
+
};
|
|
105
|
+
access_token: {
|
|
106
|
+
type: string[];
|
|
107
|
+
description: string;
|
|
108
|
+
properties: {
|
|
109
|
+
claims_mapping: {
|
|
110
|
+
type: string;
|
|
111
|
+
description: string;
|
|
112
|
+
properties: {
|
|
113
|
+
custom_claims: {
|
|
114
|
+
type: string;
|
|
115
|
+
description: string;
|
|
116
|
+
items: {
|
|
117
|
+
type: string;
|
|
118
|
+
properties: {
|
|
119
|
+
name: {
|
|
120
|
+
type: string;
|
|
121
|
+
description: string;
|
|
122
|
+
};
|
|
123
|
+
expression: {
|
|
124
|
+
type: string;
|
|
125
|
+
description: string;
|
|
126
|
+
};
|
|
127
|
+
};
|
|
128
|
+
required: string[];
|
|
129
|
+
};
|
|
130
|
+
};
|
|
131
|
+
};
|
|
132
|
+
};
|
|
133
|
+
};
|
|
134
|
+
};
|
|
91
135
|
client_id: {
|
|
92
136
|
type: string;
|
|
93
137
|
description: string;
|
|
@@ -72,9 +72,53 @@ exports.schema = {
|
|
|
72
72
|
},
|
|
73
73
|
},
|
|
74
74
|
},
|
|
75
|
+
anonymous_user: {
|
|
76
|
+
type: 'object',
|
|
77
|
+
description: 'Access Permissions for anonymous user flows',
|
|
78
|
+
properties: {
|
|
79
|
+
policy: {
|
|
80
|
+
type: 'string',
|
|
81
|
+
enum: Object.values(auth0_1.Management.ResourceServerSubjectTypeAuthorizationAnonymousUserPolicyEnum),
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
},
|
|
75
85
|
},
|
|
76
86
|
additionalProperties: false,
|
|
77
87
|
},
|
|
88
|
+
token_lifetime_for_anonymous_access_tokens: {
|
|
89
|
+
type: 'number',
|
|
90
|
+
description: 'Expiration value (in seconds) for anonymous-session access tokens issued for this API.',
|
|
91
|
+
},
|
|
92
|
+
access_token: {
|
|
93
|
+
type: ['object', 'null'],
|
|
94
|
+
description: 'Custom configuration for access tokens.',
|
|
95
|
+
properties: {
|
|
96
|
+
claims_mapping: {
|
|
97
|
+
type: 'object',
|
|
98
|
+
description: 'Custom configuration for claims in access tokens.',
|
|
99
|
+
properties: {
|
|
100
|
+
custom_claims: {
|
|
101
|
+
type: 'array',
|
|
102
|
+
description: 'Custom claims to emit in anonymous-session access tokens. Each rule maps a value from the anonymous-session context onto a named access-token claim.',
|
|
103
|
+
items: {
|
|
104
|
+
type: 'object',
|
|
105
|
+
properties: {
|
|
106
|
+
name: {
|
|
107
|
+
type: 'string',
|
|
108
|
+
description: 'The access-token claim name to emit.',
|
|
109
|
+
},
|
|
110
|
+
expression: {
|
|
111
|
+
type: 'string',
|
|
112
|
+
description: 'Restricted dot-path expression read from the anonymous-session context.',
|
|
113
|
+
},
|
|
114
|
+
},
|
|
115
|
+
required: ['name', 'expression'],
|
|
116
|
+
},
|
|
117
|
+
},
|
|
118
|
+
},
|
|
119
|
+
},
|
|
120
|
+
},
|
|
121
|
+
},
|
|
78
122
|
client_id: {
|
|
79
123
|
type: 'string',
|
|
80
124
|
description: 'The client ID of the client that this resource server is linked to (readonly)',
|
|
@@ -34,6 +34,6 @@ export type RiskAssessment = {
|
|
|
34
34
|
export default class RiskAssessmentHandler extends DefaultAPIHandler {
|
|
35
35
|
existing: RiskAssessment;
|
|
36
36
|
constructor(config: DefaultAPIHandler);
|
|
37
|
-
getType(): Promise<RiskAssessment>;
|
|
37
|
+
getType(): Promise<RiskAssessment | null>;
|
|
38
38
|
processChanges(assets: Assets): Promise<void>;
|
|
39
39
|
}
|
|
@@ -6,6 +6,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.schema = void 0;
|
|
7
7
|
const default_1 = __importDefault(require("./default"));
|
|
8
8
|
const auth0_1 = require("auth0");
|
|
9
|
+
const logger_1 = __importDefault(require("../../../logger"));
|
|
10
|
+
const utils_1 = require("../../utils");
|
|
9
11
|
exports.schema = {
|
|
10
12
|
type: 'object',
|
|
11
13
|
properties: {
|
|
@@ -50,6 +52,9 @@ class RiskAssessmentHandler extends default_1.default {
|
|
|
50
52
|
if (err instanceof auth0_1.ManagementError && err?.statusCode === 404) {
|
|
51
53
|
return { remember_for: 0 };
|
|
52
54
|
}
|
|
55
|
+
if ((0, utils_1.isInsufficientEntitlementError)(err)) {
|
|
56
|
+
return { remember_for: 0 };
|
|
57
|
+
}
|
|
53
58
|
throw err;
|
|
54
59
|
}),
|
|
55
60
|
]);
|
|
@@ -71,6 +76,10 @@ class RiskAssessmentHandler extends default_1.default {
|
|
|
71
76
|
this.existing = riskAssessment;
|
|
72
77
|
return this.existing;
|
|
73
78
|
}
|
|
79
|
+
if ((0, utils_1.isInsufficientEntitlementError)(err)) {
|
|
80
|
+
logger_1.default.warn('Skipping riskAssessment export: tenant does not have Adaptive MFA entitlement');
|
|
81
|
+
return null;
|
|
82
|
+
}
|
|
74
83
|
throw err;
|
|
75
84
|
}
|
|
76
85
|
}
|
|
@@ -87,7 +96,16 @@ class RiskAssessmentHandler extends default_1.default {
|
|
|
87
96
|
if (riskAssessment.new_device) {
|
|
88
97
|
updates.push(this.client.riskAssessments.settings.newDevice.update(riskAssessment.new_device));
|
|
89
98
|
}
|
|
90
|
-
|
|
99
|
+
try {
|
|
100
|
+
await Promise.all(updates);
|
|
101
|
+
}
|
|
102
|
+
catch (err) {
|
|
103
|
+
if ((0, utils_1.isInsufficientEntitlementError)(err)) {
|
|
104
|
+
logger_1.default.warn('Skipping riskAssessment deploy: tenant does not have Adaptive MFA entitlement');
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
throw err;
|
|
108
|
+
}
|
|
91
109
|
this.updated += 1;
|
|
92
110
|
this.didUpdate(riskAssessment);
|
|
93
111
|
}
|
|
@@ -56,6 +56,7 @@ exports.schema = {
|
|
|
56
56
|
name: { type: 'string' },
|
|
57
57
|
id: { type: 'string' },
|
|
58
58
|
description: { type: 'string' },
|
|
59
|
+
type: { type: 'string', enum: ['tenant', 'organization'] },
|
|
59
60
|
permissions: {
|
|
60
61
|
type: 'array',
|
|
61
62
|
items: {
|
|
@@ -81,6 +82,9 @@ class RolesHandler extends default_1.default {
|
|
|
81
82
|
async createRole(data) {
|
|
82
83
|
const role = { ...data };
|
|
83
84
|
delete role.permissions;
|
|
85
|
+
// deploy-cli only manages tenant-level roles, so `type` is stripped on write; it
|
|
86
|
+
// defaults to `tenant` on create. This keeps exports (which carry `type`) round-trippable.
|
|
87
|
+
delete role.type;
|
|
84
88
|
const created = await this.client.roles.create(role);
|
|
85
89
|
if (created.id && typeof data.permissions !== 'undefined' && data.permissions.length > 0) {
|
|
86
90
|
await this.client.roles.permissions.add(created.id, { permissions: data.permissions });
|
|
@@ -133,6 +137,9 @@ class RolesHandler extends default_1.default {
|
|
|
133
137
|
const newPermissions = data.permissions;
|
|
134
138
|
delete data.permissions;
|
|
135
139
|
delete data.id;
|
|
140
|
+
// deploy-cli only manages tenant-level roles, so `type` is stripped on write; this
|
|
141
|
+
// lets files that already carry it (from a prior export) be imported cleanly.
|
|
142
|
+
delete data.type;
|
|
136
143
|
await this.client.roles.update(params.id, data);
|
|
137
144
|
if (typeof existingRole.permissions !== 'undefined' && existingRole.permissions.length > 0) {
|
|
138
145
|
await this.client.roles.permissions.delete(params.id, {
|
|
@@ -164,9 +171,12 @@ class RolesHandler extends default_1.default {
|
|
|
164
171
|
return this.existing;
|
|
165
172
|
}
|
|
166
173
|
try {
|
|
174
|
+
// Only manage tenant-level roles; exclude org-scoped roles surfaced when
|
|
175
|
+
// the api2_org_level_roles_ea flag is enabled.
|
|
167
176
|
const roles = await (0, client_1.paginate)(this.client.roles.list, {
|
|
168
177
|
paginate: true,
|
|
169
178
|
include_totals: true,
|
|
179
|
+
type: 'tenant',
|
|
170
180
|
});
|
|
171
181
|
for (let index = 0; index < roles.length; index++) {
|
|
172
182
|
const allPermission = [];
|
|
@@ -9,6 +9,7 @@ const utils_1 = require("../../utils");
|
|
|
9
9
|
const default_1 = __importDefault(require("./default"));
|
|
10
10
|
const logger_1 = __importDefault(require("../../../logger"));
|
|
11
11
|
const calculateChanges_1 = require("../../calculateChanges");
|
|
12
|
+
const calculateDryRunChanges_1 = require("../../calculateDryRunChanges");
|
|
12
13
|
const client_1 = require("../client");
|
|
13
14
|
exports.excludeSchema = {
|
|
14
15
|
type: 'array',
|
|
@@ -135,13 +136,24 @@ class RulesHandler extends default_1.default {
|
|
|
135
136
|
};
|
|
136
137
|
}
|
|
137
138
|
async dryRunChanges(assets) {
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
del,
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
139
|
+
let { rules } = assets;
|
|
140
|
+
if (!rules) {
|
|
141
|
+
return { del: [], create: [], conflicts: [], update: [] };
|
|
142
|
+
}
|
|
143
|
+
const excludedRules = (assets.exclude && assets.exclude.rules) || [];
|
|
144
|
+
rules = rules.filter((r) => !excludedRules.includes(r.name));
|
|
145
|
+
let existing = await this.getType();
|
|
146
|
+
if (existing === null) {
|
|
147
|
+
return { del: [], create: [], conflicts: [], update: [] };
|
|
148
|
+
}
|
|
149
|
+
existing = existing.filter((r) => !excludedRules.includes(r.name));
|
|
150
|
+
return (0, calculateDryRunChanges_1.calculateDryRunChanges)({
|
|
151
|
+
type: this.type,
|
|
152
|
+
assets: rules,
|
|
153
|
+
existing,
|
|
154
|
+
identifiers: this.identifiers,
|
|
155
|
+
ignoreDryRunFields: this.getEffectiveIgnoreDryRunFields(),
|
|
156
|
+
});
|
|
145
157
|
}
|
|
146
158
|
async validate(assets) {
|
|
147
159
|
const { rules } = assets;
|
|
@@ -79,6 +79,51 @@ export declare const schema: {
|
|
|
79
79
|
enum: string[];
|
|
80
80
|
description: string;
|
|
81
81
|
};
|
|
82
|
+
country_codes: {
|
|
83
|
+
type: string[];
|
|
84
|
+
description: string;
|
|
85
|
+
properties: {
|
|
86
|
+
list: {
|
|
87
|
+
type: string;
|
|
88
|
+
description: string;
|
|
89
|
+
items: {
|
|
90
|
+
type: string;
|
|
91
|
+
pattern: string;
|
|
92
|
+
};
|
|
93
|
+
minItems: number;
|
|
94
|
+
uniqueItems: boolean;
|
|
95
|
+
};
|
|
96
|
+
mode: {
|
|
97
|
+
type: string;
|
|
98
|
+
enum: string[];
|
|
99
|
+
description: string;
|
|
100
|
+
};
|
|
101
|
+
};
|
|
102
|
+
required: string[];
|
|
103
|
+
additionalProperties: boolean;
|
|
104
|
+
};
|
|
105
|
+
sessions: {
|
|
106
|
+
type: string;
|
|
107
|
+
description: string;
|
|
108
|
+
properties: {
|
|
109
|
+
anonymous: {
|
|
110
|
+
type: string;
|
|
111
|
+
description: string;
|
|
112
|
+
properties: {
|
|
113
|
+
lifetime_in_minutes: {
|
|
114
|
+
type: string;
|
|
115
|
+
description: string;
|
|
116
|
+
};
|
|
117
|
+
activate_cookie: {
|
|
118
|
+
type: string;
|
|
119
|
+
description: string;
|
|
120
|
+
};
|
|
121
|
+
};
|
|
122
|
+
additionalProperties: boolean;
|
|
123
|
+
};
|
|
124
|
+
};
|
|
125
|
+
additionalProperties: boolean;
|
|
126
|
+
};
|
|
82
127
|
};
|
|
83
128
|
};
|
|
84
129
|
export interface Tenant extends Management.GetTenantSettingsResponseContent {
|
|
@@ -106,6 +106,53 @@ exports.schema = {
|
|
|
106
106
|
enum: ['strict', 'permissive'],
|
|
107
107
|
description: 'Indicates the security mode for new clients created through the Dynamic Client Registration endpoint.',
|
|
108
108
|
},
|
|
109
|
+
country_codes: {
|
|
110
|
+
type: ['object', 'null'],
|
|
111
|
+
description: 'Phone country code configuration for identifier input. Set to `null` to remove filtering (allow all countries). Requires the `tenant_country_codes_filtering` feature flag to be enabled on the tenant.',
|
|
112
|
+
properties: {
|
|
113
|
+
list: {
|
|
114
|
+
type: 'array',
|
|
115
|
+
description: 'ISO 3166-1 alpha-2 country codes (e.g. `US`, `GB`).',
|
|
116
|
+
items: {
|
|
117
|
+
type: 'string',
|
|
118
|
+
pattern: '^[A-Z]{2}$',
|
|
119
|
+
},
|
|
120
|
+
minItems: 1,
|
|
121
|
+
uniqueItems: true,
|
|
122
|
+
},
|
|
123
|
+
mode: {
|
|
124
|
+
type: 'string',
|
|
125
|
+
enum: ['allow', 'deny'],
|
|
126
|
+
description: 'Whether the list is an allowlist or denylist.',
|
|
127
|
+
},
|
|
128
|
+
},
|
|
129
|
+
required: ['list', 'mode'],
|
|
130
|
+
additionalProperties: false,
|
|
131
|
+
},
|
|
132
|
+
sessions: {
|
|
133
|
+
type: 'object',
|
|
134
|
+
description: 'Sessions related settings for the tenant.',
|
|
135
|
+
properties: {
|
|
136
|
+
anonymous: {
|
|
137
|
+
type: 'object',
|
|
138
|
+
description: 'Anonymous session settings for the tenant.',
|
|
139
|
+
properties: {
|
|
140
|
+
lifetime_in_minutes: {
|
|
141
|
+
type: 'integer',
|
|
142
|
+
description: 'The lifetime of an anonymous session, in minutes.',
|
|
143
|
+
},
|
|
144
|
+
activate_cookie: {
|
|
145
|
+
type: 'boolean',
|
|
146
|
+
description: 'Whether to activate the anonymous session cookie.',
|
|
147
|
+
},
|
|
148
|
+
},
|
|
149
|
+
// Permissive to match the parent `sessions` object so new Management API
|
|
150
|
+
// session fields round-trip through export/import without validation failure.
|
|
151
|
+
additionalProperties: true,
|
|
152
|
+
},
|
|
153
|
+
},
|
|
154
|
+
additionalProperties: true,
|
|
155
|
+
},
|
|
109
156
|
},
|
|
110
157
|
};
|
|
111
158
|
const blockPageKeys = [
|
|
@@ -147,6 +194,7 @@ exports.allowedTenantFlags = [
|
|
|
147
194
|
'require_pushed_authorization_requests',
|
|
148
195
|
'mfa_show_factor_list_on_enrollment',
|
|
149
196
|
'improved_signup_bot_detection_in_classic',
|
|
197
|
+
'use_scope_descriptions_for_consent',
|
|
150
198
|
];
|
|
151
199
|
const removeUnallowedTenantFlags = (proposedFlags) => {
|
|
152
200
|
if (proposedFlags === undefined)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Management } from 'auth0';
|
|
2
|
-
import { Assets } from '../../../types';
|
|
2
|
+
import { Assets, CalculatedChanges } from '../../../types';
|
|
3
3
|
import DefaultHandler from './default';
|
|
4
4
|
/**
|
|
5
5
|
* Schema
|
|
@@ -179,6 +179,41 @@ export declare const schema: {
|
|
|
179
179
|
pattern: string;
|
|
180
180
|
type: string;
|
|
181
181
|
};
|
|
182
|
+
identifiers: {
|
|
183
|
+
additionalProperties: boolean;
|
|
184
|
+
description: string;
|
|
185
|
+
properties: {
|
|
186
|
+
login_display: {
|
|
187
|
+
description: string;
|
|
188
|
+
enum: string[];
|
|
189
|
+
type: string;
|
|
190
|
+
};
|
|
191
|
+
otp_autocomplete: {
|
|
192
|
+
description: string;
|
|
193
|
+
type: string;
|
|
194
|
+
};
|
|
195
|
+
phone_display: {
|
|
196
|
+
additionalProperties: boolean;
|
|
197
|
+
description: string;
|
|
198
|
+
properties: {
|
|
199
|
+
formatting: {
|
|
200
|
+
description: string;
|
|
201
|
+
enum: string[];
|
|
202
|
+
type: string;
|
|
203
|
+
};
|
|
204
|
+
masking: {
|
|
205
|
+
description: string;
|
|
206
|
+
enum: string[];
|
|
207
|
+
type: string;
|
|
208
|
+
};
|
|
209
|
+
};
|
|
210
|
+
required: string[];
|
|
211
|
+
type: string;
|
|
212
|
+
};
|
|
213
|
+
};
|
|
214
|
+
required: string[];
|
|
215
|
+
type: string;
|
|
216
|
+
};
|
|
182
217
|
fonts: {
|
|
183
218
|
additionalProperties: boolean;
|
|
184
219
|
properties: {
|
|
@@ -375,6 +410,7 @@ export default class ThemesHandler extends DefaultHandler {
|
|
|
375
410
|
existing: Theme[] | null;
|
|
376
411
|
constructor(options: DefaultHandler);
|
|
377
412
|
objString(theme: Theme): string;
|
|
413
|
+
dryRunChanges(assets: Assets): Promise<CalculatedChanges>;
|
|
378
414
|
getType(): Promise<Theme[] | null>;
|
|
379
415
|
processChanges(assets: Assets): Promise<void>;
|
|
380
416
|
deleteThemes(): Promise<void>;
|