-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathedge_lambda.yml
47 lines (47 loc) · 2.46 KB
/
edge_lambda.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
Resources:
LambdaEdgePlsv:
Type: AWS::Lambda::Function
Properties:
Handler: index.handler
Role: !GetAtt LambdaIAMRole.Arn
Code:
ZipFile: |
'use strict';
exports.handler = (event, context, callback) => {
const response = event.Records[0].cf.response;
const headers = response.headers;
const api_endpoint = "https://*.execute-api.us-east-1.amazonaws.com";
headers['content-security-policy'] = [{
key: 'Content-Security-Policy',
value: "default-src 'self' ;script-src 'self' 'sha256-/IZpfk4Is7wRRs7rLHoSTDAUlvS/kBF/rbh+bt+aSw4=' https://cdnjs.cloudflare.com https://fonts.googleapis.com ; style-src 'self' https://cdnjs.cloudflare.com https://fonts.googleapis.com 'unsafe-inline' ; font-src 'self' https://fonts.googleapis.com https://fonts.gstatic.com; connect-src 'self' " + api_endpoint + " https://ipv4.icanhazip.com https://api.ipify.org ; base-uri 'self' ; manifest-src 'self'; img-src 'self' data:"
}];
headers['x-content-type-options'] = [{
key: 'X-Content-Type-Options',
value: 'nosniff'
}];
headers['x-frame-options'] = [{
key: 'X-Frame-Options',
value: 'SAMEORIGIN'
}];
headers['feature-policy'] = [{key: 'Feature-Policy',value: "accelerometer 'none'; ambient-light-sensor 'none'; autoplay 'none'; camera 'none'; geolocation 'none'; gyroscope 'none'; magnetometer 'none'; microphone 'none'; midi 'none'; speaker 'none'; usb 'none'"}];
headers['x-permitted-cross-domain-policies'] = [{
key: 'X-Permitted-Cross-Domain-Policies',
value: 'master-only'
}];
headers['x-xss-protection'] = [{
key: 'X-XSS-Protection',
value: '1; mode=block'
}];
headers['referrer-policy'] = [{
key: 'Referrer-Policy',
value: 'SAME-ORIGIN'
}];
headers['strict-transport-security'] = [{
key: 'Strict-Transport-Security',
value: 'max-age=63072000; includeSubdomains; preload'
}];
callback(null, response);
};
Runtime: ${self:provider.runtime}
MemorySize: 256
Timeout: 30