feat(pam): implement rate-limit contract and identity lockout service#3
Open
klaudia-blazyczek-blurify wants to merge 1 commit into
Open
feat(pam): implement rate-limit contract and identity lockout service#3klaudia-blazyczek-blurify wants to merge 1 commit into
klaudia-blazyczek-blurify wants to merge 1 commit into
Conversation
agniev-a-hub
approved these changes
Jul 10, 2026
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.
Summary
Add rate-limit adapter seam to PAM identity service for login brute-force defense. Introduces
RATE_LIMIT_ADAPTERport; in-memory + Redis implementations; login router enforces lockout with exponential backoff andlockoutUntiltimestamp in error. Operators can rebind to custom backend (Drizzle, external service) via DI.Changes
packages/core/src/contracts/adapters/rate-limit.ts— NewRateLimitAdapterinterface with typed options (max attempts, time window, backoff curve)packages/core/src/pam/identity/*— Guard login route withcheck(); compute lockout in service; throw error withlockoutUntiltimestamp for client countdownpackages/core/src/server/kernel/rate-limiter.ts— In-memory backend for dev/testpackages/core/src/server/kernel/redis-rate-limiter.ts— Redis backend for production (operator binds in DI)packages/core/src/pam/identity/__tests__/identity.service.test.ts— Unit tests: lockout trigger, expiry, backoff, success clears stateAcceptance criteria
lockoutUntilISO timestamp for UI countdownctx.provide(RATE_LIMIT_ADAPTER, customImpl)Checklist
pnpm verifyis green (typecheck + lint + boundaries + module-shape + tests)pnpm verify:driftis green (no OpenAPI/catalog drift)contracts/, impl in kernel, domain imports only contract)Notes
None