Skip to content

Commit 023b2aa

Browse files
authored
Merge pull request #6 from vasylenko/patch-1
Security headers updated recommended by Mozilla Observatory
2 parents d4380a7 + dc71183 commit 023b2aa

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

add-security-headers/index.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,12 @@ function handler(event) {
55
// Set HTTP security headers
66
// Since JavaScript doesn't allow for hyphens in variable names, we use the dict["key"] notation
77
headers['strict-transport-security'] = { value: 'max-age=63072000; includeSubdomains; preload'};
8-
headers['content-security-policy'] = { value: "default-src 'none'; img-src 'self'; script-src 'self'; style-src 'self'; object-src 'none'"};
8+
headers['content-security-policy'] = { value: "default-src 'none'; img-src 'self'; script-src 'self'; style-src 'self'; object-src 'none'; frame-ancestors 'none'"};
99
headers['x-content-type-options'] = { value: 'nosniff'};
1010
headers['x-frame-options'] = {value: 'DENY'};
11-
headers['x-xss-protection'] = {value: '1; mode=block'};
11+
headers['x-xss-protection'] = {value: '1; mode=block'};
12+
headers['referrer-policy'] = {value: 'same-origin'};
1213

1314
// Return the response to viewers
1415
return response;
15-
}
16+
}

0 commit comments

Comments
 (0)