feat: 🎸 Add CSP nonce to code editors (#3230)
Co-authored-by: Zhihe Li <zhihe.li@hashicorp.com>
This commit is contained in:
1 parent
4c15d72321
commit
dc224268f5
5 files changed
+24
No files matched your search
@@ -27,6 +27,7 @@
|
||||
@isLintingEnabled={{true}}
|
||||
@language='json'
|
||||
@onInput={{@onInput}}
|
||||
@cspNonce={{(csp-nonce)}}
|
||||
data-test-code-editor
|
||||
/>
|
||||
{{/if}}
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
@value={{this.grantStringsText}}
|
||||
@onInput={{this.onInput}}
|
||||
@customExtensions={{this.customExtensions}}
|
||||
@cspNonce={{(csp-nonce)}}
|
||||
data-test-code-editor
|
||||
as |CE|
|
||||
>
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
@language='shell'
|
||||
@value={{or (get @model @name) ''}}
|
||||
@onInput={{fn this.setWorkerFilter @model @name}}
|
||||
@cspNonce={{(csp-nonce)}}
|
||||
data-test-code-editor
|
||||
/>
|
||||
</F.Control>
|
||||
|
||||
@@ -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() ?? ''
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,7 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta name="csp-nonce" content="__BOUNDARY_CSP_NONCE__">
|
||||
<meta charset="utf-8">
|
||||
<title>Admin</title>
|
||||
<meta name="description" content="Simple and secure remote access with HashiCorp Boundary.">
|
||||
|
||||
Reference in new issue
Block a user