Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to generate "nonce" and add generated code to script and style tags? #25

Closed
JohanMa4 opened this issue Jul 19, 2018 · 5 comments
Closed

Comments

@JohanMa4
Copy link

Hi @bepsvpt, i have another trouble, how can i add a "nonce" key and add it to script an style tags?
I want to fix Content Security Policy on my Laravel App.

@bepsvpt
Copy link
Owner

bepsvpt commented Jul 24, 2018

Hi @JohanMa4,

After setting add-generated-nonce to true in script-src and style-src directives, you can use SecureHeaders::nonce() to get nonce value and add to script or style tags.

@JohanMa4 JohanMa4 closed this as completed Aug 9, 2018
@ChaerilM
Copy link

ChaerilM commented Sep 7, 2018

@bepsvpt could you update doc to add 'SecureHeaders' => Bepsvpt\SecureHeaders\SecureHeaders::class for it to work on blade template

@bepsvpt
Copy link
Owner

bepsvpt commented Sep 8, 2018

Hi @Zabanya,

Can you give an example that using it in blade template?

@ChaerilM
Copy link

ChaerilM commented Sep 8, 2018

add aliases in config/app/php

'SecureHeaders' => Bepsvpt\SecureHeaders\SecureHeaders::class

blade usage

<script nonce="{{ SecureHeaders::nonce() }}"> ...

@bepsvpt
Copy link
Owner

bepsvpt commented Sep 8, 2018

Hi @Zabanya,

I have updated the document, you can find it here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants