Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Default passkey pages fail with NullPointerException when CSRF is disabled

オープン 初心者向け
#19,984 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
78/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
java, spring

調査の方向性

WebAuthnConfigurer と DefaultWebAuthnRegistrationPageGeneratingFilter から始めます。issue では、これらの箇所で CSRF トークンの null 検索が発生すると特定されています。WebAuthnConfigurerTests の対応するテストを読みます。CSRF を無効にし、パスキーを有効にして再現した後、トークンが存在しない場合に /login と /webauthn/register が CSRF ヘッダーや非表示入力なしでレンダリングされることを確認します。

索引モデルが issue の本文から書いたものです。

説明

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.

主要言語
Java
スター
9.7k
フォーク
6.4k
平均マージ
2日 2時間
マージ済み PR(30日)
54

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

spring-projects/spring-security のほかの issue

spring-projects/spring-security の issue をすべて見る

似ている issue

Java の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。