@cloud-copilot/iam-lens 0.1.32 → 0.1.34
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/README.md +1 -1
- package/dist/cjs/cli.js +53 -97
- package/dist/cjs/cli.js.map +1 -1
- package/dist/cjs/utils/packageVersion.js +1 -1
- package/dist/cjs/utils/packageVersion.js.map +1 -1
- package/dist/cjs/utils/readPackageFile.d.ts +2 -1
- package/dist/cjs/utils/readPackageFile.d.ts.map +1 -1
- package/dist/cjs/utils/readPackageFile.js +7 -4
- package/dist/cjs/utils/readPackageFile.js.map +1 -1
- package/dist/esm/cli.js +54 -98
- package/dist/esm/cli.js.map +1 -1
- package/dist/esm/utils/packageVersion.js +2 -2
- package/dist/esm/utils/packageVersion.js.map +1 -1
- package/dist/esm/utils/readPackageFile.d.ts +2 -1
- package/dist/esm/utils/readPackageFile.d.ts.map +1 -1
- package/dist/esm/utils/readPackageFile.js +8 -5
- package/dist/esm/utils/readPackageFile.js.map +1 -1
- package/dist/esm/utils/readPackageFileEsm.d.ts.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -115,7 +115,7 @@ iam-lens simulate \
|
|
|
115
115
|
--principal arn:aws:iam::333333333333:role/DevRole \
|
|
116
116
|
--resource arn:aws:sqs:us-east-1:333333333333:my-queue \
|
|
117
117
|
--action sqs:SendMessage \
|
|
118
|
-
--context aws:SourceVpc
|
|
118
|
+
--context aws:SourceVpc vpc-1234567890abcdef0 \
|
|
119
119
|
--verbose
|
|
120
120
|
|
|
121
121
|
# Assert the result must be “Allowed”; exit code will be nonzero if not
|
package/dist/cjs/cli.js
CHANGED
|
@@ -8,121 +8,99 @@ const simulate_js_1 = require("./simulate/simulate.js");
|
|
|
8
8
|
const packageVersion_js_1 = require("./utils/packageVersion.js");
|
|
9
9
|
const whoCan_js_1 = require("./whoCan/whoCan.js");
|
|
10
10
|
const main = async () => {
|
|
11
|
-
const
|
|
12
|
-
const cli = (0, cli_1.parseCliArguments)('iam-lens', {
|
|
11
|
+
const cli = await (0, cli_1.parseCliArguments)('iam-lens', {
|
|
13
12
|
simulate: {
|
|
14
13
|
description: 'Simulate an IAM request',
|
|
15
|
-
|
|
16
|
-
principal: {
|
|
17
|
-
type: 'string',
|
|
18
|
-
values: 'single',
|
|
14
|
+
arguments: {
|
|
15
|
+
principal: (0, cli_1.stringArgument)({
|
|
19
16
|
description: 'The principal to simulate. Can be a user, role, session, or AWS service'
|
|
20
|
-
},
|
|
21
|
-
resource: {
|
|
22
|
-
type: 'string',
|
|
23
|
-
values: 'single',
|
|
17
|
+
}),
|
|
18
|
+
resource: (0, cli_1.stringArgument)({
|
|
24
19
|
description: 'The ARN of the resource to simulate access to. Ignore for wildcard actions'
|
|
25
|
-
},
|
|
26
|
-
resourceAccount: {
|
|
27
|
-
type: 'string',
|
|
28
|
-
values: 'single',
|
|
20
|
+
}),
|
|
21
|
+
resourceAccount: (0, cli_1.stringArgument)({
|
|
29
22
|
description: 'The account ID of the resource, only required if it cannot be determined from the resource ARN.'
|
|
30
|
-
},
|
|
31
|
-
action: {
|
|
32
|
-
type: 'string',
|
|
33
|
-
values: 'single',
|
|
23
|
+
}),
|
|
24
|
+
action: (0, cli_1.stringArgument)({
|
|
34
25
|
description: 'The action to simulate; must be a valid IAM service and action such as `s3:ListBucket`'
|
|
35
|
-
},
|
|
36
|
-
context: {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
verbose: {
|
|
42
|
-
type: 'boolean',
|
|
26
|
+
}),
|
|
27
|
+
context: (0, cli_1.mapArgument)({
|
|
28
|
+
description: 'The context keys to use for the simulation. The first value is the key and the rest are the values. Specify multiple keys by using --context multiple times',
|
|
29
|
+
defaultValue: {}
|
|
30
|
+
}),
|
|
31
|
+
verbose: (0, cli_1.booleanArgument)({
|
|
43
32
|
description: 'Enable verbose output for the simulation',
|
|
44
33
|
character: 'v'
|
|
45
|
-
},
|
|
46
|
-
expect: {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
},
|
|
52
|
-
ignoreMissingPrincipal: {
|
|
53
|
-
type: 'boolean',
|
|
34
|
+
}),
|
|
35
|
+
expect: (0, cli_1.enumArgument)({
|
|
36
|
+
description: 'The expected result of the simulation, if the result does not match the expected response a non-zero exit code will be returned',
|
|
37
|
+
validValues: ['Allowed', 'ImplicitlyDenied', 'ExplicitlyDenied', 'AnyDeny']
|
|
38
|
+
}),
|
|
39
|
+
ignoreMissingPrincipal: (0, cli_1.booleanArgument)({
|
|
54
40
|
description: 'Ignore if the principal does not exist. Useful for simulating actions from principals that may not exist or are outside your data set',
|
|
55
41
|
character: 'i'
|
|
56
|
-
}
|
|
42
|
+
})
|
|
57
43
|
}
|
|
58
44
|
},
|
|
59
45
|
'who-can': {
|
|
60
46
|
description: 'Find who can perform an action on a resource',
|
|
61
|
-
|
|
62
|
-
resource: {
|
|
63
|
-
type: 'string',
|
|
64
|
-
values: 'single',
|
|
47
|
+
arguments: {
|
|
48
|
+
resource: (0, cli_1.stringArgument)({
|
|
65
49
|
description: 'The ARN of the resource to check permissions for. Ignore for wildcard actions'
|
|
66
|
-
},
|
|
67
|
-
resourceAccount: {
|
|
68
|
-
type: 'string',
|
|
69
|
-
values: 'single',
|
|
50
|
+
}),
|
|
51
|
+
resourceAccount: (0, cli_1.stringArgument)({
|
|
70
52
|
description: 'The account ID of the resource, only required if it cannot be determined from the resource ARN. Required for wildcard actions'
|
|
71
|
-
},
|
|
72
|
-
actions: {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
}
|
|
53
|
+
}),
|
|
54
|
+
actions: (0, cli_1.stringArrayArgument)({
|
|
55
|
+
description: 'The actions to check permissions for; must be a valid IAM service and action such as `s3:GetObject`',
|
|
56
|
+
defaultValue: []
|
|
57
|
+
})
|
|
77
58
|
}
|
|
78
59
|
},
|
|
79
60
|
'principal-can': {
|
|
80
61
|
description: 'ALPHA: Create a consolidated view of all permissions for a principal',
|
|
81
|
-
|
|
82
|
-
principal: {
|
|
83
|
-
type: 'string',
|
|
84
|
-
values: 'single',
|
|
62
|
+
arguments: {
|
|
63
|
+
principal: (0, cli_1.stringArgument)({
|
|
85
64
|
description: 'The principal to check permissions for. Can be a user or role'
|
|
86
|
-
},
|
|
87
|
-
shrinkActionLists: {
|
|
88
|
-
|
|
89
|
-
character: 's'
|
|
90
|
-
|
|
91
|
-
}
|
|
65
|
+
}),
|
|
66
|
+
shrinkActionLists: (0, cli_1.booleanArgument)({
|
|
67
|
+
description: 'Shrink action lists to reduce policy size',
|
|
68
|
+
character: 's'
|
|
69
|
+
})
|
|
92
70
|
}
|
|
93
71
|
}
|
|
94
72
|
}, {
|
|
95
|
-
collectConfigs: {
|
|
96
|
-
type: 'string',
|
|
73
|
+
collectConfigs: (0, cli_1.stringArrayArgument)({
|
|
97
74
|
description: 'The iam-collect configuration files to use',
|
|
98
|
-
|
|
99
|
-
},
|
|
100
|
-
partition: {
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
}
|
|
75
|
+
defaultValue: []
|
|
76
|
+
}),
|
|
77
|
+
partition: (0, cli_1.stringArgument)({
|
|
78
|
+
description: 'The AWS partition to use (aws, aws-cn, aws-us-gov). Defaults to aws',
|
|
79
|
+
defaultValue: 'aws'
|
|
80
|
+
})
|
|
105
81
|
}, {
|
|
106
82
|
envPrefix: 'IAM_LENS',
|
|
107
83
|
showHelpIfNoArgs: true,
|
|
108
84
|
requireSubcommand: true,
|
|
109
|
-
|
|
85
|
+
expectOperands: false,
|
|
86
|
+
version: {
|
|
87
|
+
currentVersion: packageVersion_js_1.iamLensVersion,
|
|
88
|
+
checkForUpdates: '@cloud-copilot/iam-lens'
|
|
89
|
+
}
|
|
110
90
|
});
|
|
111
91
|
if (cli.args.collectConfigs.length === 0) {
|
|
112
92
|
cli.args.collectConfigs.push('./iam-collect.jsonc');
|
|
113
93
|
}
|
|
114
|
-
const thePartition = cli.args.partition || 'aws';
|
|
115
94
|
const collectConfigs = await (0, collect_js_1.loadCollectConfigs)(cli.args.collectConfigs);
|
|
116
|
-
const collectClient = (0, collect_js_1.getCollectClient)(collectConfigs,
|
|
95
|
+
const collectClient = (0, collect_js_1.getCollectClient)(collectConfigs, cli.args.partition);
|
|
117
96
|
if (cli.subcommand === 'simulate') {
|
|
118
97
|
const { principal, resource, resourceAccount, action, context, ignoreMissingPrincipal } = cli.args;
|
|
119
|
-
const contextKeys = convertContextKeysToMap(context);
|
|
120
98
|
const { request, result } = await (0, simulate_js_1.simulateRequest)({
|
|
121
99
|
principal: principal,
|
|
122
100
|
resourceArn: resource,
|
|
123
101
|
resourceAccount: resourceAccount,
|
|
124
102
|
action: action,
|
|
125
|
-
customContextKeys:
|
|
103
|
+
customContextKeys: context,
|
|
126
104
|
simulationMode: 'Strict',
|
|
127
105
|
ignoreMissingPrincipal
|
|
128
106
|
}, collectClient);
|
|
@@ -145,7 +123,7 @@ const main = async () => {
|
|
|
145
123
|
console.error('Error: At least 1) resource or 2) resource-account and actions must be provided for who-can command');
|
|
146
124
|
process.exit(1);
|
|
147
125
|
}
|
|
148
|
-
const results = await (0, whoCan_js_1.whoCan)(collectConfigs,
|
|
126
|
+
const results = await (0, whoCan_js_1.whoCan)(collectConfigs, cli.args.partition, {
|
|
149
127
|
resource: cli.args.resource,
|
|
150
128
|
actions: cli.args.actions,
|
|
151
129
|
resourceAccount: cli.args.resourceAccount
|
|
@@ -172,26 +150,4 @@ main()
|
|
|
172
150
|
})
|
|
173
151
|
.then(() => { })
|
|
174
152
|
.finally(() => { });
|
|
175
|
-
/**
|
|
176
|
-
* Convert the context keys from the CLI arguments into a map.
|
|
177
|
-
*
|
|
178
|
-
* @param contextKeys the context keys from the CLI arguments, formatted as key=value1,value2,...
|
|
179
|
-
* @returns a map of context keys where each key is associated with a single value or an array of values
|
|
180
|
-
*/
|
|
181
|
-
function convertContextKeysToMap(contextKeys) {
|
|
182
|
-
const contextMap = {};
|
|
183
|
-
for (const key of contextKeys) {
|
|
184
|
-
const [keyName, value] = key.split('=');
|
|
185
|
-
if (value) {
|
|
186
|
-
const values = value.split(',');
|
|
187
|
-
if (values.length > 1) {
|
|
188
|
-
contextMap[keyName] = values;
|
|
189
|
-
}
|
|
190
|
-
else {
|
|
191
|
-
contextMap[keyName] = values[0];
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
return contextMap;
|
|
196
|
-
}
|
|
197
153
|
//# sourceMappingURL=cli.js.map
|
package/dist/cjs/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../../src/cli.ts"],"names":[],"mappings":";;;AAEA,
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../../src/cli.ts"],"names":[],"mappings":";;;AAEA,4CAO2B;AAC3B,qDAA8C;AAC9C,qDAA2E;AAC3E,wDAAkF;AAClF,iEAA0D;AAC1D,kDAA2C;AAE3C,MAAM,IAAI,GAAG,KAAK,IAAI,EAAE;IACtB,MAAM,GAAG,GAAG,MAAM,IAAA,uBAAiB,EACjC,UAAU,EACV;QACE,QAAQ,EAAE;YACR,WAAW,EAAE,yBAAyB;YACtC,SAAS,EAAE;gBACT,SAAS,EAAE,IAAA,oBAAc,EAAC;oBACxB,WAAW,EAAE,yEAAyE;iBACvF,CAAC;gBACF,QAAQ,EAAE,IAAA,oBAAc,EAAC;oBACvB,WAAW,EACT,4EAA4E;iBAC/E,CAAC;gBACF,eAAe,EAAE,IAAA,oBAAc,EAAC;oBAC9B,WAAW,EACT,iGAAiG;iBACpG,CAAC;gBACF,MAAM,EAAE,IAAA,oBAAc,EAAC;oBACrB,WAAW,EACT,wFAAwF;iBAC3F,CAAC;gBACF,OAAO,EAAE,IAAA,iBAAW,EAAC;oBACnB,WAAW,EACT,6JAA6J;oBAC/J,YAAY,EAAE,EAAE;iBACjB,CAAC;gBACF,OAAO,EAAE,IAAA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iB,EAAE,GAAG,GAAG,CAAC,IAAI,CAAA;QACjD,IAAI,CAAC,SAAS,EAAE,CAAC;YACf,OAAO,CAAC,KAAK,CAAC,6DAA6D,CAAC,CAAA;YAC5E,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;QACjB,CAAC;QAED,MAAM,OAAO,GAAG,MAAM,IAAA,oBAAO,EAAC,aAAa,EAAE;YAC3C,SAAS,EAAE,SAAU;YACrB,iBAAiB;SAClB,CAAC,CAAA;QAEF,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAA;IAC/C,CAAC;AACH,CAAC,CAAA;AAED,IAAI,EAAE;KACH,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE;IACX,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;IAChB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;AACjB,CAAC,CAAC;KACD,IAAI,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC;KACd,OAAO,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAA"}
|
|
@@ -10,7 +10,7 @@ let packageCache = undefined;
|
|
|
10
10
|
*/
|
|
11
11
|
async function getPackageData() {
|
|
12
12
|
if (!packageCache) {
|
|
13
|
-
const packageJson = await (0, readPackageFile_js_1.
|
|
13
|
+
const packageJson = await (0, readPackageFile_js_1.getPackageFileReader)().readFile(['package.json']);
|
|
14
14
|
packageCache = JSON.parse(packageJson);
|
|
15
15
|
}
|
|
16
16
|
return packageCache;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../../../src/utils/packageVersion.ts"],"names":[],"mappings":";;AAwBA,wCAGC;AA3BD,
|
|
1
|
+
{"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../../../src/utils/packageVersion.ts"],"names":[],"mappings":";;AAwBA,wCAGC;AA3BD,6DAA2D;AAM3D,IAAI,YAAY,GAA4B,SAAS,CAAA;AAErD;;;;GAIG;AACH,KAAK,UAAU,cAAc;IAC3B,IAAI,CAAC,YAAY,EAAE,CAAC;QAClB,MAAM,WAAW,GAAG,MAAM,IAAA,yCAAoB,GAAE,CAAC,QAAQ,CAAC,CAAC,cAAc,CAAC,CAAC,CAAA;QAC3E,YAAY,GAAG,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,CAAA;IACxC,CAAC;IACD,OAAO,YAAa,CAAA;AACtB,CAAC;AAED;;GAEG;AACI,KAAK,UAAU,cAAc;IAClC,MAAM,IAAI,GAAG,MAAM,cAAc,EAAE,CAAA;IACnC,OAAO,IAAI,CAAC,OAAO,CAAA;AACrB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"readPackageFile.d.ts","sourceRoot":"","sources":["../../../src/utils/readPackageFile.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"readPackageFile.d.ts","sourceRoot":"","sources":["../../../src/utils/readPackageFile.ts"],"names":[],"mappings":"AAAA,OAAO,EAA2B,iBAAiB,EAAE,MAAM,oBAAoB,CAAA;AAS/E,wBAAgB,oBAAoB,IAAI,iBAAiB,CAKxD"}
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.getPackageFileReader = getPackageFileReader;
|
|
4
4
|
const cli_1 = require("@cloud-copilot/cli");
|
|
5
5
|
let levels = 3;
|
|
6
6
|
if (__filename.includes('src')) {
|
|
7
7
|
levels = 2;
|
|
8
8
|
}
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
let fileReader = undefined;
|
|
10
|
+
function getPackageFileReader() {
|
|
11
|
+
if (!fileReader) {
|
|
12
|
+
fileReader = (0, cli_1.createPackageFileReader)(__filename, levels);
|
|
13
|
+
}
|
|
14
|
+
return fileReader;
|
|
12
15
|
}
|
|
13
16
|
//# sourceMappingURL=readPackageFile.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"readPackageFile.js","sourceRoot":"","sources":["../../../src/utils/readPackageFile.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"readPackageFile.js","sourceRoot":"","sources":["../../../src/utils/readPackageFile.ts"],"names":[],"mappings":";;AASA,oDAKC;AAdD,4CAA+E;AAE/E,IAAI,MAAM,GAAG,CAAC,CAAA;AACd,IAAI,UAAU,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;IAC/B,MAAM,GAAG,CAAC,CAAA;AACZ,CAAC;AAED,IAAI,UAAU,GAAkC,SAAS,CAAA;AAEzD,SAAgB,oBAAoB;IAClC,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,UAAU,GAAG,IAAA,6BAAuB,EAAC,UAAU,EAAE,MAAM,CAAC,CAAA;IAC1D,CAAC;IACD,OAAO,UAAU,CAAA;AACnB,CAAC"}
|
package/dist/esm/cli.js
CHANGED
|
@@ -1,126 +1,104 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { parseCliArguments } from '@cloud-copilot/cli';
|
|
2
|
+
import { booleanArgument, enumArgument, mapArgument, parseCliArguments, stringArgument, stringArrayArgument } from '@cloud-copilot/cli';
|
|
3
3
|
import { canWhat } from './canWhat/canWhat.js';
|
|
4
4
|
import { getCollectClient, loadCollectConfigs } from './collect/collect.js';
|
|
5
5
|
import { resultMatchesExpectation, simulateRequest } from './simulate/simulate.js';
|
|
6
6
|
import { iamLensVersion } from './utils/packageVersion.js';
|
|
7
7
|
import { whoCan } from './whoCan/whoCan.js';
|
|
8
8
|
const main = async () => {
|
|
9
|
-
const
|
|
10
|
-
const cli = parseCliArguments('iam-lens', {
|
|
9
|
+
const cli = await parseCliArguments('iam-lens', {
|
|
11
10
|
simulate: {
|
|
12
11
|
description: 'Simulate an IAM request',
|
|
13
|
-
|
|
14
|
-
principal: {
|
|
15
|
-
type: 'string',
|
|
16
|
-
values: 'single',
|
|
12
|
+
arguments: {
|
|
13
|
+
principal: stringArgument({
|
|
17
14
|
description: 'The principal to simulate. Can be a user, role, session, or AWS service'
|
|
18
|
-
},
|
|
19
|
-
resource: {
|
|
20
|
-
type: 'string',
|
|
21
|
-
values: 'single',
|
|
15
|
+
}),
|
|
16
|
+
resource: stringArgument({
|
|
22
17
|
description: 'The ARN of the resource to simulate access to. Ignore for wildcard actions'
|
|
23
|
-
},
|
|
24
|
-
resourceAccount: {
|
|
25
|
-
type: 'string',
|
|
26
|
-
values: 'single',
|
|
18
|
+
}),
|
|
19
|
+
resourceAccount: stringArgument({
|
|
27
20
|
description: 'The account ID of the resource, only required if it cannot be determined from the resource ARN.'
|
|
28
|
-
},
|
|
29
|
-
action: {
|
|
30
|
-
type: 'string',
|
|
31
|
-
values: 'single',
|
|
21
|
+
}),
|
|
22
|
+
action: stringArgument({
|
|
32
23
|
description: 'The action to simulate; must be a valid IAM service and action such as `s3:ListBucket`'
|
|
33
|
-
},
|
|
34
|
-
context: {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
verbose: {
|
|
40
|
-
type: 'boolean',
|
|
24
|
+
}),
|
|
25
|
+
context: mapArgument({
|
|
26
|
+
description: 'The context keys to use for the simulation. The first value is the key and the rest are the values. Specify multiple keys by using --context multiple times',
|
|
27
|
+
defaultValue: {}
|
|
28
|
+
}),
|
|
29
|
+
verbose: booleanArgument({
|
|
41
30
|
description: 'Enable verbose output for the simulation',
|
|
42
31
|
character: 'v'
|
|
43
|
-
},
|
|
44
|
-
expect: {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
},
|
|
50
|
-
ignoreMissingPrincipal: {
|
|
51
|
-
type: 'boolean',
|
|
32
|
+
}),
|
|
33
|
+
expect: enumArgument({
|
|
34
|
+
description: 'The expected result of the simulation, if the result does not match the expected response a non-zero exit code will be returned',
|
|
35
|
+
validValues: ['Allowed', 'ImplicitlyDenied', 'ExplicitlyDenied', 'AnyDeny']
|
|
36
|
+
}),
|
|
37
|
+
ignoreMissingPrincipal: booleanArgument({
|
|
52
38
|
description: 'Ignore if the principal does not exist. Useful for simulating actions from principals that may not exist or are outside your data set',
|
|
53
39
|
character: 'i'
|
|
54
|
-
}
|
|
40
|
+
})
|
|
55
41
|
}
|
|
56
42
|
},
|
|
57
43
|
'who-can': {
|
|
58
44
|
description: 'Find who can perform an action on a resource',
|
|
59
|
-
|
|
60
|
-
resource: {
|
|
61
|
-
type: 'string',
|
|
62
|
-
values: 'single',
|
|
45
|
+
arguments: {
|
|
46
|
+
resource: stringArgument({
|
|
63
47
|
description: 'The ARN of the resource to check permissions for. Ignore for wildcard actions'
|
|
64
|
-
},
|
|
65
|
-
resourceAccount: {
|
|
66
|
-
type: 'string',
|
|
67
|
-
values: 'single',
|
|
48
|
+
}),
|
|
49
|
+
resourceAccount: stringArgument({
|
|
68
50
|
description: 'The account ID of the resource, only required if it cannot be determined from the resource ARN. Required for wildcard actions'
|
|
69
|
-
},
|
|
70
|
-
actions: {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
}
|
|
51
|
+
}),
|
|
52
|
+
actions: stringArrayArgument({
|
|
53
|
+
description: 'The actions to check permissions for; must be a valid IAM service and action such as `s3:GetObject`',
|
|
54
|
+
defaultValue: []
|
|
55
|
+
})
|
|
75
56
|
}
|
|
76
57
|
},
|
|
77
58
|
'principal-can': {
|
|
78
59
|
description: 'ALPHA: Create a consolidated view of all permissions for a principal',
|
|
79
|
-
|
|
80
|
-
principal: {
|
|
81
|
-
type: 'string',
|
|
82
|
-
values: 'single',
|
|
60
|
+
arguments: {
|
|
61
|
+
principal: stringArgument({
|
|
83
62
|
description: 'The principal to check permissions for. Can be a user or role'
|
|
84
|
-
},
|
|
85
|
-
shrinkActionLists: {
|
|
86
|
-
|
|
87
|
-
character: 's'
|
|
88
|
-
|
|
89
|
-
}
|
|
63
|
+
}),
|
|
64
|
+
shrinkActionLists: booleanArgument({
|
|
65
|
+
description: 'Shrink action lists to reduce policy size',
|
|
66
|
+
character: 's'
|
|
67
|
+
})
|
|
90
68
|
}
|
|
91
69
|
}
|
|
92
70
|
}, {
|
|
93
|
-
collectConfigs: {
|
|
94
|
-
type: 'string',
|
|
71
|
+
collectConfigs: stringArrayArgument({
|
|
95
72
|
description: 'The iam-collect configuration files to use',
|
|
96
|
-
|
|
97
|
-
},
|
|
98
|
-
partition: {
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
}
|
|
73
|
+
defaultValue: []
|
|
74
|
+
}),
|
|
75
|
+
partition: stringArgument({
|
|
76
|
+
description: 'The AWS partition to use (aws, aws-cn, aws-us-gov). Defaults to aws',
|
|
77
|
+
defaultValue: 'aws'
|
|
78
|
+
})
|
|
103
79
|
}, {
|
|
104
80
|
envPrefix: 'IAM_LENS',
|
|
105
81
|
showHelpIfNoArgs: true,
|
|
106
82
|
requireSubcommand: true,
|
|
107
|
-
|
|
83
|
+
expectOperands: false,
|
|
84
|
+
version: {
|
|
85
|
+
currentVersion: iamLensVersion,
|
|
86
|
+
checkForUpdates: '@cloud-copilot/iam-lens'
|
|
87
|
+
}
|
|
108
88
|
});
|
|
109
89
|
if (cli.args.collectConfigs.length === 0) {
|
|
110
90
|
cli.args.collectConfigs.push('./iam-collect.jsonc');
|
|
111
91
|
}
|
|
112
|
-
const thePartition = cli.args.partition || 'aws';
|
|
113
92
|
const collectConfigs = await loadCollectConfigs(cli.args.collectConfigs);
|
|
114
|
-
const collectClient = getCollectClient(collectConfigs,
|
|
93
|
+
const collectClient = getCollectClient(collectConfigs, cli.args.partition);
|
|
115
94
|
if (cli.subcommand === 'simulate') {
|
|
116
95
|
const { principal, resource, resourceAccount, action, context, ignoreMissingPrincipal } = cli.args;
|
|
117
|
-
const contextKeys = convertContextKeysToMap(context);
|
|
118
96
|
const { request, result } = await simulateRequest({
|
|
119
97
|
principal: principal,
|
|
120
98
|
resourceArn: resource,
|
|
121
99
|
resourceAccount: resourceAccount,
|
|
122
100
|
action: action,
|
|
123
|
-
customContextKeys:
|
|
101
|
+
customContextKeys: context,
|
|
124
102
|
simulationMode: 'Strict',
|
|
125
103
|
ignoreMissingPrincipal
|
|
126
104
|
}, collectClient);
|
|
@@ -143,7 +121,7 @@ const main = async () => {
|
|
|
143
121
|
console.error('Error: At least 1) resource or 2) resource-account and actions must be provided for who-can command');
|
|
144
122
|
process.exit(1);
|
|
145
123
|
}
|
|
146
|
-
const results = await whoCan(collectConfigs,
|
|
124
|
+
const results = await whoCan(collectConfigs, cli.args.partition, {
|
|
147
125
|
resource: cli.args.resource,
|
|
148
126
|
actions: cli.args.actions,
|
|
149
127
|
resourceAccount: cli.args.resourceAccount
|
|
@@ -170,26 +148,4 @@ main()
|
|
|
170
148
|
})
|
|
171
149
|
.then(() => { })
|
|
172
150
|
.finally(() => { });
|
|
173
|
-
/**
|
|
174
|
-
* Convert the context keys from the CLI arguments into a map.
|
|
175
|
-
*
|
|
176
|
-
* @param contextKeys the context keys from the CLI arguments, formatted as key=value1,value2,...
|
|
177
|
-
* @returns a map of context keys where each key is associated with a single value or an array of values
|
|
178
|
-
*/
|
|
179
|
-
function convertContextKeysToMap(contextKeys) {
|
|
180
|
-
const contextMap = {};
|
|
181
|
-
for (const key of contextKeys) {
|
|
182
|
-
const [keyName, value] = key.split('=');
|
|
183
|
-
if (value) {
|
|
184
|
-
const values = value.split(',');
|
|
185
|
-
if (values.length > 1) {
|
|
186
|
-
contextMap[keyName] = values;
|
|
187
|
-
}
|
|
188
|
-
else {
|
|
189
|
-
contextMap[keyName] = values[0];
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
return contextMap;
|
|
194
|
-
}
|
|
195
151
|
//# sourceMappingURL=cli.js.map
|
package/dist/esm/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../../src/cli.ts"],"names":[],"mappings":";AAEA,OAAO,
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../../src/cli.ts"],"names":[],"mappings":";AAEA,OAAO,EACL,eAAe,EACf,YAAY,EACZ,WAAW,EACX,iBAAiB,EACjB,cAAc,EACd,mBAAmB,EACpB,MAAM,oBAAoB,CAAA;AAC3B,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAA;AAC9C,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;AAC3E,OAAO,EAAE,wBAAwB,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;AAClF,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAA;AAC1D,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAA;AAE3C,MAAM,IAAI,GAAG,KAAK,IAAI,EAAE;IACtB,MAAM,GAAG,GAAG,MAAM,iBAAiB,CACjC,UAAU,EACV;QACE,QAAQ,EAAE;YACR,WAAW,EAAE,yBAAyB;YACtC,SAAS,EAAE;gBACT,SAAS,EAAE,cAAc,CAAC;oBACxB,WAAW,EAAE,yEAAyE;iBACvF,CAAC;gBACF,QAAQ,EAAE,cAAc,CAAC;oBACvB,WAAW,EACT,4EAA4E;iBAC/E,CAAC;gBACF,eAAe,EAAE,cAAc,CAAC;oBAC9B,WAAW,EACT,iGAAiG;iBACpG,CAAC;gBACF,MAAM,EAAE,cAAc,CAAC;oBACrB,WAAW,EACT,wFAAwF;iBAC3F,CAAC;gBACF,OAAO,EAAE,WAAW,CAAC;oBACnB,WAAW,EACT,6JAA6J;oBAC/J,YAAY,EAAE,EAAE;iBACjB,CAAC;gBACF,OAAO,EAAE,eAAe,CAAC;oBACvB,WAAW,EAAE,0CAA0C;oBACvD,SAAS,EAAE,GAAG;iBACf,CAAC;gBACF,MAAM,EAAE,YAAY,CAAC;oBACnB,WAAW,EACT,iIAAiI;oBACnI,WAAW,EAAE,CAA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AE,SAAU;YACrB,iBAAiB;SAClB,CAAC,CAAA;QAEF,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAA;IAC/C,CAAC;AACH,CAAC,CAAA;AAED,IAAI,EAAE;KACH,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE;IACX,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;IAChB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;AACjB,CAAC,CAAC;KACD,IAAI,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC;KACd,OAAO,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getPackageFileReader } from './readPackageFile.js';
|
|
2
2
|
let packageCache = undefined;
|
|
3
3
|
/**
|
|
4
4
|
* Get the package data version
|
|
@@ -7,7 +7,7 @@ let packageCache = undefined;
|
|
|
7
7
|
*/
|
|
8
8
|
async function getPackageData() {
|
|
9
9
|
if (!packageCache) {
|
|
10
|
-
const packageJson = await
|
|
10
|
+
const packageJson = await getPackageFileReader().readFile(['package.json']);
|
|
11
11
|
packageCache = JSON.parse(packageJson);
|
|
12
12
|
}
|
|
13
13
|
return packageCache;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../../../src/utils/packageVersion.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../../../src/utils/packageVersion.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAA;AAM3D,IAAI,YAAY,GAA4B,SAAS,CAAA;AAErD;;;;GAIG;AACH,KAAK,UAAU,cAAc;IAC3B,IAAI,CAAC,YAAY,EAAE,CAAC;QAClB,MAAM,WAAW,GAAG,MAAM,oBAAoB,EAAE,CAAC,QAAQ,CAAC,CAAC,cAAc,CAAC,CAAC,CAAA;QAC3E,YAAY,GAAG,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,CAAA;IACxC,CAAC;IACD,OAAO,YAAa,CAAA;AACtB,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc;IAClC,MAAM,IAAI,GAAG,MAAM,cAAc,EAAE,CAAA;IACnC,OAAO,IAAI,CAAC,OAAO,CAAA;AACrB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"readPackageFile.d.ts","sourceRoot":"","sources":["../../../src/utils/readPackageFile.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"readPackageFile.d.ts","sourceRoot":"","sources":["../../../src/utils/readPackageFile.ts"],"names":[],"mappings":"AAAA,OAAO,EAA2B,iBAAiB,EAAE,MAAM,oBAAoB,CAAA;AAS/E,wBAAgB,oBAAoB,IAAI,iBAAiB,CAKxD"}
|
|
@@ -1,12 +1,15 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { createPackageFileReader } from '@cloud-copilot/cli';
|
|
2
2
|
let levels = 3;
|
|
3
3
|
//@ts-ignore
|
|
4
4
|
if (import.meta.url.includes('src')) {
|
|
5
5
|
levels = 2;
|
|
6
6
|
}
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
let fileReader = undefined;
|
|
8
|
+
export function getPackageFileReader() {
|
|
9
|
+
if (!fileReader) {
|
|
10
|
+
//@ts-ignore
|
|
11
|
+
fileReader = createPackageFileReader(import.meta.url, levels);
|
|
12
|
+
}
|
|
13
|
+
return fileReader;
|
|
11
14
|
}
|
|
12
15
|
//# sourceMappingURL=readPackageFileEsm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"readPackageFileEsm.js","sourceRoot":"","sources":["../../../src/utils/readPackageFileEsm.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"readPackageFileEsm.js","sourceRoot":"","sources":["../../../src/utils/readPackageFileEsm.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAA0B,MAAM,oBAAoB,CAAA;AAEpF,IAAI,MAAM,GAAG,CAAC,CAAA;AACd,YAAY;AACZ,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;IACpC,MAAM,GAAG,CAAC,CAAA;AACZ,CAAC;AAED,IAAI,UAAU,GAAkC,SAAS,CAAA;AAEzD,MAAM,UAAU,oBAAoB;IAClC,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,YAAY;QACZ,UAAU,GAAG,uBAAuB,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,MAAM,CAAC,CAAA;IAC/D,CAAC;IACD,OAAO,UAAU,CAAA;AACnB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"readPackageFileEsm.d.ts","sourceRoot":"","sources":["../../../src/utils/readPackageFileEsm.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"readPackageFileEsm.d.ts","sourceRoot":"","sources":["../../../src/utils/readPackageFileEsm.ts"],"names":[],"mappings":"AAAA,OAAO,EAA2B,KAAK,iBAAiB,EAAE,MAAM,oBAAoB,CAAA;AAUpF,wBAAgB,oBAAoB,IAAI,iBAAiB,CAMxD"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloud-copilot/iam-lens",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.34",
|
|
4
4
|
"description": "Visibility in IAM in and across AWS accounts",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"aws",
|
|
@@ -110,7 +110,7 @@
|
|
|
110
110
|
]
|
|
111
111
|
},
|
|
112
112
|
"dependencies": {
|
|
113
|
-
"@cloud-copilot/cli": "^0.
|
|
113
|
+
"@cloud-copilot/cli": "^0.2.5",
|
|
114
114
|
"@cloud-copilot/iam-collect": "^0.1.92",
|
|
115
115
|
"@cloud-copilot/iam-data": "^0.9.202505242",
|
|
116
116
|
"@cloud-copilot/iam-expand": "^0.11.13",
|