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

CSP's nonce support for ReCaptchaBuilderV3 #95

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

moijafcor
Copy link

@moijafcor moijafcor commented Feb 12, 2024

Refactoring htmlScriptTagJsApi() method to provide basic support for CSP's nonce tag.

Leveraging the $configuration optional parameter to inject a nonce attribute in the inline Javascript tag.

The way to use this, on your Blade's (assuming you are using https://github.com/spatie/laravel-csp or something else that generates the nonce):

{{-- "csp_nonce()" in this case is provided by https://github.com/spatie/laravel-csp --}}
{!! \ReCaptcha::htmlScriptTagJsApi(['nonce' => csp_nonce()]) !!}

Refactoring htmlScriptTagJsApi() method to provide basic support for 'nonce' tag.

Leveraging the $configuration optional parameter to inject a 'nonce' attribute in the inline javascript tag.
@moijafcor moijafcor mentioned this pull request Feb 12, 2024
@moijafcor moijafcor changed the title nonce support for ReCaptchaBuilderV3 CSP's nonce support for ReCaptchaBuilderV3 Feb 12, 2024
Adding a check on the nonce array key.
@moijafcor
Copy link
Author

Fixing missing checking for array key null value.

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

Successfully merging this pull request may close these issues.

None yet

1 participant