laravel-recaptchav3 icon indicating copy to clipboard operation
laravel-recaptchav3 copied to clipboard

Content Security Policy Nonce

Open eliasjtg opened this issue 3 years ago • 0 comments

My server has Content Security Policy enabled, i want to initialize js code with a nonce to allow recaptcha script execution.

Google docs recommend use nonce: FAQ

Can be added a function called initJsNonce() or related?

    /**
     * @param string $nonce
     * @return string
     */
    public function initJsNonce(string $nonce): string
    {
        return '<script src="' . $this->origin . '/api.js?render=' . $this->sitekey . '" nonce="'.$nonce.'"></script>';
    }

As workaround how can add/override RecaptchaV3 class to add this?

I'm not familiarized with Laravel Container to do that, if anyone can help me I would appreciate.

eliasjtg avatar Feb 20 '21 02:02 eliasjtg