Planning Équipes

Search Français Let’s talk

Limiting abuse: rate, lockouts and solve quota

Every route open to the Internet carries a cap set by the application: access codes, declarations, colleague lookups, the MCP server, plus a solve quota to set if the machine is shared. Counters live in memory (a single instance); behind a reverse proxy, those that count per address assume CONNEXION_PROXYS_FIABLES is set (the sign-in lockout, which also holds the form lockout). The wall display’s is in public tokens.

Staff-space code requests

POST /api/espace-animateur/{jeton}/code is the only public endpoint that triggers a mail send. What is counted is codes never used: opening the session with the code received clears the counter. A staff member who signs in normally, even often, never reaches the cap; only an accumulation of requests with no follow-up, the abuse itself, does. Beyond it: 429 with Retry-After.

Variable Default Use
ESPACE_CODE_MAX_DEMANDES 3 Unused codes tolerated per staff member and per window
ESPACE_CODE_FENETRE PT10M Window duration, matched to a code’s validity

Messages from the organisation to the team

Writing to the whole team is the one action of the organisation that sends free text to dozens of people without anybody reviewing it first: a wrong scope or a loop on the API is paid in inboxes. Two ceilings, which answer 409 with the reason: how many people one message reaches, and how many messages an edition sends over the window. A refused request is not counted, and a double click on “Send” only leaves once.

Variable Default Use
MESSAGE_EQUIPE_MAX_DESTINATAIRES 500 People reached by a single message
MESSAGE_EQUIPE_MAX_ENVOIS 6 Messages per edition and per window
MESSAGE_EQUIPE_FENETRE PT1H Window duration

Rate of the space’s writes

The space is open on the Internet with a URL as its only credential, and three routes write there: availability declarations (POST …/disponibilites), carpool requests (…/covoiturage) and the report of an absence (…/signalements, open the whole edition, collection and fair closed included, each send writing to the organisation). Two bounds that do not replace each other:

  • the volume is bounded by the business: one pending proposal per staff member (partial unique index, V59), one pending carpool request, one open report per person and per object (V111). Resending a thousand times leaves one row, and the admin never has two contradictory versions to arbitrate;
  • the rate is bounded here: without a cap, an open session writes and notifies at network speed.
Variable Default Use
ESPACE_DECLARATION_MAX_ENVOIS 20 Writes tolerated per staff member and per window
ESPACE_DECLARATION_FENETRE PT10M Window duration

Each of the three routes has its own counter (correcting yourself on one does not use up the others), counted before any validation so a loop of refusals stops too. Beyond: 429 with Retry-After. The count is kept per staff member and not per IP address: the session already names the staff member, and an IP is what a phone changes between two cells.

On content, a day outside the event’s dates and an unknown game category are refused, and the declaration writes nothing to the reference data: it awaits an explicit admin decision. A token holder therefore cannot change the solver’s inputs, only propose. A report writes nothing to the schedule.

Viewing a colleague’s seats

GET /api/espace-animateur/{jeton}/collegues/{id}/postes feeds the “their slot I want in exchange” choice. Access is wide by design: the space already hands each staff member the named list of their colleagues, an answer says only slots and stands (what the printed global schedule circulates), and a directed swap can target anyone: a filter would empty the list when the staff member needs it.

What is bounded is enumeration: without a cap, a session would rebuild the whole grid, minors included. The cap counts different colleagues, not requests: seeing the same one again, reloading the page or hesitating between three costs nothing.

Variable Default Use
ESPACE_COLLEGUES_MAX 40 Different colleagues viewable per staff member and per window
ESPACE_COLLEGUES_FENETRE PT1H Window duration

Beyond, 429 + Retry-After, counted per staff member. A non-existent id counts like a real one: probing ids costs as much as reading them. The refusal never blocks the swap request: the list stays empty with the delay shown, and the request goes out with no wished slot in return. Two more guards, which count nothing but close the route:

  • the fair must be open: the rule is declared on the route (@FoireOpenRequired), in the form of the two neighbouring guards, and the filter runs after authentication, so an anonymous caller gets their 401 without learning whether the fair is open. The fair’s writes keep their check in the service and carry their authorisation in the WHERE of their query;
  • the colleague must exist in the edition, otherwise a bare 404: a 200 [] would let existing ids be probed.

Still open: replacing the whole directory with a type-ahead search.

MCP server rate

/mcp is the only authenticated surface whose credential is a long-lived shared key, in a header, with no session or second factor. McpRateLimiter counts all requests under /mcp, authenticated or not, per address. Beyond the cap: 429 + Retry-After, even with the right key (counting only failures would let a stolen key call at network speed, and a key pasted into a hosted assistant travels further than a password).

Variable Default Use
PLANNING_MCP_MAX_REQUESTS 120 Requests tolerated per address and per window; 0 or less disables the cap
PLANNING_MCP_RATE_WINDOW PT1M Window duration
PLANNING_MCP_TRUSTED_PROXIES (the value of CONNEXION_PROXYS_FIABLES) Reverse proxies whose X-Forwarded-For is believed

The window is fixed, opened at the first request: past the cap, it still closes on time, a refused request does not push it back. It is the reverse of the lockouts (refused keys, sign-in), whose window runs from the last failure: a lockout wants one more attempt to gain nothing, a rate cap wants a legitimate client to know when to come back.

The lockout on refused keys

The cap does not make the key hard to guess (at 120 requests a minute, over seven thousand tries an hour): entropy does, and this second guard makes a series of tries cost time. Beyond PLANNING_MCP_MAX_FAILURES consecutive refused keys, the address gets 429 for PLANNING_MCP_LOCKOUT_DURATION, counted separately from the rate.

Exception: a key generated from the MCP screen, and in force, passes the lockout. The address is not the caller: behind a NAT or an undeclared proxy, a stranger’s bad keys also locked out the legitimate assistant, and a generated key carries 256 random bits that the lockout protects from nothing. It passes without taking a place or clearing the series. The configuration key (PLANNING_MCP_API_KEY), whose strength nobody checked, stays behind the lockout, even when correct: generate a key from the screen to get out of it.

Variable Default Use
PLANNING_MCP_MAX_FAILURES 5 Consecutive refused keys tolerated per address; 0 or less disables the lockout
PLANNING_MCP_LOCKOUT_DURATION PT10M Block duration, counted from the last failure

Two safeguards keep it from turning against a legitimate client: a request with no key does not count (a not-yet-configured client probes before being set up: it gets its 401 and nothing else), and a request that authenticates clears the series. A 403 (a browser’s admin session, without the mcp role) neither counts nor clears: no key was tried.

Success is read from the status, never from context.user(). Quarkus sets an identity on the routing context even for a request it is about to refuse: user() != null is true on 401s too.

The address kept is that of the sign-in lockout, computed by the same code (ClientAddress): X-Forwarded-For from the right, and only if the connection comes from a declared proxy. PLANNING_MCP_TRUSTED_PROXIES defaults to CONNEXION_PROXYS_FIABLES, and an empty value counts as absent (a compose file passing the unset variable sets it to the empty string, which the ${A:${B:}} fallback does not treat as missing). Setting the cap for your use: mcp-connexion.md.

Behind a proxy, this list is not optional here. The sign-in lockout counts only failures, and a deployment that declared nothing stays usable. This cap counts every request: without the list, all calls arriving through the proxy fall on one counter, and an anonymous caller holds the legitimate MCP client at 429 with two requests a second, with no key, the filter running before authentication. Set CONNEXION_PROXYS_FIABLES at the same time as PLANNING_MCP_API_KEY.

Named API keys

A named key (ADR 0136 (external site)) goes through the same guards as the instance key, plus a ceiling per key: its requests on /api (X-Api-Key header) and on /mcp are counted together, whatever the address, and beyond it 429 with Retry-After. The lockout on refused keys is the same on /api and on /mcp, with the same PLANNING_MCP_MAX_FAILURES and PLANNING_MCP_LOCKOUT_DURATION: an unknown, expired or revoked key counts in the run, with nothing telling the caller which of the three reasons refused it, and a named key in force passes the lockout like a generated key. The per-address ceiling of /mcp stays specific to /mcp.

Variable Default Use
API_KEYS_MAX 20 Keys in force (neither revoked nor expired) at once; beyond it, creation is refused
API_KEYS_MAX_REQUESTS 600 Requests tolerated per key and per window; 0 or less turns the ceiling off
API_KEYS_RATE_WINDOW PT1M Length of the window

Solve quota

A public instance (PUBLIC_INSTANCE=true), for example exposed with a shared password for a demo, lets anyone launch solves, and a solve occupies the machine for minutes. If it also carries a production, two operator guards bound what a visitor can cost it: SOLVER_MAX_SOLVES_PER_HOUR (solves accepted over a sliding 60 minutes) and SOLVER_MAX_QUEUED_JOBS (queued jobs), with SOLVER_SECONDS_LIMIT_MAX for each one’s duration. They count for the whole instance, not per address: the machine is what is protected, and a visitor changing address does not start from zero. The refusal is a 409 that says when to come back, not a 429. Off by default, ignored outside a public instance; setting and scope in the solve setting, the choice in ADR 0075 (external site) and ADR 0110 (external site).

A mistake, an omission? Fix this page on GitHub. (external site)

A question no guide answers?

Let’s talk See hosting