Request protection
SHADE's admin and website talk to a server that anyone on the internet can reach, so SHADE guards itself against abuse. It limits how often one visitor may sign in, send a form or check out, makes sure a retried checkout does not create a second order, checks incoming payment notices, caps the size of what is sent, and only lets the client's own website (the Site URL under Settings) use its visitor features from a browser. This is part of SHADE; nobody switches it on or off. How the people who run an instance set it up is in Hardening a production instance and Setting up an instance (Coolify).
What users can do
Nobody configures request protection in the admin. What people notice:
Visitors:
- After too many form submissions, bookings, checkouts or sign-in attempts in a short time, they get a "try again later" message instead of the normal result (see What visitors and the team see).
- Pressing "pay" twice, or a network retry during checkout, does not start two orders or payments.
- Bots that fill in the hidden "Website" field of a form, or send it within 3 seconds of loading the page, get a normal "sent" answer, but nothing is stored or emailed.
- A form of the forms module also asks the visitor's browser to work out a small proof-of-work puzzle before it sends (ALTCHA, run by SHADE itself, no outside service): well under a second for a person, real work for a bot that sends thousands. Without the answer, or with one used before, the form gets the same normal answer and nothing is kept. See Forms.
Editors and admins:
- After 10 sign-in attempts (or 10 two-factor codes) from one address within 15 minutes, sign-in is refused for the rest of that quarter hour.
Admins:
- See refused sign-in bursts in the audit log (
protection.rate-limited), once per address and window. - See refused calls to a module's webhook in the audit log (Webhook refused,
protection.webhook-refused), with why, once per route a minute. - Enter a module's webhook signing secrets on its settings page, and during a rotation the previous one too. They are kept sealed and never shown again.
Who may do it
Request protection has no permissions of its own: it applies to everyone, signed in or not.
| Action | Permission | Roles |
|---|---|---|
| Change the limits | none: set by SHADE's code and by whoever runs the instance | developers / whoever deploys |
| Be rate limited | none | everyone, including signed-out visitors and API tokens |
In the admin
Nothing directly: there is no screen or setting. The only place editors meet it is the Sign in page, which shows "Too many requests. Try again later." when the sign-in limit is reached.
On the website
- Forms (the forms module's forms on pages, and the appointments booking form) carry a hidden "Website" field that people never see or reach with Tab, and send how long the page was open. See The website and, for accounts, Accounts and personal pages. Forms get their own page later.
- When a limit is reached, the site shows its own "too many" text, in Dutch or English (below).
- The shop's cart sends a fresh check with each checkout attempt and keeps it for retries of that attempt, so a retry never orders twice.
What visitors and the team see
| Situation | What is shown |
|---|---|
| Over a rate limit | Form: "You just sent this a few times. Please try again in a few minutes." Booking: "You just booked a few times. Please try again in a few minutes." Cart and account page: "Too many attempts. Try again in a minute." Admin sign-in: "Too many requests. Try again later." (Dutch: "Te veel verzoeken. Probeer het later opnieuw.") |
| A bot filled the hidden field, or sent the form within 3 seconds | The form's normal success message (nothing is stored) |
| What was sent is too large | The form's generic "did not work" text |
| A media upload is too large | The admin's error message "Upload too large" |
| Limits cannot be counted just now (see below) | "Requests cannot be counted just now. Try again shortly." |
The Dutch texts on the website exist next to the English ones (e.g. "Te veel pogingen. Probeer het over een minuut opnieuw."); the site picks them by the page's language.
Rules and limits
Rate limits
A rate limit allows one visitor a number of tries per time window. The window slides: someone cannot use the whole limit at the end of one window and again at the start of the next. Refused tries count too, so retrying while refused keeps someone refused.
| What | Limit | Window | Counted per |
|---|---|---|---|
| Editor sign-in | 10 | 15 min | address |
| Editor two-factor code | 10 | 15 min | address (separate from sign-in) |
| Editor passkey sign-in (both steps) | 10 | 15 min | address (each step its own) |
| The account page's password checks: changing the password or the email, turning two-factor on or off, allowing a passkey | 5 together | 15 min | team member |
| AI assistants (MCP) | 120 | 1 min | API token |
| Sending a form | 5 | 10 min | address |
| Page views counted by the analytics module | 120 | 1 min | address |
| Looking up free appointment times | 120 | 10 min | address |
| Booking an appointment | 5 | 10 min | address |
| Checking out in the shop | 10 | 1 min | address |
| Reading stock, the cart, an order's status | 120, 120, 60 | 1 min | address |
| Accounts: signing in, signing up, resetting a password … | 10 | 1 min | address, each action its own |
| Accounts: signing in, on top of the above | 20 | 15 min | the account, however many addresses try |
| Accounts: sign-up and confirmation emails, on top of the above | 3 together | 1 h | the email address they go to |
| Accounts: password reset links, on top of the above | 3 | 1 h | the account, on their own |
| Confirming a user's address with the password | 10 | 1 min | address |
| The same, on top of the above | 10 | 15 min | the confirmation link, however many addresses try |
| Reading who is signed in on the website | 120 | 1 min | address |
| Downloading one's own data | 10 | 1 h | address |
| Payment notices from Mollie | 300 | 1 min | address |
| A module's routes for signed-in users, unless it sets its own | 60 | 1 min | the user |
| Every module route for signed-in users, on top of the above | 300 | 1 min | address |
| Browser errors the site reports (Errors and security alerts) | 30 | 10 min | address |
- Each limit has its own budget, so filling one form does not use up another's.
- Every route a module opens to visitors has a limit, counted per address: SHADE does not load a module that leaves one out.
- Address is the visitor's internet address. Someone with a block of addresses from one connection (IPv6) counts as one. The address itself is never stored.
- The counts are kept only for the length of their window.
- If limits cannot be counted (the instance's counting service is down), signing in, sending forms and every other limited action is refused with "Requests cannot be counted just now. Try again shortly." until it is back: nobody gets through uncounted. The error log shows it. Reading content keeps working.
- The rest of the admin's work (editing, uploads, the site's build) has no rate limit.
- Per account, too. Someone with many networks could guess one account's password from each, so the team's and users' sign-ins are also limited per account (20 a quarter hour), and the emails to one address to 3 an hour: the team's resets; users' sign-up and confirmation emails together, and users' reset links on their own, so sign-up and resend requests (which anyone can send for any address) never keep the owner from a reset. Anyone can use up one account's budget, so its owner may have to wait a quarter hour to sign in, or up to an hour for a reset link (accepted); an admin can send a user a link to choose a password from the Users screen meanwhile.
- Audited refusals: team and user sign-ins record the first refused try of an address per window as
protection.rate-limited(the limit's name as target, and a scrambled key, never the address), window after window while the refusals go on. When that entry can't be written, the answer is still 429 and the error log says why. Other limits are not audited: a flood of page views is no event. Each failed editor sign-in is audited on its own too, asteam.login-failed, and repeated refusals raise a security alert (Errors and security alerts).
Idempotency keys
An idempotency key is a random string the browser sends with a request that must not run twice (a checkout). If the same request arrives again with the same key, SHADE answers with the first result instead of running it again.
- Today only the shop's checkout uses one.
- A key is remembered for 24 hours. The shop also never makes a second order for the same key, so a retry after 24 hours still finds the first order.
- If the first try failed on SHADE's side, the same retry is run again.
- If SHADE stopped in the middle of the first try (a crash or a restart), a retry is told the first one is still running for up to 5 minutes. After that the same retry runs.
Payment notices
Mollie tells the payments module when a payment changes. Mollie does not sign these notices, so the module trusts only the payment id in them, asks Mollie itself for that payment and believes only Mollie's answer. Unknown payments are ignored, and a paid amount or currency that differs from what was asked counts as failed. Refused notices are recorded and, in a burst, raise a security alert (Payments).
Modules' webhooks
A module that receives webhooks from a provider (Stripe, or one following Standard Webhooks) has each call checked before the module sees it: the call must be recent (within five minutes), signed with the module's signing secret (or the previous one while it is being changed), and a call delivered twice is handled once. Anything else is refused without saying why, and the refusal is audited. For developers: Incoming webhooks.
Request size
- What is sent to SHADE is capped (1 MiB unless whoever runs the instance sets it otherwise).
- Media uploads have their own limit: 20 MB per file, 100 MB for a video or audio file. See Media.
Security headers
SHADE's answers and the site's pages tell browsers to be careful: use only HTTPS for the site's domain and its subdomains once they have seen it (for a year), never let another site show the admin in a frame, and run only the scripts the admin and the site ship themselves, plus those from outside hosts a switched-on module declares. Content in a page can never widen that list. The exact headers are for whoever runs the instance: Hardening a production instance.
Form spam
The forms module and appointment booking share three measures: the hidden "Website" field, a minimum fill time of 3 seconds (a form sent without its time counts as too fast) and the per-address rate limit. The forms module also accepts only published forms and only their own fields, and stores only a scrambled form of the address.
Cleanup
Stored checkout answers go after a day (the fixed kind Request protection in Data retention). Rate-limit counts need no cleanup: they expire on their own.
For developers
The code and its tests: shade/kernel/protection/README.md in the shade repository.