CSP Manager
# social
s
The configuration in the backoffice is very nice! But I can't get the tag helper to work
m
Yep! Its not released yet 😄
that the more coming soon, I just need to do some more testing but wanted to get Aarons PR from October out. If you need it I can release it as a pre-release though
s
That is why! 😅 I was looking in the repo and compared what I had configured - Didn't think of checking the package version
How would I add the nonce without the tag helper?
Or... Couldn't I just copy your tag helper into my project? I guess the CSP service would be available?
m
So if you had a way of generating a random nonce value there is events you can hook into to alter the CSP
Which I really need to document 😄
CspWritingNotification lets you alter the header before it goes "out" the challenge with nonce is it should be unquie per request. I have tested the nonce stuff manually but want some automatation which is why its not out yet
To save you the pain of adding nonce without Ill tag up a beta release now 🙂 (its all automated ;))
Should appear on NuGet shortly 🙂 (first time I have ever got the release pipeline first time 😄 )
s
I see it! 😄 Will try it out
The tag helper getting registered, but it only add an empty nonce
m
thats Chome been "helpful"
if you view page source it will be there
'strict-dynamic' as a script source is super powerful btw - https://content-security-policy.com/strict-dynamic/ It pretty much solves GTM 😉
s
Aaah okay 😄 Still getting an error though
Refused to execute inline script because it violates the following Content Security Policy directive: "script-src-elem localhost". Either the 'unsafe-inline' keyword, a hash ('sha256-Esn7Zb7FBRDn3I4afnisr4bjWWPnNHfSUd7R1Tuxh5E='), or a nonce ('nonce-...') is required to enable inline execution.
m
so any Blah needs a hash or nonce
So that error all depends on the script 🙂
if its something generated from GTM you probably need to update the GTM include script to support nonce, which they do provide 🙂
s
It was just me testing some inline stuff in a script tag
But thanks for clarifying!
If i understand in correctly, I would need the hash added to the CSP header. I am not really sure how I would do that when using CSP Manager
m
Its the same as a url
same way 'unsafe-inline' so hash and check script-src
As a hash shouldnt change same as a url
s
Ah! Got it now!
Thanks