Skip to content
This repository has been archived by the owner on Jun 10, 2024. It is now read-only.

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 subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant