Skip to content

fix: drop a csp meta the pipeline would have moved to a header - #273

Closed
benpeter wants to merge 3 commits into
mainfrom
headcsp
Closed

fix: drop a csp meta the pipeline would have moved to a header#273
benpeter wants to merge 3 commits into
mainfrom
headcsp

Conversation

@benpeter

Copy link
Copy Markdown
Contributor

head.html now comes from the config service, which serves it as the code bus holds it, so a <meta http-equiv="Content-Security-Policy" ... move-to-http-header="true"> that the pipeline used to consume reached the composed page and blocked the un-nonced Universal Editor scripts.

Relates to #270

Comment thread src/render/compose.js
Comment on lines +39 to +43
aemHeadHtmlTree.children = aemHeadHtmlTree.children.filter(
(node) => !(node.type === 'element'
&& node.tagName === 'meta'
&& node.properties?.['move-to-http-header'] !== undefined),
);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should the check look for nonce-aem ?

const cspHead = '<meta http-equiv="Content-Security-Policy"'
+ ' content="script-src \'nonce-aem\' \'strict-dynamic\';"'
+ ' move-to-http-header="true" />'
+ '<script nonce="aem" src="/scripts/aem.js" type="module"></script>';

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't the nonce="aem" also be removed?

drops the nonce="aem" the pipeline would have rewritten, and narrows the meta drop
to metas whose csp references that same placeholder. covers tobi's #273 review.
@benpeter benpeter closed this Aug 18, 2026
@benpeter
benpeter deleted the headcsp branch August 18, 2026 21:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants