File tree Expand file tree Collapse file tree 2 files changed +18
-2
lines changed
Expand file tree Collapse file tree 2 files changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -335,7 +335,7 @@ function csp_style_nonce(): string
335335 {
336336 $ csp = service ('csp ' );
337337
338- if (! $ csp ->enabled ()) {
338+ if (! $ csp ->styleNonceEnabled ()) {
339339 return '' ;
340340 }
341341
@@ -351,7 +351,7 @@ function csp_script_nonce(): string
351351 {
352352 $ csp = service ('csp ' );
353353
354- if (! $ csp ->enabled ()) {
354+ if (! $ csp ->scriptNonceEnabled ()) {
355355 return '' ;
356356 }
357357
Original file line number Diff line number Diff line change @@ -406,6 +406,22 @@ public function enabled(): bool
406406 return $ this ->CSPEnabled ;
407407 }
408408
409+ /**
410+ * Whether adding nonce in style-* directives is enabled or not.
411+ */
412+ public function styleNonceEnabled (): bool
413+ {
414+ return $ this ->enabled () && $ this ->enableStyleNonce ;
415+ }
416+
417+ /**
418+ * Whether adding nonce in script-* directives is enabled or not.
419+ */
420+ public function scriptNonceEnabled (): bool
421+ {
422+ return $ this ->enabled () && $ this ->enableScriptNonce ;
423+ }
424+
409425 /**
410426 * Get the nonce for the style tag.
411427 */
You can’t perform that action at this time.
0 commit comments