Repository navigation
Add CSP nonces to the admin layout - #71
Conversation
The admin layout emitted the CDN Bootstrap script, the CDN stylesheet links and an inline style block without a nonce, so they were blocked under a nonce-based policy from CakePHP's CspMiddleware. Read cspScriptNonce (falling back to cspNonce) for the script and cspStyleNonce for the links and the style block.
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
CakePHP's
CspMiddlewarestores its nonces in thecspScriptNonceandcspStyleNoncerequest attributes. The admin layout read neither, so under a nonce-based policy the CDN Bootstrap script, the CDN stylesheet links and the inline style block were blocked.Changes:
templates/layout/captcha-admin.php: the Bootstrap script getscspScriptNonce(falling back tocspNoncefrom a custom middleware). The stylesheet links and the inline style block getcspStyleNonce. Nonces are only emitted when set.CaptchaControllerTestcovers the core attributes and thecspNoncefallback.Follows dereuromark/CakePHP-DatabaseLog#87.
Summary by CodeRabbit