Skip to content

fix: csp nonce injection when no closing tag (#16281)#16282

Merged
patak-cat merged 3 commits intovitejs:mainfrom
gregtwallace:csp-link-fix
Mar 31, 2024
Merged

fix: csp nonce injection when no closing tag (#16281)#16282
patak-cat merged 3 commits intovitejs:mainfrom
gregtwallace:csp-link-fix

Conversation

@gregtwallace
Copy link
Copy Markdown
Contributor

@gregtwallace gregtwallace commented Mar 26, 2024

Not all html elements have an ending tag, for example:

<link rel="stylesheet" href="/roboto.css" />

In such cases, the current injection func injects the nonce after the forward slash, instead of before it current result:

<link rel="stylesheet" href="/roboto.css" / nonce="abc123">

this patch corrects the behavior to:

<link rel="stylesheet" href="/roboto.css"  nonce="abc123"/>

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

p3-minor-bug An edge case that only affects very specific usage (priority)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CSP Injects Incorrectly on Elements Without Closing Tag

3 participants