8000 Use nonce attribute for inline script if provided (#3129) · JavaScriptExpert/next.js@f1f8350 · GitHub
[go: up one dir, main page]

Skip to content

Commit f1f8350

Browse files
dstaleytimneutkens
authored andcommitted
Use nonc 8000 e attribute for inline script if provided (vercel#3129)
1 parent 9b53d00 commit f1f8350

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

server/document.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,10 @@ export class Main extends Component {
117117
}
118118

119119
export class NextScript extends Component {
120+
static propTypes = {
121+
nonce: PropTypes.string
122+
}
123+
120124
static contextTypes = {
121125
_documentProps: PropTypes.any
122126
}
@@ -176,7 +180,7 @@ export class NextScript extends Component {
176180
__NEXT_DATA__.chunks = chunks
177181

178182
return <div>
179-
{staticMarkup ? null : <script dangerouslySetInnerHTML={{
183+
{staticMarkup ? null : <script nonce={this.props.nonce} dangerouslySetInnerHTML={{
180184
__html: `
181185
__NEXT_DATA__ = ${htmlescape(__NEXT_DATA__)}
182186
module={}

0 commit comments

Comments
 (0)
0