3 Commits

Author SHA1 Message Date
Aaron Shim
210bf4e2b4 fix(@angular/build): Fixing auto-csp edge cases where
- <script> is the last tag before </head> close
- .appendChild is called before </head> (because document.body is undefined then)
- <script> tags with a src attribute and no specified type attribute should not write <script type="undefined" ...>
2024-12-10 18:23:41 -08:00
Aaron Shim
efb434136d 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.
2024-10-22 15:47:23 -07:00
Aaron Shim
6beffd138e refactor(@angular/build): Auto-CSP support as an index file transformation.
Auto-CSP is a feature to rewrite the `<script>` tags in a index.html
file to either hash their contents or rewrite them as a dynamic loader
script that can be hashed. These hashes will be placed in a CSP inside a
`<meta>` tag inside the `<head>` of the document to ensure that the
scripts running on the page are those known during the compile-time of
the client-side rendered application.
2024-10-22 09:57:16 -07:00