From fd8ab9ecadaff5521441b7c82c0e11ded3f0412f Mon Sep 17 00:00:00 2001 From: Alan Agius Date: Fri, 26 Jul 2024 08:01:04 +0000 Subject: [PATCH] fix(@angular/build): add CSP `nonce` attribute to script tags when inline critical CSS is disabled Prior to this change when inline critical CSS is disabled CSP `nonce` was not added to script tags. Closes #28102 --- .../angular/build/src/utils/index-file/index-html-generator.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/angular/build/src/utils/index-file/index-html-generator.ts b/packages/angular/build/src/utils/index-file/index-html-generator.ts index b0303e4ae41c..bf40e2e7acac 100644 --- a/packages/angular/build/src/utils/index-file/index-html-generator.ts +++ b/packages/angular/build/src/utils/index-file/index-html-generator.ts @@ -78,6 +78,8 @@ export class IndexHtmlGenerator { this.csrPlugins.push(inlineCriticalCssPlugin(this)); } + this.csrPlugins.push(addNoncePlugin()); + // SSR plugins if (options.generateDedicatedSSRContent) { this.ssrPlugins.push(addEventDispatchContractPlugin(), addNoncePlugin());