Public endpoints are abuse surfaces: login, registration, token refresh, password reset, a
second-factor check, anything that answers whether an address has an account. The reflex
is to add in-app rate limiting (a Bucket4j bucket, a servlet filter or interceptor).
Our backends deploy behind CloudFront + AWS WAF, which already shapes requests at the
edge (Expenses, for instance, tuned the WAF SizeRestrictions_BODY rule for large CSV
uploads). In-app limiting would duplicate that, add state (per-instance counters that
disagree across instances unless they share a store), and still not protect against
volumetric/DDoS traffic the way the edge does.
Decision
IP and endpoint throttling is an edge concern (CloudFront / AWS WAF), not an application
concern. Do not add Bucket4j, a rate-limit filter, or any in-app throttling keyed on
the caller’s address or the route. Tune the WAF / CloudFront rules instead.
What a project must configure
The edge only protects what it has a rule for, and those rules live in the AWS console, not
in any repository. So:
Before a public deployment, a WAF rate-based rule covers the project’s public
authentication endpoints: at least login, and every other unauthenticated endpoint that
accepts a guessable secret (a reset code, a second-factor code) or reveals whether an
account exists.
The project lists, in its own docs, the edge rules it relies on, and checks that they
exist rather than assuming it. An ADR that leaves brute-force control to the edge is
relying on a rule somebody must have created.
The exception: a limit the edge cannot express
A limit keyed on something the edge cannot see (an account, a code, a plan) belongs in the
application, scoped to that one case. General IP and endpoint throttling stays at the edge.
Both projects now have such limits:
per code: dracomania allows at most 5 wrong attempts on a password reset code
(0007-accounts-sessions-and-access-by-actor, 2026-09-10 amendment). Expenses does the
same since backend v1.74.0, for its reset code and for its second-factor login challenge
(5 each, 0014-two-factor-single-use-challenge 2026-10-11 amendment);
per account: both projects refuse to issue a new reset code within a cooldown of the
last one (Expenses does the same for verification codes, answering 429);
Amendment 2026-10-22 — when the edge plan cannot express the rules
The decision assumes the edge can hold the rules. If the project’s edge plan cannot (a
CDN-bundled WAF that refuses path-scoped rules, and no budget for a fuller plan), the project
enforces its limits in the app and records that in its own ADR, with the limits listed in one
place in the code. That is a departure for that project, not a new default: the edge stays the
better home, and the limits move back when the plan allows. Expenses did this on 2026-10-22
(0028-request-limits-in-the-app).
Consequences
The app stays stateless and simple; protection is centralized where it’s cheap and
volumetric-attack-resistant.
Accepted: the protection lives outside version control. A rule removed in the console
leaves no diff, and nothing in the app notices. Listing the relied-on rules in the
project’s docs is the mitigation.
An in-app limit carries a product reason and is written where its key lives (the code,
the account, the plan). It is never a general throttle under a product name.
Checked in both backends: no in-app IP or endpoint throttling (Expenses on 2026-05-31 and
again on 2026-09-10; dracomania on 2026-09-10). Their only in-app limits are the ones
listed above. Since 2026-10-22 Expenses throttles in the app under the amendment above
(0028-request-limits-in-the-app); dracomania is unchanged.
Example
What the required list looks like — optional
Agents: safe to skip. The Decision above is the specification; everything below is
illustration. Skipping this block costs you nothing normative and saves tokens.
This is the one ADR whose example is not code, on purpose — the decision is that no
throttling code exists. The artifact it produces is a short section in each project’s
index, and it looks like this:
**Edge rules this project relies on**| Surface | Rule relied on | Confirmed in the console? ||---|---|---|| Public auth endpoints | rate-based rule, per IP | yes / no — date checked || Large uploads | body-size override | yes / no — date checked |
The third column is the whole point. Edge rules live in a cloud console that no
repository can see, so the only honest record distinguishes relied upon from confirmed — and carries the date it was last checked, because a console can change
without any commit.
A list that silently implied everything was covered would be worse than no list: it
would stop the next person from looking. Where a project’s own status is recorded is a
matter for that project’s docs, not for a published core decision.
0014-two-factor-single-use-challenge (Expenses) — left brute-force on the
second-factor check to the edge until 2026-10-11; now bounds it per challenge in the app