File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,14 @@ const { getArnPartition } = require('../../utils/arn');
8
8
9
9
const logger = require ( '../../utils/logger' ) ;
10
10
11
+ /**
12
+ * Check if a value is a JSONata value template
13
+ * e.g {% $.some.path %}
14
+ */
15
+ function isJsonataValueTemplate ( value ) {
16
+ return typeof value === 'string' && value . trim ( ) . startsWith ( '{%' ) && value . trim ( ) . endsWith ( '}' ) ;
17
+ }
18
+
11
19
function getTaskStates ( states , stateMachineName ) {
12
20
return _ . flatMap ( states , ( state ) => {
13
21
switch ( state . Type ) {
@@ -657,7 +665,13 @@ function resolveS3BucketReferences(bucket, resources) {
657
665
function getS3ObjectPermissions ( action , state ) {
658
666
// Use the helper so both Arguments (JSONata) and Parameters (JSONPath) are supported
659
667
const bucket = getParameterOrArgument ( state , 'Bucket' ) || '*' ;
660
- const key = getParameterOrArgument ( state , 'Key' ) || '*' ;
668
+ let key = getParameterOrArgument ( state , 'Key' ) || '*' ;
669
+ if ( isJsonataValueTemplate ( key ) ) {
670
+ console . warn (
671
+ "Warning: When using JSONata, S3 object permissions will be given for all objects in the bucket"
672
+ ) ;
673
+ key = "*" ;
674
+ }
661
675
const prefix = getParameterOrArgument ( state , 'Prefix' ) ;
662
676
let arn ;
663
677
You can’t perform that action at this time.
0 commit comments