Sign-in hardening: count parallel wrong passwords of a session, and small follow-ups of the signed-in count

オープン
#3,447 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

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

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

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
45/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
活発
技術スタック
csharp

調査の方向性

Start in src/FluentCMS.Core/Identity/ and trace CmsUserManager.ChangePasswordAsync, TwoFactorService.RequireCodeAsync, ClearingPasswordChangeAsync, SetPasswordAsync, and CmsUserStore.cs; the issue also names docs/host-configuration.md. Read the linked follow-ups and their review context, then find the existing tests for these flows. Done means the five listed behaviors are covered by code, tests, or the specified spec update, and the documentation sentence is corrected.

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

説明

area:identity security type:bug

Follow-ups of #3371, #3378 and #3381 (#3444), found in its review. Paths are under src/FluentCMS.Core/Identity/.

  • Parallel wrong passwords on change-password are not all counted. CmsUserManager.ChangePasswordAsync ignores the result of SignedInAccessFailedAsync, as it ignored AccessFailedAsync before. A holder of a stolen cookie who posts N guesses at once has them all read one concurrency stamp: each answers "wrong password", one save wins, and the count rises by one. A right guess that loses its save answers ConcurrencyFailure, which tells the sender it was right. The per-address Auth limit (20 a minute) is then the only bound, against the intended 5 in 5 minutes. Codes are not affected, since a right code must win its own save.
  • A right two-factor code resets the count of wrong passwords too. ResetSignedInFailuresAsync is called from TwoFactorService.RequireCodeAsync, so a session that holds the second factor gives 4 wrong passwords, one right code at /me/two-factor/recovery-codes, and starts again.
  • The forced-change flag is put back over a reloaded user. ClearingPasswordChangeAsync and SetPasswordAsync restore mustChangePassword after a failed save without checking that the user was not reloaded, the pattern #3381 fixed for the failure count. No path of core saves the user again in that scope today.
  • IsTokenKeyViolation matches the table name anywhere in the provider's message (CmsUserStore.cs). SQL Server repeats the duplicate key value, so another unique violation whose value contains cms_user_token would be answered as a refusal. It can never become a success.
  • docs/host-configuration.md still says the token endpoint refuses a code or refresh token of a locked-out user, which #3271 ended.

Wanted

  • Every wrong current password of a session counted when requests run at once, and no different answer for a right one that lost its save, with a test.
  • Wrong passwords and wrong codes of a session counted apart, or the reason they share a count recorded in the spec.
  • The flag restored only when the user was not reloaded.
  • The token key matched by the constraint's name on the three providers.
  • The sentence corrected.

Bundle 28.

主要言語
C#
スター
567
フォーク
107
平均マージ
1時間 19分
マージ済み PR(30日)
353

環境構築

はじめの一歩

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

fluentcms/FluentCMS のほかの issue

fluentcms/FluentCMS の issue をすべて見る

似ている issue

C# の issue をもっと見る

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

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