Skip to content

Commit 2ed481c

Browse files
authored
fix (MediaStore policy fix to deny anonymous user-agents access aws-cloudfront-mediastore) (#253)
* Fix for issue #252 mediastore policy bug found in the aws-cloudfront-mediastore module * Fix for issue #252 mediastore policy bug updated the integ.default.expected.json file for new policy output. Tested deploying and see that requests to MediaStore are not allowed directly, only requests to CloudFront now make it to MediaStore. How it should be working I presume. * Update index.ts Fix indent spaces. * Updated integ tests
1 parent f0a05aa commit 2ed481c

File tree

4 files changed

+9
-7
lines changed

4 files changed

+9
-7
lines changed

Diff for: source/patterns/@aws-solutions-constructs/aws-cloudfront-mediastore/lib/index.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,10 @@ export class CloudFrontToMediaStore extends Construct {
9595
],
9696
Resource: `arn:${Aws.PARTITION}:mediastore:${Aws.REGION}:${Aws.ACCOUNT_ID}:container/${Aws.STACK_NAME}/*`,
9797
Condition: {
98+
StringEquals: {
99+
'aws:UserAgent': this.cloudFrontOriginAccessIdentity.originAccessIdentityName
100+
},
98101
Bool: {
99-
'aws:UserAgent': this.cloudFrontOriginAccessIdentity.originAccessIdentityName,
100102
'aws:SecureTransport': 'true'
101103
}
102104
}

Diff for: source/patterns/@aws-solutions-constructs/aws-cloudfront-mediastore/test/__snapshots__/cloudfront-mediastore.test.js.snap

+2-2
Original file line numberDiff line numberDiff line change
@@ -285,11 +285,11 @@ Object {
285285
Object {
286286
"Ref": "AWS::StackName",
287287
},
288-
"/*\\",\\"Condition\\":{\\"Bool\\":{\\"aws:UserAgent\\":\\"",
288+
"/*\\",\\"Condition\\":{\\"StringEquals\\":{\\"aws:UserAgent\\":\\"",
289289
Object {
290290
"Ref": "testcloudfrontmediastoreCloudFrontOriginAccessIdentity966405A0",
291291
},
292-
"\\",\\"aws:SecureTransport\\":\\"true\\"}}}]}",
292+
"\\"},\\"Bool\\":{\\"aws:SecureTransport\\":\\"true\\"}}}]}",
293293
],
294294
],
295295
},

Diff for: source/patterns/@aws-solutions-constructs/aws-cloudfront-mediastore/test/integ.default.expected.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,11 @@
7171
{
7272
"Ref": "AWS::StackName"
7373
},
74-
"/*\",\"Condition\":{\"Bool\":{\"aws:UserAgent\":\"",
74+
"/*\",\"Condition\":{\"StringEquals\":{\"aws:UserAgent\":\"",
7575
{
7676
"Ref": "testcloudfrontmediastoreCloudFrontOriginAccessIdentity966405A0"
7777
},
78-
"\",\"aws:SecureTransport\":\"true\"}}}]}"
78+
"\"},\"Bool\":{\"aws:SecureTransport\":\"true\"}}}]}"
7979
]
8080
]
8181
}

Diff for: source/patterns/@aws-solutions-constructs/aws-cloudfront-mediastore/test/integ.withoutHttpSecurityHeaders.expected.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,11 @@
7171
{
7272
"Ref": "AWS::StackName"
7373
},
74-
"/*\",\"Condition\":{\"Bool\":{\"aws:UserAgent\":\"",
74+
"/*\",\"Condition\":{\"StringEquals\":{\"aws:UserAgent\":\"",
7575
{
7676
"Ref": "testcloudfrontmediastoreCloudFrontOriginAccessIdentity966405A0"
7777
},
78-
"\",\"aws:SecureTransport\":\"true\"}}}]}"
78+
"\"},\"Bool\":{\"aws:SecureTransport\":\"true\"}}}]}"
7979
]
8080
]
8181
}

0 commit comments

Comments
 (0)