Skip to content

Commit 92bd028

Browse files
author
Will Toozs
committed
ARSN-387: check for forwarded proto header
1 parent 477a574 commit 92bd028

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

lib/policyEvaluator/utils/conditions.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ export function findConditionKey(
6161
case 'aws:referer': return headers.referer;
6262
// aws:SecureTransport – Used to check whether the request was sent
6363
// using SSL (see Boolean Condition Operators).
64-
case 'aws:SecureTransport': return requestContext.getSslEnabled() ? 'true' : 'false';
64+
case 'aws:SecureTransport': return headers?.['x-forwarded-proto'] === 'https' ? 'true' : 'false';
6565
// aws:SourceArn – Used check the source of the request,
6666
// using the ARN of the source. N/A here.
6767
case 'aws:SourceArn': return undefined;

lib/policyEvaluator/utils/variables.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ function findVariable(variable: string, requestContext: RequestContext): string
3838
// aws:SecureTransport is boolean value that represents whether the
3939
// request was sent using SSL
4040
map.set('aws:SecureTransport',
41-
requestContext.getSslEnabled() ? 'true' : 'false');
41+
headers?.['x-forwarded-proto'] === 'https' ? 'true' : 'false');
4242
// aws:SourceIp is requester's IP address, for use with IP address
4343
// conditions
4444
map.set('aws:SourceIp', requestContext.getRequesterIp());

0 commit comments

Comments
 (0)