Repository navigation
fix(security): 認証オフ時の削除PINにも総当たり制限を適用する - #58
Merged
Merged
Conversation
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #19
概要
通常の認証をオフ(
authEnabled=false)にし、削除系操作のPIN保護(requirePINForDeletion=true)のみを有効にした場合、削除系エンドポイントへの誤ったPIN入力が総当たり制限(ロックアウト)の対象にならない問題(Issue #19)を修正しました。原因と解決策
ServerViewModel.protectedDestructiveがauthEnabled=falseかつrequirePINForDeletion=trueの場合にPINSecurity.constantTimeEqualsを直接呼び出しており、通常の認証経路(isAuthorized/recordAuthResult)を通らないため、IPごとの失敗回数記録と指数バックオフによるロックアウトが適用されていなかった。MediaServerKitにスレッドセーフなPINLockoutTrackerを追加し、IPごとの連続失敗回数の記録・指数バックオフによるロックアウト判定・定数時間PIN比較・成功時のカウンターリセットを一本化。ServerViewModelの通常認証(isAuthorized)と削除系操作のPIN保護(protectedDestructive)の双方が共通のcheckPIN(_:)(PINLockoutTracker.verify)を経由するように変更。PINLockoutTrackerTestsを追加し、連続失敗によるロックアウト・ロックアウト中の正しいPIN拒否・遅延経過後の解除・指数バックオフ・成功時の失敗カウンターリセット・IP単位の独立性を検証。機能・変更内容別コミット一覧
2a4190d-feat(security): IPごとの連続失敗回数と指数バックオフを管理するPINLockoutTrackerを追加Packages/MediaServerKit/Sources/MediaServerKit/PINSecurity.swift3ef9682-fix(server): 認証オフ時の削除PIN検証にもPINLockoutTracker経由で総当たり制限を適用ArkServer/Features/Server/ViewModels/ServerViewModel.swift9ec77f2-test(security): PINLockoutTrackerのロックアウト・指数バックオフ・リセットの単体テストを追加Packages/MediaServerKit/Tests/MediaServerKitTests/PINSecurityTests.swift検証
swift test --package-path Packages/MediaServerKit: 全33件のテスト(新規追加のPINLockoutTrackerTests8件を含む)がパスすることを確認。