@aws-mdaa/dataops-job-l3-construct 1.4.0 → 1.6.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/.jsii +117 -121
- package/README.md +5 -0
- package/lib/dataops-job-l3-construct.d.ts +37 -240
- package/lib/dataops-job-l3-construct.js +61 -34
- package/node_modules/@aws-mdaa/config/.npmignore +34 -0
- package/node_modules/@aws-mdaa/config/README.md +3 -0
- package/node_modules/@aws-mdaa/config/jest.config.js +5 -0
- package/node_modules/@aws-mdaa/config/lib/blueprint-value-transformer.d.ts +20 -0
- package/node_modules/@aws-mdaa/config/lib/blueprint-value-transformer.js +70 -0
- package/node_modules/@aws-mdaa/config/lib/blueprint-value-transformer.ts +88 -0
- package/node_modules/@aws-mdaa/config/lib/config.d.ts +87 -0
- package/node_modules/@aws-mdaa/config/lib/config.js +7 -0
- package/node_modules/@aws-mdaa/config/lib/config.ts +92 -0
- package/node_modules/@aws-mdaa/config/lib/index.d.ts +11 -0
- package/node_modules/@aws-mdaa/config/lib/index.js +28 -0
- package/node_modules/@aws-mdaa/config/lib/index.ts +12 -0
- package/node_modules/@aws-mdaa/config/lib/param-transformer.d.ts +49 -0
- package/node_modules/@aws-mdaa/config/lib/param-transformer.js +160 -0
- package/node_modules/@aws-mdaa/config/lib/param-transformer.ts +159 -0
- package/node_modules/@aws-mdaa/config/lib/path-value-transformer.d.ts +10 -0
- package/node_modules/@aws-mdaa/config/lib/path-value-transformer.js +30 -0
- package/node_modules/@aws-mdaa/config/lib/path-value-transformer.ts +27 -0
- package/node_modules/@aws-mdaa/config/lib/ref-value-transformer.d.ts +44 -0
- package/node_modules/@aws-mdaa/config/lib/ref-value-transformer.js +243 -0
- package/node_modules/@aws-mdaa/config/lib/ref-value-transformer.ts +302 -0
- package/node_modules/@aws-mdaa/config/lib/ssm-ref-transformer.d.ts +8 -0
- package/node_modules/@aws-mdaa/config/lib/ssm-ref-transformer.js +22 -0
- package/node_modules/@aws-mdaa/config/lib/ssm-ref-transformer.ts +21 -0
- package/node_modules/@aws-mdaa/config/lib/transformer.d.ts +35 -0
- package/node_modules/@aws-mdaa/config/lib/transformer.js +66 -0
- package/node_modules/@aws-mdaa/config/lib/transformer.ts +74 -0
- package/node_modules/@aws-mdaa/{s3-bucketpolicy-helper → config}/package.json +17 -17
- package/node_modules/@aws-mdaa/config/test/blueprint-value-transformer.test.d.ts +5 -0
- package/node_modules/@aws-mdaa/config/test/blueprint-value-transformer.test.js +224 -0
- package/node_modules/@aws-mdaa/config/test/blueprint-value-transformer.test.ts +259 -0
- package/node_modules/@aws-mdaa/config/test/config-nt.test.d.ts +5 -0
- package/node_modules/@aws-mdaa/config/test/config-nt.test.js +129 -0
- package/node_modules/@aws-mdaa/config/test/config-nt.test.ts +163 -0
- package/node_modules/@aws-mdaa/config/test/config.test.d.ts +5 -0
- package/node_modules/@aws-mdaa/config/test/config.test.js +409 -0
- package/node_modules/@aws-mdaa/config/test/config.test.ts +517 -0
- package/node_modules/@aws-mdaa/config/test/param-transformer.test.d.ts +5 -0
- package/node_modules/@aws-mdaa/config/test/param-transformer.test.js +216 -0
- package/node_modules/@aws-mdaa/config/test/param-transformer.test.ts +234 -0
- package/node_modules/@aws-mdaa/config/test/path-value-transformer.test.d.ts +5 -0
- package/node_modules/@aws-mdaa/config/test/path-value-transformer.test.js +59 -0
- package/node_modules/@aws-mdaa/config/test/path-value-transformer.test.ts +68 -0
- package/node_modules/@aws-mdaa/config/test/ref-value-transformer.test.d.ts +5 -0
- package/node_modules/@aws-mdaa/config/test/ref-value-transformer.test.js +254 -0
- package/node_modules/@aws-mdaa/config/test/ref-value-transformer.test.ts +304 -0
- package/node_modules/@aws-mdaa/config/test/ssm-ref-transformer.test.d.ts +5 -0
- package/node_modules/@aws-mdaa/config/test/ssm-ref-transformer.test.js +66 -0
- package/node_modules/@aws-mdaa/config/test/ssm-ref-transformer.test.ts +79 -0
- package/node_modules/@aws-mdaa/config/tsconfig.json +40 -0
- package/node_modules/@aws-mdaa/config/tsconfig.tsbuildinfo +1 -0
- package/node_modules/@aws-mdaa/config/typedoc.json +7 -0
- package/node_modules/lodash/README.md +2 -2
- package/node_modules/lodash/_baseOrderBy.js +1 -1
- package/node_modules/lodash/_baseUnset.js +7 -20
- package/node_modules/lodash/_setCacheHas.js +1 -1
- package/node_modules/lodash/compact.js +1 -1
- package/node_modules/lodash/core.js +3 -3
- package/node_modules/lodash/core.min.js +26 -25
- package/node_modules/lodash/fromPairs.js +3 -1
- package/node_modules/lodash/lodash.js +38 -27
- package/node_modules/lodash/lodash.min.js +125 -129
- package/node_modules/lodash/package.json +4 -2
- package/node_modules/lodash/random.js +9 -0
- package/node_modules/lodash/template.js +16 -4
- package/node_modules/lodash/templateSettings.js +4 -0
- package/package.json +27 -30
- package/node_modules/@aws-mdaa/s3-bucketpolicy-helper/README.md +0 -185
- package/node_modules/@aws-mdaa/s3-bucketpolicy-helper/lib/index.d.ts +0 -57
- package/node_modules/@aws-mdaa/s3-bucketpolicy-helper/lib/index.js +0 -198
- package/node_modules/@aws-mdaa/s3-inventory-helper/README.md +0 -3
- package/node_modules/@aws-mdaa/s3-inventory-helper/lib/index.d.ts +0 -66
- package/node_modules/@aws-mdaa/s3-inventory-helper/lib/index.js +0 -222
- package/node_modules/@aws-mdaa/s3-inventory-helper/package.json +0 -42
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lodash",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.18.1",
|
|
4
4
|
"description": "Lodash modular utilities.",
|
|
5
5
|
"keywords": "modules, stdlib, util",
|
|
6
6
|
"homepage": "https://lodash.com/",
|
|
@@ -13,5 +13,7 @@
|
|
|
13
13
|
"John-David Dalton <john.david.dalton@gmail.com>",
|
|
14
14
|
"Mathias Bynens <mathias@qiwi.be>"
|
|
15
15
|
],
|
|
16
|
-
"scripts": {
|
|
16
|
+
"scripts": {
|
|
17
|
+
"test": "echo \"See https://travis-ci.org/lodash-archive/lodash-cli for testing details.\""
|
|
18
|
+
}
|
|
17
19
|
}
|
|
@@ -18,6 +18,8 @@ var nativeMin = Math.min,
|
|
|
18
18
|
* **Note:** JavaScript follows the IEEE-754 standard for resolving
|
|
19
19
|
* floating-point values which can produce unexpected results.
|
|
20
20
|
*
|
|
21
|
+
* **Note:** If `lower` is greater than `upper`, the values are swapped.
|
|
22
|
+
*
|
|
21
23
|
* @static
|
|
22
24
|
* @memberOf _
|
|
23
25
|
* @since 0.7.0
|
|
@@ -31,9 +33,16 @@ var nativeMin = Math.min,
|
|
|
31
33
|
* _.random(0, 5);
|
|
32
34
|
* // => an integer between 0 and 5
|
|
33
35
|
*
|
|
36
|
+
* // when lower is greater than upper the values are swapped
|
|
37
|
+
* _.random(5, 0);
|
|
38
|
+
* // => an integer between 0 and 5
|
|
39
|
+
*
|
|
34
40
|
* _.random(5);
|
|
35
41
|
* // => also an integer between 0 and 5
|
|
36
42
|
*
|
|
43
|
+
* _.random(-5);
|
|
44
|
+
* // => an integer between -5 and 0
|
|
45
|
+
*
|
|
37
46
|
* _.random(5, true);
|
|
38
47
|
* // => a floating-point number between 0 and 5
|
|
39
48
|
*
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
var
|
|
1
|
+
var arrayEach = require('./_arrayEach'),
|
|
2
|
+
assignWith = require('./assignWith'),
|
|
2
3
|
attempt = require('./attempt'),
|
|
3
4
|
baseValues = require('./_baseValues'),
|
|
4
5
|
customDefaultsAssignIn = require('./_customDefaultsAssignIn'),
|
|
@@ -11,7 +12,8 @@ var assignInWith = require('./assignInWith'),
|
|
|
11
12
|
toString = require('./toString');
|
|
12
13
|
|
|
13
14
|
/** Error message constants. */
|
|
14
|
-
var INVALID_TEMPL_VAR_ERROR_TEXT = 'Invalid `variable` option passed into `_.template`'
|
|
15
|
+
var INVALID_TEMPL_VAR_ERROR_TEXT = 'Invalid `variable` option passed into `_.template`',
|
|
16
|
+
INVALID_TEMPL_IMPORTS_ERROR_TEXT = 'Invalid `imports` option passed into `_.template`';
|
|
15
17
|
|
|
16
18
|
/** Used to match empty string literals in compiled template source. */
|
|
17
19
|
var reEmptyStringLeading = /\b__p \+= '';/g,
|
|
@@ -55,6 +57,10 @@ var hasOwnProperty = objectProto.hasOwnProperty;
|
|
|
55
57
|
* properties may be accessed as free variables in the template. If a setting
|
|
56
58
|
* object is given, it takes precedence over `_.templateSettings` values.
|
|
57
59
|
*
|
|
60
|
+
* **Security:** `_.template` is insecure and should not be used. It will be
|
|
61
|
+
* removed in Lodash v5. Avoid untrusted input. See
|
|
62
|
+
* [threat model](https://github.com/lodash/lodash/blob/main/threat-model.md).
|
|
63
|
+
*
|
|
58
64
|
* **Note:** In the development build `_.template` utilizes
|
|
59
65
|
* [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl)
|
|
60
66
|
* for easier debugging.
|
|
@@ -162,12 +168,18 @@ function template(string, options, guard) {
|
|
|
162
168
|
options = undefined;
|
|
163
169
|
}
|
|
164
170
|
string = toString(string);
|
|
165
|
-
options =
|
|
171
|
+
options = assignWith({}, options, settings, customDefaultsAssignIn);
|
|
166
172
|
|
|
167
|
-
var imports =
|
|
173
|
+
var imports = assignWith({}, options.imports, settings.imports, customDefaultsAssignIn),
|
|
168
174
|
importsKeys = keys(imports),
|
|
169
175
|
importsValues = baseValues(imports, importsKeys);
|
|
170
176
|
|
|
177
|
+
arrayEach(importsKeys, function(key) {
|
|
178
|
+
if (reForbiddenIdentifierChars.test(key)) {
|
|
179
|
+
throw new Error(INVALID_TEMPL_IMPORTS_ERROR_TEXT);
|
|
180
|
+
}
|
|
181
|
+
});
|
|
182
|
+
|
|
171
183
|
var isEscaping,
|
|
172
184
|
isEvaluating,
|
|
173
185
|
index = 0,
|
|
@@ -8,6 +8,10 @@ var escape = require('./escape'),
|
|
|
8
8
|
* embedded Ruby (ERB) as well as ES2015 template strings. Change the
|
|
9
9
|
* following template settings to use alternative delimiters.
|
|
10
10
|
*
|
|
11
|
+
* **Security:** See
|
|
12
|
+
* [threat model](https://github.com/lodash/lodash/blob/main/threat-model.md)
|
|
13
|
+
* — `_.template` is insecure and will be removed in v5.
|
|
14
|
+
*
|
|
11
15
|
* @static
|
|
12
16
|
* @memberOf _
|
|
13
17
|
* @type {Object}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-mdaa/dataops-job-l3-construct",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.0",
|
|
4
4
|
"description": "MDAA DataOps Job L3 Construct",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": {
|
|
@@ -16,15 +16,15 @@
|
|
|
16
16
|
"watch": "jsii -w --project-references",
|
|
17
17
|
"package": "jsii-pacmak --npmignore=false",
|
|
18
18
|
"test": "jest --passWithNoTests --coverage",
|
|
19
|
-
"lint": "eslint --max-warnings 0 -c
|
|
20
|
-
"test-
|
|
19
|
+
"lint": "eslint --max-warnings 0 -c ../../../../../eslint.config.mjs",
|
|
20
|
+
"test:package-docs": "../../../../../scripts/generate_docs/test_package_docs.sh"
|
|
21
21
|
},
|
|
22
22
|
"main": "lib/index.js",
|
|
23
23
|
"types": "lib/index.d.ts",
|
|
24
24
|
"devDependencies": {
|
|
25
|
-
"@aws-mdaa/construct": "1.
|
|
26
|
-
"@aws-mdaa/l3-construct": "1.
|
|
27
|
-
"@aws-mdaa/testing": "1.
|
|
25
|
+
"@aws-mdaa/construct": "1.6.0",
|
|
26
|
+
"@aws-mdaa/l3-construct": "1.6.0",
|
|
27
|
+
"@aws-mdaa/testing": "1.6.0",
|
|
28
28
|
"@types/jest": "29.5.14",
|
|
29
29
|
"@types/node": "22.9.0",
|
|
30
30
|
"@types/prettier": "2.6.0",
|
|
@@ -32,40 +32,33 @@
|
|
|
32
32
|
"constructs": "10.0.96",
|
|
33
33
|
"jest": "29.7.0",
|
|
34
34
|
"source-map-support": "0.5.21",
|
|
35
|
-
"ts-jest": "29.4.
|
|
35
|
+
"ts-jest": "29.4.9",
|
|
36
36
|
"ts-node": "10.9.2",
|
|
37
37
|
"typescript": "5.9.3",
|
|
38
|
-
"typescript-json-schema": "0.67.
|
|
38
|
+
"typescript-json-schema": "0.67.4"
|
|
39
39
|
},
|
|
40
|
-
"bundledDependencies": [
|
|
41
|
-
"@aws-mdaa/s3-bucketpolicy-helper",
|
|
42
|
-
"@aws-mdaa/s3-inventory-helper",
|
|
43
|
-
"lodash"
|
|
44
|
-
],
|
|
45
40
|
"peerDependencies": {
|
|
46
|
-
"@aws-mdaa/construct": "1.
|
|
47
|
-
"@aws-mdaa/l3-construct": "1.
|
|
41
|
+
"@aws-mdaa/construct": "1.6.0",
|
|
42
|
+
"@aws-mdaa/l3-construct": "1.6.0",
|
|
48
43
|
"aws-cdk-lib": "2.220.0",
|
|
49
44
|
"constructs": "10.0.96"
|
|
50
45
|
},
|
|
51
46
|
"dependencies": {
|
|
52
|
-
"@aws-mdaa/cloudwatch-constructs": "1.
|
|
53
|
-
"@aws-mdaa/
|
|
54
|
-
"@aws-mdaa/
|
|
55
|
-
"@aws-mdaa/
|
|
56
|
-
"@aws-mdaa/
|
|
57
|
-
"@aws-mdaa/
|
|
58
|
-
"@aws-mdaa/iam-
|
|
59
|
-
"@aws-mdaa/
|
|
60
|
-
"@aws-mdaa/
|
|
61
|
-
"@aws-mdaa/s3-
|
|
62
|
-
"@aws-mdaa/
|
|
63
|
-
"@aws-mdaa/s3-inventory-helper": "1.4.0",
|
|
64
|
-
"@aws-mdaa/sns-constructs": "1.4.0",
|
|
47
|
+
"@aws-mdaa/cloudwatch-constructs": "1.6.0",
|
|
48
|
+
"@aws-mdaa/config": "1.6.0",
|
|
49
|
+
"@aws-mdaa/construct": "1.6.0",
|
|
50
|
+
"@aws-mdaa/dataops-project-l3-construct": "1.6.0",
|
|
51
|
+
"@aws-mdaa/eventbridge-helper": "1.6.0",
|
|
52
|
+
"@aws-mdaa/glue-constructs": "1.6.0",
|
|
53
|
+
"@aws-mdaa/iam-constructs": "1.6.0",
|
|
54
|
+
"@aws-mdaa/iam-role-helper": "1.6.0",
|
|
55
|
+
"@aws-mdaa/l3-construct": "1.6.0",
|
|
56
|
+
"@aws-mdaa/s3-constructs": "1.6.0",
|
|
57
|
+
"@aws-mdaa/sns-constructs": "1.6.0",
|
|
65
58
|
"aws-cdk-lib": "2.220.0",
|
|
66
59
|
"cdk-nag": "2.37.55",
|
|
67
60
|
"constructs": "10.0.96",
|
|
68
|
-
"lodash": "4.
|
|
61
|
+
"lodash": "4.18.1"
|
|
69
62
|
},
|
|
70
63
|
"gitHead": "ade1ce5962dee1fa47a3668c8e35d130c686ad35",
|
|
71
64
|
"stability": "experimental",
|
|
@@ -73,5 +66,9 @@
|
|
|
73
66
|
"outdir": "jsii-dist",
|
|
74
67
|
"versionFormat": "full",
|
|
75
68
|
"targets": {}
|
|
76
|
-
}
|
|
69
|
+
},
|
|
70
|
+
"bundledDependencies": [
|
|
71
|
+
"@aws-mdaa/config",
|
|
72
|
+
"lodash"
|
|
73
|
+
]
|
|
77
74
|
}
|
|
@@ -1,185 +0,0 @@
|
|
|
1
|
-
# S3 Bucket Policy Helper
|
|
2
|
-
|
|
3
|
-
This is a helper class that helps construct working S3 Bucket policy statements that can be added to a bucket construct.
|
|
4
|
-
|
|
5
|
-
## Class RestrictObjectPrefixToRoles
|
|
6
|
-
|
|
7
|
-
This helper class helps construct a working policy that allows a group of Roles to access to an object prefix in S3.
|
|
8
|
-
|
|
9
|
-
Depending on the values provided, it will produce two PolicyStatement types accessible by methods.
|
|
10
|
-
|
|
11
|
-
One for Read access to an object prefix that generally resolves to:
|
|
12
|
-
|
|
13
|
-
```yaml
|
|
14
|
-
- Action: s3:GetObject*
|
|
15
|
-
Condition:
|
|
16
|
-
StringLike:
|
|
17
|
-
aws:userId:
|
|
18
|
-
- AROA12345678:*
|
|
19
|
-
Effect: Allow
|
|
20
|
-
Principal: "*"
|
|
21
|
-
Resource:
|
|
22
|
-
Fn::Join:
|
|
23
|
-
- ""
|
|
24
|
-
- - Fn::GetAtt:
|
|
25
|
-
- BuckettransformedCbdgadDatalakeTransformedPrototype20210115E093F710
|
|
26
|
-
- Arn
|
|
27
|
-
- /inventory/*
|
|
28
|
-
Sid: inventory/Read
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
One for write access to an object prefix that generally resolves to:
|
|
32
|
-
|
|
33
|
-
```yaml
|
|
34
|
-
- Action:
|
|
35
|
-
- s3:GetObject*
|
|
36
|
-
- s3:PutObject*
|
|
37
|
-
- s3:DeleteObject*
|
|
38
|
-
Condition:
|
|
39
|
-
StringLike:
|
|
40
|
-
aws:userId:
|
|
41
|
-
- AROA12345678:*
|
|
42
|
-
Effect: Allow
|
|
43
|
-
Principal: "*"
|
|
44
|
-
Resource:
|
|
45
|
-
Fn::Join:
|
|
46
|
-
- ""
|
|
47
|
-
- - Fn::GetAtt:
|
|
48
|
-
- BuckettransformedCbdgadDatalakeTransformedPrototype20210115E093F710
|
|
49
|
-
- Arn
|
|
50
|
-
- /inventory/*
|
|
51
|
-
Sid: inventory/ReadWrite
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
Conditionals against `aws:userId` are used to support federated roles. The `@aws-mdaa/iam-role-helper` is used to resolve the requested ARNs to AROA IDs.
|
|
55
|
-
|
|
56
|
-
## RestrictObjectPrefixToRoles example
|
|
57
|
-
|
|
58
|
-
```typescript
|
|
59
|
-
import {MdaaRoleResolver} from '@aws-mdaa/am-role-helper'
|
|
60
|
-
import {RestrictObjectPrefixToRoles} from '@aws-mdaa/3-bucketpolicy-helper'
|
|
61
|
-
|
|
62
|
-
const roleResolver = new MdaaRoleResolver({
|
|
63
|
-
roleArns: [
|
|
64
|
-
'arn:{{partition}}:iam::{{account}}:role/application_abc/component_xyz/S3Access',
|
|
65
|
-
'arn:{{partition}}:iam::{{account}}:role/service-role/QuickSightAction'
|
|
66
|
-
]
|
|
67
|
-
})
|
|
68
|
-
|
|
69
|
-
roleResolver.init().then(() => {
|
|
70
|
-
const RestrictPrefix = new RestrictObjectPrefixToRoles({
|
|
71
|
-
// bucket in this context is a constructed s3.Bucket class
|
|
72
|
-
s3Bucket: bucket,
|
|
73
|
-
s3Prefix: '/protected',
|
|
74
|
-
readRoles: [
|
|
75
|
-
'arn:{{partition}}:iam::{{account}}:role/application_abc/component_xyz/S3Access',
|
|
76
|
-
'arn:{{partition}}:iam::{{account}}:role/service-role/QuickSightAction'
|
|
77
|
-
],
|
|
78
|
-
readWriteRoles: [
|
|
79
|
-
'arn:{{partition}}:iam::{{account}}:role/application_abc/component_xyz/S3Access'
|
|
80
|
-
],
|
|
81
|
-
roleAroaResolver: roleResolver
|
|
82
|
-
})
|
|
83
|
-
|
|
84
|
-
bucket.addToResourcePolicy(RestrictPrefix.readStatement())
|
|
85
|
-
bucket.addToResourcePolicy(RestrictPrefix.readWriteStatement())
|
|
86
|
-
})
|
|
87
|
-
```
|
|
88
|
-
|
|
89
|
-
## Class RestrictBucketToRoles
|
|
90
|
-
|
|
91
|
-
Helper class to construct a policy that will restrict a bucket to a set of roles. This is realized through a Deny where source role is not on the list, and an Allow where source role is.
|
|
92
|
-
|
|
93
|
-
Depending on the values provided, it will produce two PolicyStatement types accessible by methods.
|
|
94
|
-
|
|
95
|
-
One for general bucket access that resolves to:
|
|
96
|
-
|
|
97
|
-
```yaml
|
|
98
|
-
- Action:
|
|
99
|
-
- s3:List*
|
|
100
|
-
- s3:GetBucket*
|
|
101
|
-
Condition:
|
|
102
|
-
StringLike:
|
|
103
|
-
aws:userId:
|
|
104
|
-
- AROA12345678:*
|
|
105
|
-
Effect: Allow
|
|
106
|
-
Principal: "*"
|
|
107
|
-
Resource:
|
|
108
|
-
- Fn::Join:
|
|
109
|
-
- ""
|
|
110
|
-
- - Fn::GetAtt:
|
|
111
|
-
- BuckettransformedCbdgadDatalakeTransformedPrototype20210115E093F710
|
|
112
|
-
- Arn
|
|
113
|
-
- /*
|
|
114
|
-
- Fn::GetAtt:
|
|
115
|
-
- BuckettransformedCbdgadDatalakeTransformedPrototype20210115E093F710
|
|
116
|
-
- Arn
|
|
117
|
-
Sid: BucketAllow
|
|
118
|
-
```
|
|
119
|
-
|
|
120
|
-
One that denies access to the bucket that resolves to:
|
|
121
|
-
|
|
122
|
-
NOTE: To permit things like inventory we exclude the s3 service from the Deny statements. Also since we're using a NotPrincipal statement, we also include the root account to assure access to the bucket isn't lost if the Roles are deleted.
|
|
123
|
-
|
|
124
|
-
```yaml
|
|
125
|
-
- Action:
|
|
126
|
-
- s3:PutObject*
|
|
127
|
-
- s3:GetObject*
|
|
128
|
-
- s3:List*
|
|
129
|
-
- s3:GetBucket*
|
|
130
|
-
Condition:
|
|
131
|
-
StringNotLike:
|
|
132
|
-
aws:userId:
|
|
133
|
-
- AROA12345678:*
|
|
134
|
-
Effect: Deny
|
|
135
|
-
NotPrincipal:
|
|
136
|
-
Service: s3.amazonaws.com
|
|
137
|
-
AWS:
|
|
138
|
-
Fn::Join:
|
|
139
|
-
- ""
|
|
140
|
-
- - "arn:"
|
|
141
|
-
- Ref: AWS::Partition
|
|
142
|
-
- ":iam::"
|
|
143
|
-
- Ref: AWS::AccountId
|
|
144
|
-
- :root
|
|
145
|
-
Resource:
|
|
146
|
-
- Fn::Join:
|
|
147
|
-
- ""
|
|
148
|
-
- - Fn::GetAtt:
|
|
149
|
-
- BuckettransformedCbdgadDatalakeTransformedPrototype20210115E093F710
|
|
150
|
-
- Arn
|
|
151
|
-
- /*
|
|
152
|
-
- Fn::GetAtt:
|
|
153
|
-
- BuckettransformedCbdgadDatalakeTransformedPrototype20210115E093F710
|
|
154
|
-
- Arn
|
|
155
|
-
Sid: BucketDeny
|
|
156
|
-
```
|
|
157
|
-
|
|
158
|
-
## RestrictBucketToRoles example
|
|
159
|
-
|
|
160
|
-
```typescript
|
|
161
|
-
import {MdaaRoleResolver} from '@aws-mdaa/am-role-helper'
|
|
162
|
-
import {RestrictBucketToRoles} from '@aws-mdaa/3-bucketpolicy-helper'
|
|
163
|
-
|
|
164
|
-
const roleResolver = new MdaaRoleResolver({
|
|
165
|
-
roleArns: [
|
|
166
|
-
'arn:{{partition}}:iam::{{account}}:role/application_abc/component_xyz/S3Access',
|
|
167
|
-
'arn:{{partition}}:iam::{{account}}:role/service-role/QuickSightAction'
|
|
168
|
-
]
|
|
169
|
-
})
|
|
170
|
-
|
|
171
|
-
roleResolver.init().then(() => {
|
|
172
|
-
const RestrictBucket = new RestrictBucketToRoles({
|
|
173
|
-
// bucket in this context is a constructed s3.Bucket class
|
|
174
|
-
s3Bucket: bucket,
|
|
175
|
-
roles: [
|
|
176
|
-
'arn:{{partition}}:iam::{{account}}:role/application_abc/component_xyz/S3Access',
|
|
177
|
-
'arn:{{partition}}:iam::{{account}}:role/service-role/QuickSightAction'
|
|
178
|
-
],
|
|
179
|
-
roleAroaResolver: roleResolver
|
|
180
|
-
})
|
|
181
|
-
|
|
182
|
-
bucket.addToResourcePolicy(RestrictBucket.allowStatement())
|
|
183
|
-
bucket.addToResourcePolicy(RestrictBucket.denyStatement())
|
|
184
|
-
})
|
|
185
|
-
```
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
-
*/
|
|
5
|
-
import { IPrincipal, PolicyStatement } from 'aws-cdk-lib/aws-iam';
|
|
6
|
-
import { IBucket } from 'aws-cdk-lib/aws-s3';
|
|
7
|
-
export interface IRestrictObjectPrefixToRoles {
|
|
8
|
-
readonly s3Bucket: IBucket;
|
|
9
|
-
readonly s3Prefix: string;
|
|
10
|
-
readonly readRoleIds?: string[];
|
|
11
|
-
readonly readWriteRoleIds?: string[];
|
|
12
|
-
readonly readWriteSuperRoleIds?: string[];
|
|
13
|
-
readonly readPrincipals?: IPrincipal[];
|
|
14
|
-
readonly readWritePrincipals?: IPrincipal[];
|
|
15
|
-
readonly readWriteSuperPrincipals?: IPrincipal[];
|
|
16
|
-
}
|
|
17
|
-
export interface IRestrictBucketToRoles {
|
|
18
|
-
readonly s3Bucket: IBucket;
|
|
19
|
-
readonly roleExcludeIds: string[];
|
|
20
|
-
readonly principalExcludes?: string[];
|
|
21
|
-
readonly prefixExcludes?: string[];
|
|
22
|
-
readonly prefixIncludes?: string[];
|
|
23
|
-
}
|
|
24
|
-
/** Helper class for generating S3 bucket policy statements which grant access to specific object prefixes */
|
|
25
|
-
export declare class RestrictObjectPrefixToRoles {
|
|
26
|
-
static readonly READ_ACTIONS: string[];
|
|
27
|
-
static readonly READ_WRITE_ACTIONS: string[];
|
|
28
|
-
static readonly READ_WRITE_SUPER_ACTIONS: string[];
|
|
29
|
-
static readonly BUCKET_ALLOW_ACTIONS: string[];
|
|
30
|
-
static readonly BUCKET_DENY_ACTIONS: string[];
|
|
31
|
-
private _readStatements;
|
|
32
|
-
private _readWriteStatements;
|
|
33
|
-
private _readWriteSuperStatements;
|
|
34
|
-
private _formattedPrefix;
|
|
35
|
-
constructor(props: IRestrictObjectPrefixToRoles);
|
|
36
|
-
private _readStatementScaffold;
|
|
37
|
-
private _readWriteStatementScaffold;
|
|
38
|
-
private _readWriteSuperStatementScaffold;
|
|
39
|
-
readStatements(): PolicyStatement[];
|
|
40
|
-
readWriteStatements(): PolicyStatement[];
|
|
41
|
-
readWriteSuperStatements(): PolicyStatement[];
|
|
42
|
-
statements(): PolicyStatement[];
|
|
43
|
-
formatS3Prefix(prefix: string): string;
|
|
44
|
-
}
|
|
45
|
-
/** Helper class for generating bucket policy statements
|
|
46
|
-
* which allow or deny access to an entire bucket. Used to
|
|
47
|
-
* create bucket-level default deny statements to block accesses
|
|
48
|
-
* not granted in the bucket policy. */
|
|
49
|
-
export declare class RestrictBucketToRoles {
|
|
50
|
-
readonly denyStatement: PolicyStatement;
|
|
51
|
-
readonly allowStatement: PolicyStatement;
|
|
52
|
-
private resource;
|
|
53
|
-
private notResource;
|
|
54
|
-
private denyConditionalNotEquals;
|
|
55
|
-
constructor(props: IRestrictBucketToRoles);
|
|
56
|
-
private formatS3Prefix;
|
|
57
|
-
}
|