Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

Default passkey pages fail with NullPointerException when CSRF is disabled

Abierto Apto para principiantes
#19,984 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
78/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
java, spring

Línea de trabajo

Empieza con WebAuthnConfigurer y DefaultWebAuthnRegistrationPageGeneratingFilter, donde el issue identifica las búsquedas de un token CSRF nulo; lee las pruebas correspondientes en WebAuthnConfigurerTests. Reproduce el problema con CSRF desactivado y las passkeys activadas, y luego comprueba que /login y /webauthn/register se renderizan sin una cabecera CSRF ni un campo oculto cuando no hay ningún token.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

status: waiting-for-triage

Describe the bug

With passkeys enabled and CSRF protection disabled, the default login page and the default passkey registration page fail with a NullPointerException:

  • WebAuthnConfigurer gives DefaultLoginPageGeneratingFilter a header resolver that reads the CsrfToken request attribute and calls getHeaderName() on it without checking for null.
  • DefaultWebAuthnRegistrationPageGeneratingFilter does the same when it renders the CSRF header for its script and the hidden input in each passkey's delete form.

The other default pages (login, logout and one-time token) already leave the token out when there is none.

To Reproduce

http
    .formLogin(Customizer.withDefaults())
    .csrf(AbstractHttpConfigurer::disable)
    .webAuthn((webAuthn) -> webAuthn.rpId("example.com"));

Then GET /login, or GET /webauthn/register as a signed-in user:

java.lang.NullPointerException: Cannot invoke "org.springframework.security.web.csrf.CsrfToken.getHeaderName()" because "csrfToken" is null
	at org.springframework.security.config.annotation.web.configurers.WebAuthnConfigurer.lambda$configure$2(WebAuthnConfigurer.java:208)
java.lang.NullPointerException: Cannot invoke "org.springframework.security.web.csrf.CsrfToken.getHeaderName()" because "csrfToken" is null
	at org.springframework.security.web.webauthn.registration.DefaultWebAuthnRegistrationPageGeneratingFilter.renderCsrfHeader(DefaultWebAuthnRegistrationPageGeneratingFilter.java:130)
	at org.springframework.security.web.webauthn.registration.DefaultWebAuthnRegistrationPageGeneratingFilter.doFilterInternal(DefaultWebAuthnRegistrationPageGeneratingFilter.java:88)

This affects 7.0.x, 7.1.x and main.

Expected behavior

Both pages render without a CSRF header or hidden input, as the other default pages do.

Sample

The configuration above is the whole reproduction; the pull request that fixes this adds it as a test in WebAuthnConfigurerTests.

Lenguaje dominante
Java
Estrellas
9.7k
Forks
6.4k
Merge medio
1 d 22 h
PR fusionados (30 d)
49

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de spring-projects/spring-security

Todos los issues de spring-projects/spring-security

Issues similares

Más issues de Java

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.