You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(@angular/build): Auto-CSP support as a part of angular.json schema
Following up on the logic provided in #28639, we want to offer an opt-in
option in angular.json to enable the auto-CSP transformation.
For now, builds for `ng serve` will have Auto-CSP disabled.
Copy file name to clipboardexpand all lines: packages/angular/build/src/builders/application/schema.json
+27
Original file line number
Diff line number
Diff line change
@@ -37,6 +37,33 @@
37
37
"type": "string",
38
38
"description": "Customize the base path for the URLs of resources in 'index.html' and component stylesheets. This option is only necessary for specific deployment scenarios, such as with Angular Elements or when utilizing different CDN locations."
39
39
},
40
+
"security": {
41
+
"description": "Security features to protect against XSS and other common attacks",
42
+
"type": "object",
43
+
"additionalProperties": false,
44
+
"properties": {
45
+
"autoCsp": {
46
+
"description": "Enables automatic generation of a hash-based Strict Content Security Policy (https://web.dev/articles/strict-csp#choose-hash) based on scripts in index.html. Will default to true once we are out of experimental/preview phases.",
47
+
"default": false,
48
+
"oneOf": [
49
+
{
50
+
"type": "object",
51
+
"properties": {
52
+
"unsafeEval": {
53
+
"type": "boolean",
54
+
"description": "Include the `unsafe-eval` directive (https://web.dev/articles/strict-csp#remove-eval) in the auto-CSP. Please only enable this if you are absolutely sure that you need to, as allowing calls to eval will weaken the XSS defenses provided by the auto-CSP.",
55
+
"default": false
56
+
}
57
+
},
58
+
"additionalProperties": false
59
+
},
60
+
{
61
+
"type": "boolean"
62
+
}
63
+
]
64
+
}
65
+
}
66
+
},
40
67
"scripts": {
41
68
"description": "Global scripts to be included in the build.",
0 commit comments