Skip to content

Use Content-Security-Policy nonce support on Default login and passkey registration pages #19844

Closed

Description

@jzheaux

The default login page (DefaultLoginPageGeneratingFilter) and the default passkey registration page (DefaultWebAuthnRegistrationPageGeneratingFilter) both bootstrap Spring Security's passkey JavaScript with an inline <script> that has no nonce attribute. The registration page also uses an inline onclick="return false" handler.

Under a strict Content Security Policy that only allows inline scripts by nonce (for example script-src 'self' 'nonce-{nonce}', which gh-10826 / #18499 adds support for), the browser blocks those inline scripts, so passkey sign-in and registration don't work on the default pages. External scripts such as /login/webauthn.js are fine under 'self'.

When a ContentSecurityPolicyNonce is available as a request attribute (ContentSecurityPolicyNonce.class.getName()), these pages could render its value as the nonce attribute on their inline scripts, and the onclick handler could be replaced with script. FormPostRedirectStrategy already does something similar for its own template.

As a workaround, applications can supply their own login and registration pages that use the nonce.

Activity

  1. changed the title [-]Default login and passkey registration pages are blocked by a nonce-based Content Security Policy[/-] [+]Use Content-Security-Policy nonce support on Default login and passkey registration pages[/+] on Oct 7, 2026
  2. added 3 commits that reference this issue on Oct 10, 2026
    4df4cca
    8d2a59d
    7e09a72
  3. added a commit that references this issue on Oct 14, 2026
    49f595a
  4. added 4 commits that reference this issue on Oct 15, 2026
    d233a82
    9a87ef3
    38b7418
    4243a62
  5. added 2 commits that reference this issue on Nov 9, 2026
    00bab12
    f31a9ce
  6. self-assigned this
    on Nov 10, 2026
  7. added a commit that references this issue on Nov 10, 2026
    dac77d3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

in: webAn issue in web modules (web, webmvc)in: webauthnWebAuthn and Passkeysstatus: duplicateA duplicate of another issuetype: enhancementA general enhancement

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions