core: the default rate-limit store is per-process, so the limit multiplies by instance count

Open
#129 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
45/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Active
Tech stack
redis, typescript

Research direction

Start by locating InMemoryRateLimitStore, RateLimitStoreInterface, and the auth package's rate-limit configuration. Compare the current per-process behavior with the requirements for a shared Redis-backed store and review where production boot warnings and configuration documentation belong. Done means multi-instance deployments have a supported shared-store option, the single-instance constraint is documented, and the production warning behavior is covered.

Written by the indexing model from the issue text.

Description

bug
What happens

InMemoryRateLimitStore keeps its windows in a Map local to the
process. The auth package's rate limits — the ones protecting login, OTP,
recovery and password change — are therefore per instance.

Two pods means twice the configured attempts; behind an autoscaler the
limit is decorative for credential stuffing, and nothing in the
configuration or the logs indicates that the deployment shape changed the
security property.

The keying itself is careful (per route, IP and account combined), so
this is purely the store.

Proposal
  • Document the constraint where the limits are configured: the in-memory
    store is correct only for a single instance.
  • Ship a shared-store implementation of RateLimitStoreInterface (Redis
    is the common case) so a multi-instance deployment has a supported
    option rather than a custom one.
  • Consider warning at boot when the in-memory store is active and
    NODE_ENV === 'production'.

Related: #113 (a @RateLimit with no guard reaching the route).

Dominant language
TypeScript
Stars
1
Forks
2
PR merge metrics
No merged PRs in 30d

Getting set up

Open in Codespaces

Starts the project's dev container in your browser, under your own GitHub account.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from btwld/rockets

All issues in btwld/rockets

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.