You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The text was updated successfully, but these errors were encountered:
magicyoda
changed the title
Tollbar does not load with strict Content Security Policy Headers (CSP)
Toolbar does not load with strict Content Security Policy Headers (CSP)
Nov 1, 2024
magicyoda
changed the title
Toolbar does not load with strict Content Security Policy Headers (CSP)
Laravel - Toolbar does not load with strict Content Security Policy Headers (CSP)
Nov 1, 2024
Thank you very much @barryvdh , I could remove the issue for telescope-toolbar using following code in my LaravelViteNonceGenerator.php
class LaravelViteNonceGenerator implements NonceGenerator
{
public function generate(): string
{
$nonce = Vite::useCspNonce();
view()->share('csp_script_nonce', $nonce);
return $nonce;
}
}
However, now, I discovered that telescope itself is not working properly with strict CSP:
It's always the same with CSP.. one step after the other until I get finally blocked ;-)
Locally I had to disable strict CSP but I wanted to use Telescope on my hosted "Dev" env. which has strict CSP (PROD near).
I'm using Laravel CSP package to define strict CSP header.
In order to work, each <script> tag requires a nonce value.
Telescope toolbar does not support it and does not load correctly:
All these elements should get the nonce value in order to comply with strict CSP header:
I see in the code, that it seems to be supported when variable $csp_script_nonce is present. But how to define it and get it from spatie CSP package ?
https://github.com/fruitcake/laravel-telescope-toolbar/blob/master/resources/views/head.blade.php
The text was updated successfully, but these errors were encountered: