Default passkey pages fail with NullPointerException when CSRF is disabled
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 78/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
調査の方向性
WebAuthnConfigurer と DefaultWebAuthnRegistrationPageGeneratingFilter から始めます。issue では、これらの箇所で CSRF トークンの null 検索が発生すると特定されています。WebAuthnConfigurerTests の対応するテストを読みます。CSRF を無効にし、パスキーを有効にして再現した後、トークンが存在しない場合に /login と /webauthn/register が CSRF ヘッダーや非表示入力なしでレンダリングされることを確認します。
索引モデルが issue の本文から書いたものです。
説明
Describe the bug
With passkeys enabled and CSRF protection disabled, the default login page and the default passkey registration page fail with a NullPointerException:
WebAuthnConfigurergivesDefaultLoginPageGeneratingFiltera header resolver that reads theCsrfTokenrequest attribute and callsgetHeaderName()on it without checking fornull.DefaultWebAuthnRegistrationPageGeneratingFilterdoes 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
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
spring-projects/spring-security のほかの issue
-
Spring-security-7.1.xsd schema validates request-matcher incorrectly対応中かも @suryakant-source が 2 日前に担当しました。 オープンstatus: waiting-for-triage type: bug
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
spring-projects/spring-security#19981 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
status: waiting-for-triage
難易度 2/5 1〜3時間 初心者へのやさしさ 77/100
spring-projects/spring-security#19963 ·
メンテナーはふだん 1 日以内に返信
-
KerberosRestTemplate throws RestClientException when doExecute() returns null対応中かも @Lyin-OTTF が 5 日前に担当しました。 オープンstatus: waiting-for-triage type: bug
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
spring-projects/spring-security#19935 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
`BearerTokenAuthenticationEntryPoint` emits `resource_metadata="null"` when the resource metadata parameter resolver returns `null`対応中かも @ngocnhan-tran1996 が 12 日前に担当しました。 オープンstatus: waiting-for-triage type: bug
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
spring-projects/spring-security#19874 ·
メンテナーはふだん 1 日以内に返信
-
MapUserCredentialRepository leaves a stale owner index when a credential ID is reassigned対応中かも @adityaanikam が 17 日前に担当しました。 オープンstatus: waiting-for-triage type: bug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
spring-projects/spring-security#19847 ·
メンテナーはふだん 1 日以内に返信
spring-projects/spring-security の issue をすべて見る
似ている issue
-
staticAssetsPath follows symlinks outside the directory on Windows対応中かも @ybelMekk が今日担当しました。 オープンbug security findings
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
navikt/mock-oauth2-server#1132 ·
メンテナーはふだん 1 日以内に返信
-
agent:working follow-up
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
Sanne/incus-spawn#1683 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
checkstyle/checkstyle#22210 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 67/100
google/error-prone#6239 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
[Failing Test]: BigqueryClient.queryUnflattened fails BigQuery ITs on a transient 503対応中かも @mxtymoshyk が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 77/100
メンテナーはふだん 1 日以内に返信