Skip to content

Commit cfdc032

Browse files
committedFeb 18, 2021
feat: add CSP and recommended security headers to site
- update cache ages for different types of assets - assets 6 months, CDN 1 year - js/css that is hashed per build, 1 year - webmanifest/ico 7 days, CDN 14 days - CLI auto-inlined SVG in root dir 1 year Relates to angular/angular#37631
1 parent 08f16e5 commit cfdc032

File tree

2 files changed

+74
-8
lines changed

2 files changed

+74
-8
lines changed
 

‎material.angular.io/firebase.json

+73-7
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,79 @@
88
"destination": "/index.html"
99
}
1010
],
11-
"headers": [{
12-
"source" : "/assets/versions.json",
13-
"headers" : [{
14-
"key" : "Access-Control-Allow-Origin",
15-
"value" : "*"
16-
}]
17-
}],
11+
"headers": [
12+
{
13+
"source": "/assets/versions.json",
14+
"headers": [
15+
{
16+
"key": "Access-Control-Allow-Origin",
17+
"value": "*"
18+
}
19+
]
20+
},
21+
{
22+
"source": "/**(*.@(css|js|json|html|svg))",
23+
"headers": [
24+
{
25+
"key": "X-Content-Type-Options",
26+
"value": "nosniff"
27+
}
28+
]
29+
},
30+
{
31+
"source": "/**",
32+
"headers": [
33+
{
34+
"key": "X-XSS-Protection",
35+
"value": "1"
36+
},
37+
{
38+
"key": "X-Frame-Options",
39+
"value": "DENY"
40+
},
41+
{
42+
"key": "Content-Security-Policy",
43+
"value": "upgrade-insecure-requests; default-src 'self'; font-src 'self' https://fonts.gstatic.com; style-src 'self' 'unsafe-inline' https://fonts.googleapis.com; img-src *; frame-src https://www.youtube.com; media-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval' https://www.google-analytics.com; child-src 'self' blob:; connect-src 'self' https://www.google-analytics.com https://stats.g.doubleclick.net https://api.github.com;"
44+
}
45+
]
46+
},
47+
{
48+
"source": "/assets/**",
49+
"headers": [
50+
{
51+
"key": "Cache-Control",
52+
"value": "public, max-age=15811200, s-maxage=31536000"
53+
}
54+
]
55+
},
56+
{
57+
"source": "/*.svg",
58+
"headers": [
59+
{
60+
"key": "Cache-Control",
61+
"value": "public, max-age=31536000"
62+
}
63+
]
64+
},
65+
{
66+
"source": "/*.@(webmanifest|ico)",
67+
"headers": [
68+
{
69+
"key": "Cache-Control",
70+
"value": "public, max-age=604800, s-maxage=1209600"
71+
}
72+
]
73+
},
74+
{
75+
"source": "/*.@(js|css)",
76+
"headers": [
77+
{
78+
"key": "Cache-Control",
79+
"value": "public, max-age=31536000"
80+
}
81+
]
82+
}
83+
],
1884
"ignore": [
1985
"firebase.json",
2086
"**/node_modules/**",

‎material.angular.io/tools/audit-docs.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ const MIN_SCORES_PER_PAGE = [
3232
url: '',
3333
minScores: {
3434
'pwa': 70,
35-
'performance': 20,
35+
'performance': 30,
3636
'seo': 98,
3737
'best-practices': 100,
3838
'accessibility': 100

0 commit comments

Comments
 (0)
Please sign in to comment.