diff --git a/ui/admin/app/components/form/field/json-secret/index.hbs b/ui/admin/app/components/form/field/json-secret/index.hbs index 3acfb862ef..b4ac752638 100644 --- a/ui/admin/app/components/form/field/json-secret/index.hbs +++ b/ui/admin/app/components/form/field/json-secret/index.hbs @@ -27,6 +27,7 @@ @isLintingEnabled={{true}} @language='json' @onInput={{@onInput}} + @cspNonce={{(csp-nonce)}} data-test-code-editor /> {{/if}} diff --git a/ui/admin/app/components/form/role/edit-grants/index.hbs b/ui/admin/app/components/form/role/edit-grants/index.hbs index 4e8273374a..0ccea87b97 100644 --- a/ui/admin/app/components/form/role/edit-grants/index.hbs +++ b/ui/admin/app/components/form/role/edit-grants/index.hbs @@ -23,6 +23,7 @@ @value={{this.grantStringsText}} @onInput={{this.onInput}} @customExtensions={{this.customExtensions}} + @cspNonce={{(csp-nonce)}} data-test-code-editor as |CE| > diff --git a/ui/admin/app/components/worker-filter-generator/index.hbs b/ui/admin/app/components/worker-filter-generator/index.hbs index 232432cdad..98fb98ab3a 100644 --- a/ui/admin/app/components/worker-filter-generator/index.hbs +++ b/ui/admin/app/components/worker-filter-generator/index.hbs @@ -11,6 +11,7 @@ @language='shell' @value={{or (get @model @name) ''}} @onInput={{fn this.setWorkerFilter @model @name}} + @cspNonce={{(csp-nonce)}} data-test-code-editor /> diff --git a/ui/admin/app/helpers/csp-nonce.js b/ui/admin/app/helpers/csp-nonce.js new file mode 100644 index 0000000000..742b7e4cc7 --- /dev/null +++ b/ui/admin/app/helpers/csp-nonce.js @@ -0,0 +1,20 @@ +/** + * Copyright IBM Corp. 2021, 2026 + * SPDX-License-Identifier: BUSL-1.1 + */ + +import Helper from '@ember/component/helper'; + +/** + * Returns the CSP style-src nonce from the document's head metadata. + */ +export default class CspNonceHelper extends Helper { + compute() { + return ( + document + ?.querySelector('meta[name="csp-nonce"]') + ?.getAttribute('content') + ?.trim() ?? '' + ); + } +} diff --git a/ui/admin/app/index.html b/ui/admin/app/index.html index c33b29bbee..dc48df89a6 100644 --- a/ui/admin/app/index.html +++ b/ui/admin/app/index.html @@ -6,6 +6,7 @@ + Admin