2 Commits
Author SHA1 Message Date
Runway 5fa0c1ef9f Runway 1.1.2 2026-10-29 12:42:22 -06:00
Runway 67d61f339c Runway 1.1.1 2026-10-29 11:41:13 -06:00
46 changed files with 1365 additions and 105 deletions

No files matched your search

+147
View File
@@ -2,6 +2,153 @@
All notable changes are recorded here. Versions follow [Semantic Versioning](https://semver.org/). All notable changes are recorded here. Versions follow [Semantic Versioning](https://semver.org/).
## [1.1.2] — 2026-10-29
_A patch release: the access log now records every public request that gets past the protection edge, including the
ones a filter answers on its own: login attempts, refused form posts, a suspended or maintenance site, a slow body's
`408`, an oversized form's `413`, plugin routes such as `robots.txt` and the sitemap._
### Upgrading — read this first
**From `1.1.1`: a kernel upgrade, no flag.** From `1.1.0`, `1.0.1` or `1.0.0`, read `1.1.1`'s and `1.1.0`'s
*Upgrading* first, then install this release directly. Paths are the installer defaults (`/opt/runway`,
`/opt/runway-data`).
**Your access log will carry more lines.** Nothing is removed and the line format is unchanged, but requests that
used to leave no line now leave one: in the `runway.access` stream and in each site's own access log (its **Logs**
screen). Expect, among others, `POST /login -> 302` for a login attempt, `POST /login -> 403` for a form post refused
for its missing token, `-> 503` while a site is suspended, in maintenance or over its quota, `-> 408` for a refused
slow body, `-> 413` for a `PUT`/`PATCH`/`DELETE` form over `runway.endpoints.max-form-bytes`, and `GET /robots.txt`,
`GET /sitemap.xml` and other plugin routes. A tool that reads `runway.access` (a
log shipper, an alert on `4xx`/`5xx` counts, a ban list fed by failed logins) sees these from now on; check any
threshold that assumed they were absent; under a flood of login attempts that gets past the protection edge, the
`runway.access` stream now grows by one line per attempt, which a journal rate limit may also count. Each site's
**Insights** does not count the refusals (it counts only `GET` page views and `404`s), but it now sees plugin routes:
a page a plugin serves counts as a page view, and a plugin route answering `404` (a missing blog post, an icon the
site has not set) appears among the top 404s. Requests the protection edge turns away (`403`/`429`) still go to
`runway.protect` only, throttled, as before.
**1. Back up.** Take each site's backup (**Backups**) and copy `/opt/runway-data/external/` somewhere **outside**
`external/plugins/`.
**2. Upgrade the kernel:**
```bash
chmod +x runway-1.1.2.bin
sudo ./runway-1.1.2.bin -y
```
The essential plugin moves with the kernel to `1.1.2` (its descriptor changes in version only, and its jar is
rebuilt), so the installer refreshes it; expect these lines, once:
```
refreshing bundled plugin 'protection' from this release (it moves with the kernel; files you edited are backed up)
plugin 'protection': plugin.yml replaced (the previous one kept as plugin.yml.bak, for a rollback)
plugin 'protection': runway-plugin-protection.jar replaced (the previous one kept as runway-plugin-protection.jar.bak, for a rollback)
keeping the bundled plugins in the release: /opt/runway-1.1.2/seed/ (the repair copy — Administration §12)
```
**3. Check.**
- **About Runway** shows `1.1.2`.
- On **Plugins**, every row is *Loaded* and none *Blocked*; protection shows `1.1.2`.
- A login form posted without its token appears in the access log:
`curl -s -o /dev/null -w '%{http_code}\n' -H 'Host: <a site host>' -d 'username=x&password=y' http://127.0.0.1:8080/login`
answers `403`, and `journalctl -u runway --since '-5min' | grep 'runway.access' | grep -c 'POST /login -> 403'` is
at least `1`.
**4. Rollback**, if needed: `sudo bash runway-1.1.1.bin -y` puts 1.1.1 back, its protection files included; those
requests then leave no access-log line again. Nothing this release saves is read differently by 1.1.1.
### Fixed
- **The access log records every public request past the protection edge.** It used to be written by the innermost
filter, so any request answered by a filter further out left no line in either the platform log or the site's
own: every attempt at a site's login page, successful or not (Spring Security answers it itself), a form post
refused for its missing token, the `503` of a suspended, maintenance or over-quota site, a request body refused for
arriving too slowly, a `PUT`/`PATCH`/`DELETE` form refused unread for its size, and every plugin route
(`robots.txt`, the sitemap, `llms.txt`, a plugin's form). A password-guessing run against a site's login was
invisible in its access log. The log is now written just inside the protection edge, from where it sees how each
request was answered. A plugin page served by a route now also counts in **Insights** like any other page.
- **Audit lines are kept ahead of access lines when a site's log queue is full.** Both share one queue
(`runway.logs.queue-capacity`); an eighth of it is now held for audit lines, so a flood that fills it drops access
lines first and keeps the `login.failure` records of the very attack that filled it.
### Documentation
- OPERATIONS §3 (what the access log records, and since when), PLUGIN-DEVELOPMENT (which plugin filters' answers are
logged), SITE-MANAGER-GUIDE §3 and §10 (login attempts and refusals on **Logs**; not counted by **Insights**).
## [1.1.1] — 2026-10-29
_A patch release: the slow-request-body limit 1.1.0 introduced now covers form posts and multipart uploads too, and
after a restore the Backups screen shows how the site is reached, for review._
### Upgrading — read this first
**From `1.1.0`: a kernel upgrade, no flag.** From `1.0.1` or `1.0.0`, read `1.1.0`'s *Upgrading* first (behind a
reverse proxy its step 1 matters), then install this release directly: `1.1.0` itself is not needed in between. Paths
are the installer defaults (`/opt/runway`, `/opt/runway-data`).
**1. Back up.** Take each site's backup (**Backups**) and copy `/opt/runway-data/external/` somewhere **outside**
`external/plugins/`.
**2. Upgrade the kernel:**
```bash
chmod +x runway-1.1.1.bin
sudo ./runway-1.1.1.bin -y
```
The essential plugin moves with the kernel to `1.1.1` (its descriptor changes in version only, and its jar is
rebuilt), so the installer refreshes it; expect these lines, once:
```
refreshing bundled plugin 'protection' from this release (it moves with the kernel; files you edited are backed up)
plugin 'protection': plugin.yml replaced (the previous one kept as plugin.yml.bak, for a rollback)
plugin 'protection': runway-plugin-protection.jar replaced (the previous one kept as runway-plugin-protection.jar.bak, for a rollback)
keeping the bundled plugins in the release: /opt/runway-1.1.1/seed/ (the repair copy — Administration §12)
```
**3. Check.**
- **About Runway** shows `1.1.1`.
- On **Plugins**, every row is *Loaded* and none *Blocked*; protection shows `1.1.1`.
- The start log says `request bodies slower than 4096 bytes/s are refused (runway.http.min-request-data-rate)`, with
your value if you changed it.
**4. Rollback**, if needed: `sudo bash runway-1.1.0.bin -y` puts 1.1.0 back, its protection files included; slow form
posts are then held until the idle timeout again. Nothing this release saves is read differently by 1.1.0.
### Fixed
- **Slow request bodies are refused on every path, as 1.1.0 said they would be.** In 1.1.0
`runway.http.min-request-data-rate` was enforced only where a body was read as a stream. Form posts — every login
form, the console's forms, a plugin's form — and multipart uploads were read past it, so a client trickling one in
still held a request thread until the 30-second idle timeout, as in 1.0.1. Runway now checks the rate on every read
of a request body and answers `408 Request Timeout`: within about two seconds for a steady drip (measured: form and
multipart posts at 20 bytes a second, on both login pages and a plugin's form route), and for a client that pauses
between packets when its next packet arrives, within one idle timeout. Only time spent waiting for the client
counts, and a body that has arrived complete is never refused, however late its last packet came. A proxy that
buffers the whole request body before forwarding it kept such clients off Runway already, in 1.1.0 too.
- **Sending part of a body fast no longer buys a long drip.** 1.1.0 averaged over the whole body, so a client that
sent most of a large one at full speed could then drip the rest for the body's size divided by the rate (16 MiB at
4 KiB/s: over an hour). Bytes sent early now earn at most 30 seconds of waiting.
- **A request refused for a slow body is answered `408`.** Depending on how the code above handled the failed read,
1.1.0 could answer it `400` (a form parser's "unable to parse") or an empty `200`.
### Changed
- **After a restore, the Backups screen shows how the site is reached.** On the application console, after a restore
or after creating a site from a backup, the screen shows the site's hosts and base URL as they now are, with the
same editor as **Sites → Edit hosts**: a restore made there brings back the hosts and base URL saved in the backup,
which may not be how this installation reaches the site. On a site's own console the hosts are shown read-only: a
restore made there keeps them. See `docs/ADMINISTRATION.md` §10.
### Documentation
- **Exempting a same-host proxy's health check from the rate limit** (`docs/ADMINISTRATION.md` §12.4): the proxy sends
its check with a fixed `X-Forwarded-For` that no visitor can produce, and that one address is listed in protection's
allowlist, so the check never shares a rate-limit bucket with a local crawl and loopback stays limited.
## [1.1.0] — 2026-10-29 ## [1.1.0] — 2026-10-29
_A minor release: plugins can keep their data in PostgreSQL or MariaDB through the new database plugins, platform _A minor release: plugins can keep their data in PostgreSQL or MariaDB through the new database plugins, platform
+25 -3
View File
@@ -710,7 +710,7 @@ from the configuration metadata shipped in the jar.
| `runway.security.secret-key` | _(installer-set)_ | Master key for AES-256-GCM encryption of every stored secret (platform SMTP password or OAuth2 client secret, per-site CAPTCHA secrets, `secret`-typed plugin settings). The installer generates one on first install and stores it in a root-only systemd drop-in as `RUNWAY_SECURITY_SECRET_KEY` (see `--secret-key`, §3); Spring's relaxed binding maps that env var to this property. **While blank the secret cipher is unavailable and no secret can be saved** — the app console shows a persistent warning on every page until it is set. Holds a real secret — never in the classpath default. | | `runway.security.secret-key` | _(installer-set)_ | Master key for AES-256-GCM encryption of every stored secret (platform SMTP password or OAuth2 client secret, per-site CAPTCHA secrets, `secret`-typed plugin settings). The installer generates one on first install and stores it in a root-only systemd drop-in as `RUNWAY_SECURITY_SECRET_KEY` (see `--secret-key`, §3); Spring's relaxed binding maps that env var to this property. **While blank the secret cipher is unavailable and no secret can be saved** — the app console shows a persistent warning on every page until it is set. Holds a real secret — never in the classpath default. |
| `runway.proxy.forwarded-headers` | `true` | Whether to honor `X-Forwarded-*` at all (still only from trusted peers; the standard `Forwarded` header is never read) — see **§7**. | | `runway.proxy.forwarded-headers` | `true` | Whether to honor `X-Forwarded-*` at all (still only from trusted peers; the standard `Forwarded` header is never read) — see **§7**. |
| `runway.proxy.trusted-cidrs` | `127.0.0.1/32`, `::1/128` | Proxy peers whose forwarded headers are trusted. The **bound default is empty** (trust nothing); the shipped file seeds loopback. **§7**. | | `runway.proxy.trusted-cidrs` | `127.0.0.1/32`, `::1/128` | Proxy peers whose forwarded headers are trusted. The **bound default is empty** (trust nothing); the shipped file seeds loopback. **§7**. |
| `runway.http.min-request-data-rate` | `4096` | The slowest a request body may arrive, in **bytes per second**, before Runway answers `408 Request Timeout` and frees the request thread. Without it a client sending a byte now and then kept a thread for as long as it liked (the idle timeout only limits one stalled read). Measured from the body's first byte on what has arrived, so a server slow to start reading is never blamed. 4096 (4 KiB/s) is below any real connection; `0` turns the check off. Set on **Settings → Server settings → Request limits**; applies after a restart. | | `runway.http.min-request-data-rate` | `4096` | The slowest a request body may arrive, in **bytes per second**, before Runway answers `408 Request Timeout` and frees the request thread. It applies to every body — login and other forms, multipart uploads, raw bodies alike. Without it a client sending a byte now and then kept a thread for as long as it liked (the idle timeout only limits one stalled read). Only the time spent waiting for the client counts, from the first second of waiting on, so a server slow to start reading is never blamed, and a body that has arrived complete is never refused, however late its last packet came. Sending part of a body fast earns at most 30 seconds of waiting, so a large body cannot buy a long drip; a client pausing between packets is cut when its next packet arrives, within one idle timeout. 4096 (4 KiB/s) is below any real connection; `0` turns the check off. Set on **Settings → Server settings → Request limits**; applies after a restart. |
| `runway.i18n.cache-seconds` | `5` | How often a message lookup **outside** a public page (an error page, a plugin's background text) and the operator console's own bundle re-check their files on disk (`0` = on every lookup). Public pages re-check on every request, so a bundle edited on disk shows on the next page view, under a new ETag. | | `runway.i18n.cache-seconds` | `5` | How often a message lookup **outside** a public page (an error page, a plugin's background text) and the operator console's own bundle re-check their files on disk (`0` = on every lookup). Public pages re-check on every request, so a bundle edited on disk shows on the next page view, under a new ETag. |
| `runway.csp.mode` | `report` | Content-Security-Policy delivery: `report` (report-only — violations are logged, nothing is blocked), `enforce`, or `off`. Upper or lower case; blank means `report`. Any other value (`enforced`, say) stops startup with a message naming it. See **§8.4**. | | `runway.csp.mode` | `report` | Content-Security-Policy delivery: `report` (report-only — violations are logged, nothing is blocked), `enforce`, or `off`. Upper or lower case; blank means `report`. Any other value (`enforced`, say) stops startup with a message naming it. See **§8.4**. |
| `runway.csp.strict-dynamic` | `true` | `'strict-dynamic'` on the nonced pages. `false` rolls the whole estate (console **and** public pages) back to the host allowlist. **§8.4**. | | `runway.csp.strict-dynamic` | `true` | `'strict-dynamic'` on the nonced pages. `false` rolls the whole estate (console **and** public pages) back to the host allowlist. **§8.4**. |
@@ -1588,7 +1588,10 @@ wherever a site gets hosts: creating a site, installing a demo, and creating a s
malformed host or one another site answers on, before anything is created. Restoring a backup brings back the malformed host or one another site answers on, before anything is created. Restoring a backup brings back the
hosts and base URL the site had when the backup was taken when it is made from the application console (a host hosts and base URL the site had when the backup was taken when it is made from the application console (a host
given to another site since then is left off, the log says which: `restored site '…' without host(s) […]`, and you given to another site since then is left off, the log says which: `restored site '…' without host(s) […]`, and you
can add it back with **Edit hosts** once it is free). A restore made from the site's own console keeps the hosts and can add it back with **Edit hosts** once it is free). After such a restore, and after creating a site from a backup,
the Backups screen shows the site's hosts and base URL **as they now are**, with the same editor as **Edit hosts**:
check them before anything else, because a backup taken on another installation, or before the site moved, brings
back how it was reached then. A restore made from the site's own console keeps the hosts and
base URL the site has: how a site is reached is yours to set, never the site manager's, and a backup file is base URL the site has: how a site is reached is yours to set, never the site manager's, and a backup file is
theirs to write. A host is a plain DNS name: no scheme, path, theirs to write. A host is a plain DNS name: no scheme, path,
port (`example.com:8080`), wildcard (`*.example.com`) or underscore, and an international name is written in its port (`example.com:8080`), wildcard (`*.example.com`) or underscore, and an international name is written in its
@@ -2431,6 +2434,24 @@ runway:
- "198.51.100.7" # the audit runner - "198.51.100.7" # the audit runner
``` ```
**A health check from a proxy on the same host.** Behind a same-host reverse proxy, the proxy's own health check
(`GET /actuator/health` or a site's `/__health`) usually reaches Runway from loopback with no `X-Forwarded-For`, so it
shares one rate-limit bucket with everything else run on that host — a local crawl or audit can then earn the check
`429`s and push the proxy towards marking the server down. Exempt the check alone, not loopback: have the proxy send
it with a fixed `X-Forwarded-For` from a documentation range, and list that address here. No visitor can pose as
it: on real traffic the proxy adds the visitor's own address to the right of anything the visitor sent (or replaces
the header), and Runway reads the header from the right. With HAProxy 2.2 or later:
```
backend runway
option httpchk
http-check send meth GET uri /actuator/health ver HTTP/1.1 hdr Host www.example.com hdr X-Forwarded-For 192.0.2.53
```
and `192.0.2.53` in `allowlist`. Loopback must be in `runway.proxy.trusted-cidrs` (it is, for a same-host proxy);
leave the probe's address out of it, which is for real proxies only. Checking
`/actuator/health` from outside the proxy (a monitoring service) needs no header: list that service's own address.
> **If you are blocked, stop — do not keep probing.** Once an address is auto-blocked, requests no longer > **If you are blocked, stop — do not keep probing.** Once an address is auto-blocked, requests no longer
> reach the rate limiter at all; they hit the blocklist. So the `rate-limit` counter freezes while > reach the rate limiter at all; they hit the blocklist. So the `rate-limit` counter freezes while
> `blocklist-auto` keeps climbing, and continued probing simply confirms the block rather than measuring it. > `blocklist-auto` keeps climbing, and continued probing simply confirms the block rather than measuring it.
@@ -2754,7 +2775,8 @@ Each site keeps its own access log (its public traffic) and audit log (its manag
- `runway.logs.queue-capacity` (default `8192`, at least `16`) — log lines wait in a queue between the request and - `runway.logs.queue-capacity` (default `8192`, at least `16`) — log lines wait in a queue between the request and
the disk, so a slow disk never slows a page. When the queue is full, new lines are **dropped**, not waited for: the disk, so a slow disk never slows a page. When the queue is full, new lines are **dropped**, not waited for:
the count is the `runway_logs_dropped` metric (and the Logs screen), and a `WARN` *"site log queue saturated"* is the count is the `runway_logs_dropped` metric (and the Logs screen), and a `WARN` *"site log queue saturated"* is
logged at most once a minute. Raise it if that count grows; each queued line takes a little memory. logged at most once a minute. An eighth of the queue is held for audit lines (sign-ins, changes), so a flood of
public requests drops access lines first. Raise it if that count grows; each queued line takes a little memory.
### Bandwidth metering (`runway.bandwidth.*`) ### Bandwidth metering (`runway.bandwidth.*`)
+11 -2
View File
@@ -223,7 +223,9 @@ is written **only in detached launcher mode** — the supervisor appends the JVM
usually empty; do not go looking for application logs there when running as a service. usually empty; do not go looking for application logs there when running as a service.
**The public access log.** One line is emitted per **public** request under the logger **The public access log.** One line is emitted per **public** request under the logger
`runway.access`, from the innermost filter (so the status is final): `runway.access`, written once every filter and handler has finished with it, so with the status it was answered
with (the one exception: an error escaping a plugin's own controller is logged with the status set before it,
while the client receives `500`):
``` ```
203.0.113.7 GET /about -> 200 (12ms) 203.0.113.7 GET /about -> 200 (12ms)
@@ -237,6 +239,13 @@ fetch will **not** appear here; that is by design (this is a traffic log, not an
client IP is the gated one (from a trusted forwarded header only — see Administration §7), never a client IP is the gated one (from a trusted forwarded header only — see Administration §7), never a
raw spoofable header. raw spoofable header.
It records **every** public request that gets past the protection edge (§3.1), whoever answers it: a page, a
plugin's route (`robots.txt`, the sitemap, a form), the sign-in form (every login attempt, successful or not, and
a form post refused for its missing token, `403`), an oversized form refused unread (`413`), a suspended, maintenance or over-quota site (`503`), and a
request body refused for arriving too slowly (`408`). Before 1.1.2 every one of these except the page was missing,
because the log was written by the innermost filter and each of them is answered by a filter outside it. Only the
edge's own `403`/`429` stay out: those go to `runway.protect` (§3.1).
**What to grep for** (systemd, hence `journalctl`): **What to grep for** (systemd, hence `journalctl`):
```bash ```bash
@@ -302,7 +311,7 @@ rejections, §3.1); everything else logs under its package, `mx.quest.runway.*`.
### 3.1 Seeing what the edge rejected ### 3.1 Seeing what the edge rejected
A request the protection edge turns away is rejected at `FilterOrder.CORE_PROTECTION` — the outermost slot — A request the protection edge turns away is rejected at `FilterOrder.CORE_PROTECTION` — the outermost slot —
and the chain is never called. The access log lives at the innermost slot. So a `403`/`429` from the edge and the chain is never called. The access log sits just inside that slot, so a `403`/`429` from the edge
**appears in no other log**, and without a log of its own a site manager would have no way to tell that a **appears in no other log**, and without a log of its own a site manager would have no way to tell that a
crawler was being throttled. crawler was being throttled.
+3 -1
View File
@@ -738,7 +738,9 @@ You declare a **`FilterBand` + a small offset** — never a raw order. The kerne
escape its band to preempt the protection floor or run before security. The bands (outermost → escape its band to preempt the protection floor or run before security. The bands (outermost →
innermost) are `EDGE_INGRESS` (raw request, pre-security), `EDGE_EGRESS` (response rewriting), innermost) are `EDGE_INGRESS` (raw request, pre-security), `EDGE_EGRESS` (response rewriting),
`TENANT` (after the site is resolved, before security), `APPLICATION` (feature filters, inner of `TENANT` (after the site is resolved, before security), `APPLICATION` (feature filters, inner of
security; the default). **`SECURITY` is not contributable** — it belongs to the kernel's realm security; the default). The kernel's access log sits between `EDGE_INGRESS` and the rest: whatever an
`EDGE_EGRESS`, `TENANT` or `APPLICATION` filter answers is logged with its status, while a request an
`EDGE_INGRESS` filter turns away is not (log it yourself, throttled, if you need to). **`SECURITY` is not contributable** — it belongs to the kernel's realm
security chains, and (as above) a non-essential plugin may not declare a `SecurityFilterChain` bean either. security chains, and (as above) a non-essential plugin may not declare a `SecurityFilterChain` bean either.
**Verify:** the boot log prints one line per plugin filter — **Verify:** the boot log prints one line per plugin filter —
+1 -1
View File
@@ -47,7 +47,7 @@ How large a request may be. Applies after a restart.
| Setting | Key | What it does | Values | | Setting | Key | What it does | Values |
|---|---|---|---| |---|---|---|---|
| Largest request before sign-in (bytes) | `runway.endpoints.max-form-bytes` | The most a visitor who is not signed in may send in one request, on any path. Default 262144 (256 KiB). | whole number from 1024 to 104857600; default `262144` | | Largest request before sign-in (bytes) | `runway.endpoints.max-form-bytes` | The most a visitor who is not signed in may send in one request, on any path. Default 262144 (256 KiB). | whole number from 1024 to 104857600; default `262144` |
| Slowest request body (bytes per second) *(Advanced)* | `runway.http.min-request-data-rate` | A request body arriving more slowly is answered 408 Request Timeout, so a client sending a byte now and then cannot hold a request thread. Measured on what has arrived since the body's first byte. Default 4096; 0 turns the check off. | whole number from 0 to 1048576; default `4096` | | Slowest request body (bytes per second) *(Advanced)* | `runway.http.min-request-data-rate` | A request body arriving more slowly is answered 408 Request Timeout: login and other forms, uploads and raw bodies alike, so a client sending a byte now and then cannot keep a request thread. Only time spent waiting for the client counts, and a body that has arrived complete is never refused. Sending part of a body fast earns at most 30 seconds of waiting. Default 4096; 0 turns the check off. | whole number from 0 to 1048576; default `4096` |
| Largest request to a plugin (bytes) | `runway.endpoints.max-body-bytes` | The most a signed-in user may send to a plugin's route. Default 10485760 (10 MiB). | whole number from 1024 to 1073741824; default `10485760` | | Largest request to a plugin (bytes) | `runway.endpoints.max-body-bytes` | The most a signed-in user may send to a plugin's route. Default 10485760 (10 MiB). | whole number from 1024 to 1073741824; default `10485760` |
| Largest uploaded file | `spring.servlet.multipart.max-file-size` | For uploads such as a backup to restore. A size like 256MB or 1GB. Default 256MB. | text; default `256MB` | | Largest uploaded file | `spring.servlet.multipart.max-file-size` | For uploads such as a backup to restore. A size like 256MB or 1GB. Default 256MB. | text; default `256MB` |
| Largest upload request | `spring.servlet.multipart.max-request-size` | All the files of one upload together. A size like 256MB. Default 256MB. | text; default `256MB` | | Largest upload request | `spring.servlet.multipart.max-request-size` | All the files of one upload together. A size like 256MB. Default 256MB. | text; default `256MB` |
+6 -4
View File
@@ -230,7 +230,8 @@ name or the default language. While no field is set and no manifest icon (192, 5
`/manifest.webmanifest` answers 404 and pages do not link to it. `/manifest.webmanifest` answers 404 and pages do not link to it.
The **Logs** screen (`/__admin/logs`) shows your site's own **access log** (public traffic — the most recent The **Logs** screen (`/__admin/logs`) shows your site's own **access log** (public traffic — the most recent
lines) and its **audit journal**: who did what on your site, and when. The journal records sign-ins lines; every sign-in attempt on your site's login page is there too, as a `POST /login`, and so is a request your
site refused, such as a `503` while it is in maintenance) and its **audit journal**: who did what on your site, and when. The journal records sign-ins
(`login.success`, `login.failure`) and sign-outs (`logout`), each with the address it came from (`ip=…`, in full: (`login.success`, `login.failure`) and sign-outs (`logout`), each with the address it came from (`ip=…`, in full:
the anonymizing setting below applies to the access log only); password recovery through an emailed link the anonymizing setting below applies to the access log only); password recovery through an emailed link
(`recovery.requested`, `recovery.completed`); page changes (`page.saved`, `page.deleted`, `page.published`, (`recovery.requested`, `recovery.completed`); page changes (`page.saved`, `page.deleted`, `page.published`,
@@ -1184,10 +1185,10 @@ two lists, for the **last 7 or 30 days** (never longer than your log retention
with a corrected link, the missing page or file, or a redirect from the old address. with a corrected link, the missing page or file, or a redirect from the old address.
- **Most-visited pages** — your pages by how often they were successfully viewed, with when last. - **Most-visited pages** — your pages by how often they were successfully viewed, with when last.
**What it counts.** Only `GET` requests (a form post or a crawler's `HEAD` is not a visit). A **page view** is a **What it counts.** Only `GET` requests (a form post, a sign-in attempt or a crawler's `HEAD` is not a visit). A **page view** is a
successful (2xx) answer for an address that looks like a page — no file extension in the last part, or `.html` successful (2xx) answer for an address that looks like a page — no file extension in the last part, or `.html`
— so stylesheets, images, downloads, `robots.txt` and the sitemap are left out; a browser re-checking a page it — so stylesheets, images, downloads, `robots.txt` and the sitemap are left out; a browser re-checking a page it
already has (a `304`) is not a new view. A **404** counts for any address, images included, because a missing already has (a `304`) is not a new view, and neither is a refusal (a `403`, or a `503` during maintenance). A **404** counts for any address, images included, because a missing
image is a broken link too. Addresses are shown **without their query string** (`/search?q=…` counts as image is a broken link too. Addresses are shown **without their query string** (`/search?q=…` counts as
`/search`), and very long ones are shortened on screen (hover to see the whole stored address). `/search`), and very long ones are shortened on screen (hover to see the whole stored address).
@@ -1326,7 +1327,8 @@ Restore is safe by design: the platform first checks the file is a genuine, comp
backup and only then swaps it in, in one step. **A corrupt, empty, or wrong file is rejected backup and only then swaps it in, in one step. **A corrupt, empty, or wrong file is rejected
and your live site is left exactly as it was** — a failed or interrupted restore never leaves and your live site is left exactly as it was** — a failed or interrupted restore never leaves
you with a half-restored or missing site. After a successful restore the site reflects the you with a half-restored or missing site. After a successful restore the site reflects the
backup immediately (no restart). backup immediately (no restart), and the Backups screen shows the site's host names and base URL for you to check: a restore made here keeps them as
they were (how the site is reached is set by the platform operator), so if they look wrong, ask the operator.
A backup made on a **newer** version of the platform than the one your site runs on is refused A backup made on a **newer** version of the platform than the one your site runs on is refused
the same way, with the message *"This backup was made by a newer version of Runway … Ask the the same way, with the message *"This backup was made by a newer version of Runway … Ask the
+2 -2
View File
@@ -13,7 +13,7 @@
<groupId>mx.quest</groupId> <groupId>mx.quest</groupId>
<artifactId>runway</artifactId> <artifactId>runway</artifactId>
<version>1.1.0</version> <version>1.1.2</version>
<packaging>pom</packaging> <packaging>pom</packaging>
<name>Runway</name> <name>Runway</name>
@@ -42,7 +42,7 @@
extended timestamp through the build JVM's default time zone, so the same source built in CST and extended timestamp through the build JVM's default time zone, so the same source built in CST and
in UTC differed by exactly 6 h inside the exec jar (found 2026-10-17 on a second host). in UTC differed by exactly 6 h inside the exec jar (found 2026-10-17 on a second host).
.mvn/jvm.config pins -Duser.timezone=UTC for the Maven JVM, which removes the host's zone. --> .mvn/jvm.config pins -Duser.timezone=UTC for the Maven JVM, which removes the host's zone. -->
<project.build.outputTimestamp>2026-10-29T15:02:00Z</project.build.outputTimestamp> <project.build.outputTimestamp>2026-10-29T18:30:00Z</project.build.outputTimestamp>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<!-- runway-spi and runway-spi-testkit attach a sources jar (release assets for third-party plugin authors, <!-- runway-spi and runway-spi-testkit attach a sources jar (release assets for third-party plugin authors,
docs/PLUGIN-DEVELOPMENT.md §3). Boot's parent manages 3.3.1; 3.4.0 is the version the build hosts' docs/PLUGIN-DEVELOPMENT.md §3). Boot's parent manages 3.3.1; 3.4.0 is the version the build hosts'
+1 -1
View File
@@ -7,7 +7,7 @@
<parent> <parent>
<groupId>mx.quest</groupId> <groupId>mx.quest</groupId>
<artifactId>runway</artifactId> <artifactId>runway</artifactId>
<version>1.1.0</version> <version>1.1.2</version>
</parent> </parent>
<artifactId>runway-app</artifactId> <artifactId>runway-app</artifactId>
@@ -49,10 +49,13 @@ public class AppBackupsController {
private final AppActivityLog activity; private final AppActivityLog activity;
private final mx.quest.runway.backup.BackupProperties policy; private final mx.quest.runway.backup.BackupProperties policy;
private final mx.quest.runway.platform.PlatformSettingsStore platform;
public AppBackupsController(SiteStore sites, BackupService backups, PlatformAuthority platformAuthority, public AppBackupsController(SiteStore sites, BackupService backups, PlatformAuthority platformAuthority,
@Qualifier("operatorAwareMessageSource") MessageSource messages, @Qualifier("operatorAwareMessageSource") MessageSource messages,
AppActivityLog activity, mx.quest.runway.backup.BackupProperties policy) { AppActivityLog activity, mx.quest.runway.backup.BackupProperties policy,
mx.quest.runway.platform.PlatformSettingsStore platform) {
this.platform = platform;
this.policy = policy; this.policy = policy;
this.sites = sites; this.sites = sites;
this.backups = backups; this.backups = backups;
@@ -61,6 +64,9 @@ public class AppBackupsController {
this.activity = activity; this.activity = activity;
} }
/** Flash attribute naming the site whose hosts the Backups screen shows for review after a restore. */
static final String REVIEW_HOSTS = "reviewHostsOf";
/** One site row: its id and the backups stored for it on the server. */ /** One site row: its id and the backups stored for it on the server. */
public record SiteBackups(String siteId, List<StoredBackup> stored) { public record SiteBackups(String siteId, List<StoredBackup> stored) {
} }
@@ -73,6 +79,15 @@ public class AppBackupsController {
rows.add(new SiteBackups(site.id(), backups.list(site.id()))); rows.add(new SiteBackups(site.id(), backups.list(site.id())));
} }
model.addAttribute("rows", rows); model.addAttribute("rows", rows);
// After a restore (or a site created from a backup), how the site is reached now: the hosts and base URL may
// have come from the backup, so they are shown for review with the editor, read from the store as they stand.
if (model.getAttribute(REVIEW_HOSTS) instanceof String reviewed) {
sites.find(reviewed).ifPresent(site -> {
model.addAttribute("reviewSite", site);
// A site with no host is reached only if it is the default (catch-all) site; otherwise not at all.
model.addAttribute("reviewIsDefault", platform.get().defaultSite().filter(reviewed::equals).isPresent());
});
}
// Shown, not edited: a server folder that receives every site's archives is the host's (settings-homes.yml). // Shown, not edited: a server folder that receives every site's archives is the host's (settings-homes.yml).
String offsite = policy.getOffsiteDir(); String offsite = policy.getOffsiteDir();
model.addAttribute("offsiteDir", offsite == null || offsite.isBlank() ? null : offsite.trim()); model.addAttribute("offsiteDir", offsite == null || offsite.isBlank() ? null : offsite.trim());
@@ -136,6 +151,7 @@ public class AppBackupsController {
backups.restore(siteId, in); backups.restore(siteId, in);
activity.record(authentication.getName(), "site.restored", siteId + " (upload)"); activity.record(authentication.getName(), "site.restored", siteId + " (upload)");
redirect.addFlashAttribute("flash", message("op.appbackups.restored", "Site restored.")); redirect.addFlashAttribute("flash", message("op.appbackups.restored", "Site restored."));
redirect.addFlashAttribute(REVIEW_HOSTS, siteId);
} catch (UnsupportedBackupFormatException e) { } catch (UnsupportedBackupFormatException e) {
redirect.addFlashAttribute("error", newerFormat(e)); redirect.addFlashAttribute("error", newerFormat(e));
} catch (IOException | RuntimeException e) { } catch (IOException | RuntimeException e) {
@@ -154,6 +170,7 @@ public class AppBackupsController {
backups.restoreStored(siteId, name); backups.restoreStored(siteId, name);
activity.record(authentication.getName(), "site.restored", siteId + "/" + name); activity.record(authentication.getName(), "site.restored", siteId + "/" + name);
redirect.addFlashAttribute("flash", message("op.appbackups.restored", "Site restored.")); redirect.addFlashAttribute("flash", message("op.appbackups.restored", "Site restored."));
redirect.addFlashAttribute(REVIEW_HOSTS, siteId);
} catch (UnsupportedBackupFormatException e) { } catch (UnsupportedBackupFormatException e) {
redirect.addFlashAttribute("error", newerFormat(e)); redirect.addFlashAttribute("error", newerFormat(e));
} catch (IOException | RuntimeException e) { } catch (IOException | RuntimeException e) {
@@ -196,6 +213,7 @@ public class AppBackupsController {
backups.createFromBackup(newId.strip(), name, splitHosts(hosts), in); backups.createFromBackup(newId.strip(), name, splitHosts(hosts), in);
activity.record(authentication.getName(), "site.created-from-backup", newId.strip()); activity.record(authentication.getName(), "site.created-from-backup", newId.strip());
redirect.addFlashAttribute("flash", message("op.appbackups.created", "Site created from backup.")); redirect.addFlashAttribute("flash", message("op.appbackups.created", "Site created from backup."));
redirect.addFlashAttribute(REVIEW_HOSTS, newId.strip());
} catch (UnsupportedBackupFormatException e) { } catch (UnsupportedBackupFormatException e) {
redirect.addFlashAttribute("error", newerFormat(e)); redirect.addFlashAttribute("error", newerFormat(e));
} catch (IllegalStateException e) { } catch (IllegalStateException e) {
@@ -61,10 +61,13 @@ public class TenantBackupsController {
private final TenantAuthority tenantAuthority; private final TenantAuthority tenantAuthority;
private final MessageSource messages; private final MessageSource messages;
private final mx.quest.runway.backup.BackupProperties policy; private final mx.quest.runway.backup.BackupProperties policy;
private final mx.quest.runway.platform.PlatformSettingsStore platform;
public TenantBackupsController(SiteResolver siteResolver, BackupService backups, TenantAuthority tenantAuthority, public TenantBackupsController(SiteResolver siteResolver, BackupService backups, TenantAuthority tenantAuthority,
@Qualifier("operatorAwareMessageSource") MessageSource messages, @Qualifier("operatorAwareMessageSource") MessageSource messages,
mx.quest.runway.backup.BackupProperties policy) { mx.quest.runway.backup.BackupProperties policy,
mx.quest.runway.platform.PlatformSettingsStore platform) {
this.platform = platform;
this.policy = policy; this.policy = policy;
this.siteResolver = siteResolver; this.siteResolver = siteResolver;
this.backups = backups; this.backups = backups;
@@ -84,6 +87,12 @@ public class TenantBackupsController {
model.addAttribute("backupPolicyKeepKey", "op.backups.policy.keep." model.addAttribute("backupPolicyKeepKey", "op.backups.policy.keep."
+ (count > 0 ? "count" : "all") + (days > 0 ? "Days" : "")); + (count > 0 ? "count" : "all") + (days > 0 ? "Days" : ""));
model.addAttribute("transferOmissions", transferOmissions(site.id())); model.addAttribute("transferOmissions", transferOmissions(site.id()));
// After a restore: how the site is reached, for review. A restore from this console keeps the hosts and base URL
// (only the application console changes them), so they are shown as they stand, without an editor.
if (Boolean.TRUE.equals(model.getAttribute(AppBackupsController.REVIEW_HOSTS))) {
model.addAttribute("reviewSite", site);
model.addAttribute("reviewIsDefault", platform.get().defaultSite().filter(site.id()::equals).isPresent());
}
// Restore is destructive + master-only; hide its affordances from a non-master (the controller still enforces). // Restore is destructive + master-only; hide its affordances from a non-master (the controller still enforces).
boolean admin = tenantAuthority.isTenantAdmin(authentication, site.id()); boolean admin = tenantAuthority.isTenantAdmin(authentication, site.id());
model.addAttribute("canRestore", admin); model.addAttribute("canRestore", admin);
@@ -196,6 +205,7 @@ public class TenantBackupsController {
try { try {
backups.restoreStored(site.id(), name, true); // a site manager never changes how the site is reached backups.restoreStored(site.id(), name, true); // a site manager never changes how the site is reached
redirect.addFlashAttribute("flash", message("op.backups.restored", "Site restored from the backup.")); redirect.addFlashAttribute("flash", message("op.backups.restored", "Site restored from the backup."));
redirect.addFlashAttribute(AppBackupsController.REVIEW_HOSTS, Boolean.TRUE);
} catch (UnsupportedBackupFormatException e) { } catch (UnsupportedBackupFormatException e) {
redirect.addFlashAttribute("error", newerFormat(e)); redirect.addFlashAttribute("error", newerFormat(e));
} catch (IOException | RuntimeException e) { } catch (IOException | RuntimeException e) {
@@ -218,6 +228,7 @@ public class TenantBackupsController {
try (InputStream in = file.getInputStream()) { try (InputStream in = file.getInputStream()) {
backups.restore(site.id(), in, true); // a site manager never changes how the site is reached backups.restore(site.id(), in, true); // a site manager never changes how the site is reached
redirect.addFlashAttribute("flash", message("op.backups.restored", "Site restored from the backup.")); redirect.addFlashAttribute("flash", message("op.backups.restored", "Site restored from the backup."));
redirect.addFlashAttribute(AppBackupsController.REVIEW_HOSTS, Boolean.TRUE);
} catch (UnsupportedBackupFormatException e) { } catch (UnsupportedBackupFormatException e) {
redirect.addFlashAttribute("error", newerFormat(e)); redirect.addFlashAttribute("error", newerFormat(e));
} catch (IOException | RuntimeException e) { } catch (IOException | RuntimeException e) {
@@ -6,14 +6,16 @@ import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse; import jakarta.servlet.http.HttpServletResponse;
import java.io.IOException; import java.io.IOException;
import java.util.Set; import java.util.Set;
import mx.quest.runway.web.FilterOrder;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.ObjectProvider; import org.springframework.beans.factory.ObjectProvider;
import org.springframework.boot.servlet.filter.OrderedFormContentFilter; import org.springframework.boot.servlet.filter.OrderedFormContentFilter;
/** /**
* Spring Boot's {@code FormContentFilter}, minus plugin routes. Boot registers that filter outermost (order * Spring Boot's {@code FormContentFilter}, minus plugin routes. Boot registers that filter early (order
* {@code -9900}) so a {@code PUT}/{@code PATCH}/{@code DELETE} form body becomes request parameters for * {@code -9900}; Runway places it at {@link FilterOrder#CORE_FORM_CONTENT}, inside the access log and the site
* binding, so its {@code 413} is logged for the site) so a {@code PUT}/{@code PATCH}/{@code DELETE} form body becomes request parameters for
* {@code @RequestParam}; it does that by <b>reading the body</b>, so a plugin route used to receive an empty * {@code @RequestParam}; it does that by <b>reading the body</b>, so a plugin route used to receive an empty
* {@code RouteRequest.form()} and {@code body()} for those methods — and a {@code _csrf} field in such a body was not * {@code RouteRequest.form()} and {@code body()} for those methods — and a {@code _csrf} field in such a body was not
* found either ({@code RouteBodyMethodsE2ETest}). A request whose method and path match a registered route * found either ({@code RouteBodyMethodsE2ETest}). A request whose method and path match a registered route
@@ -51,6 +53,7 @@ public class RouteAwareFormContentFilter extends OrderedFormContentFilter {
public RouteAwareFormContentFilter(ObjectProvider<EndpointContributorRegistry> registry, long cap) { public RouteAwareFormContentFilter(ObjectProvider<EndpointContributorRegistry> registry, long cap) {
this.registry = registry; this.registry = registry;
this.cap = Math.max(0, cap); this.cap = Math.max(0, cap);
setOrder(FilterOrder.CORE_FORM_CONTENT);
} }
@Override @Override
@@ -1,6 +1,5 @@
package mx.quest.runway.log; package mx.quest.runway.log;
import mx.quest.runway.site.SiteResolver;
import mx.quest.runway.web.FilterOrder; import mx.quest.runway.web.FilterOrder;
import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.boot.web.servlet.FilterRegistrationBean; import org.springframework.boot.web.servlet.FilterRegistrationBean;
@@ -8,19 +7,18 @@ import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
/** /**
* Registers {@link AccessLogFilter} as the innermost filter ({@link FilterOrder#CORE_ACCESS_LOG}), so its * Registers {@link AccessLogFilter} at {@link FilterOrder#CORE_ACCESS_LOG}, just inside the abuse floor, so it logs
* post-phase observes the final response status of every public request, and enables {@link LogProperties}. * every public request the floor lets through with its final status, and enables {@link LogProperties}.
*/ */
@Configuration(proxyBeanMethods = false) @Configuration(proxyBeanMethods = false)
@EnableConfigurationProperties(LogProperties.class) @EnableConfigurationProperties(LogProperties.class)
public class AccessLogConfig { public class AccessLogConfig {
@Bean @Bean
public FilterRegistrationBean<AccessLogFilter> accessLogFilterRegistration(SiteResolver siteResolver, public FilterRegistrationBean<AccessLogFilter> accessLogFilterRegistration(SiteLogService siteLog,
SiteLogService siteLog,
LogProperties properties) { LogProperties properties) {
FilterRegistrationBean<AccessLogFilter> registration = new FilterRegistrationBean<>( FilterRegistrationBean<AccessLogFilter> registration = new FilterRegistrationBean<>(
new AccessLogFilter(siteResolver, siteLog, properties.isAccessLogUserAgent())); new AccessLogFilter(siteLog, properties.isAccessLogUserAgent()));
registration.setOrder(FilterOrder.CORE_ACCESS_LOG); registration.setOrder(FilterOrder.CORE_ACCESS_LOG);
registration.addUrlPatterns("/*"); registration.addUrlPatterns("/*");
registration.setName("accessLogFilter"); registration.setName("accessLogFilter");
@@ -5,8 +5,7 @@ import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse; import jakarta.servlet.http.HttpServletResponse;
import java.io.IOException; import java.io.IOException;
import mx.quest.runway.site.Site; import mx.quest.runway.site.SiteContextFilter;
import mx.quest.runway.site.SiteResolver;
import mx.quest.runway.web.ClientIp; import mx.quest.runway.web.ClientIp;
import mx.quest.runway.web.LogSafe; import mx.quest.runway.web.LogSafe;
import mx.quest.runway.web.RequestPaths; import mx.quest.runway.web.RequestPaths;
@@ -15,9 +14,16 @@ import org.slf4j.LoggerFactory;
import org.springframework.web.filter.OncePerRequestFilter; import org.springframework.web.filter.OncePerRequestFilter;
/** /**
* The innermost filter ({@code FilterOrder.CORE_ACCESS_LOG}): it logs one event per <b>public</b> request from * The access log: one event per <b>public</b> request, written from its {@code post} phase, once every inner filter
* its {@code post} phase, so it observes the <b>final</b> status set by every inner filter and the handler. * and the handler have finished, so the status it records is the one the request was answered with. (The exception:
* Being innermost is the whole point — an outer position would log a not-yet-decided status. * an exception escaping the chain, which only a plugin's own MVC controller can let through, is logged with the
* status set before it, while the container answers {@code 500}.) It sits at {@code FilterOrder.CORE_ACCESS_LOG}, just inside the abuse floor and outside every
* other filter, so it sees every request the floor lets through however it is answered: by a page, an endpoint
* route, Spring Security (a login attempt, a CSRF {@code 403}), a tenant gate (a suspended or over-quota site's
* {@code 503}), a refused slow body ({@code 408}) or an oversized form refused unread ({@code 413}). A filter that answers without calling the chain is invisible
* to every filter inside it, which is why this one is not innermost: there, until 1.1.2, a password-guessing run
* against a site's login left no line at all. Rejections by the floor itself are reported, throttled, by
* {@code EdgeRejectionRecorder} instead.
* *
* <p>It is a <b>public-traffic</b> log, not an audit trail: it skips the internal surfaces (anything under * <p>It is a <b>public-traffic</b> log, not an audit trail: it skips the internal surfaces (anything under
* {@code /__…} — the app/admin/preview/assets/CSP-report consoles — plus {@code /app/…} and {@code /actuator}), * {@code /__…} — the app/admin/preview/assets/CSP-report consoles — plus {@code /app/…} and {@code /actuator}),
@@ -25,29 +31,24 @@ import org.springframework.web.filter.OncePerRequestFilter;
* {@link ClientIp#of} (never a raw forwarded header). * {@link ClientIp#of} (never a raw forwarded header).
* *
* <p>It emits to two sinks: the operator's {@code runway.access} SLF4J logger (the whole-platform stream), and — * <p>It emits to two sinks: the operator's {@code runway.access} SLF4J logger (the whole-platform stream), and —
* when a site is bound (a public tenant request) — that site's own {@link SiteLogService#access per-site access * when a site answered (a public tenant request) — that site's own {@link SiteLogService#access per-site access
* log}. This filter runs <em>inside</em> the site-context filter, so the tenant binding is still live in the * log}. The site is read from the {@link SiteContextFilter#SITE_ID_ATTRIBUTE request attribute} the site-context
* post phase. * filter leaves, not from {@code SiteResolver.current()}: that filter is inner of this one and has cleared its
* thread binding by the time this {@code post} runs. A request refused before the site is resolved has no site and
* goes to the platform log only.
*/ */
public class AccessLogFilter extends OncePerRequestFilter { public class AccessLogFilter extends OncePerRequestFilter {
private static final Logger log = LoggerFactory.getLogger("runway.access"); private static final Logger log = LoggerFactory.getLogger("runway.access");
private final SiteResolver siteResolver;
private final SiteLogService siteLog; private final SiteLogService siteLog;
private final boolean logUserAgent; private final boolean logUserAgent;
public AccessLogFilter(SiteResolver siteResolver, SiteLogService siteLog, boolean logUserAgent) { public AccessLogFilter(SiteLogService siteLog, boolean logUserAgent) {
this.siteResolver = siteResolver;
this.siteLog = siteLog; this.siteLog = siteLog;
this.logUserAgent = logUserAgent; this.logUserAgent = logUserAgent;
} }
/** Pre-{@code logUserAgent} form, kept so existing call sites (and tests) compile unchanged: agent off. */
public AccessLogFilter(SiteResolver siteResolver, SiteLogService siteLog) {
this(siteResolver, siteLog, false);
}
@Override @Override
protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain chain) protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain chain)
throws ServletException, IOException { throws ServletException, IOException {
@@ -69,9 +70,8 @@ public class AccessLogFilter extends OncePerRequestFilter {
log.info("{} {} {} -> {} ({}ms)", ip, request.getMethod(), log.info("{} {} {} -> {} ({}ms)", ip, request.getMethod(),
request.getRequestURI(), response.getStatus(), millis); request.getRequestURI(), response.getStatus(), millis);
} }
Site site = siteResolver.current().orElse(null); if (request.getAttribute(SiteContextFilter.SITE_ID_ATTRIBUTE) instanceof String siteId) {
if (site != null) { siteLog.access(siteId, ip, request.getMethod(), request.getRequestURI(), response.getStatus());
siteLog.access(site.id(), ip, request.getMethod(), request.getRequestURI(), response.getStatus());
} }
} }
} }
@@ -62,6 +62,14 @@ public class SiteLogService {
private final SiteLogConfigService configs; private final SiteLogConfigService configs;
private final LogProperties props; private final LogProperties props;
private final BlockingQueue<LogEvent> queue; private final BlockingQueue<LogEvent> queue;
/**
* Queue slots only audit events may take. Access and audit lines share the queue, and a flood that gets past the
* protection edge (a credential-stuffing run, two events per attempt) would otherwise drop audit lines, the
* {@code login.failure} records that are the evidence of that very attack, as often as access lines. With an
* eighth of the queue held back, access lines are dropped first.
*/
private final int auditReserve;
static final int AUDIT_RESERVE_DIVISOR = 8;
private final AtomicLong dropped = new AtomicLong(); private final AtomicLong dropped = new AtomicLong();
private static final long DROP_WARN_INTERVAL_MS = 60_000L; private static final long DROP_WARN_INTERVAL_MS = 60_000L;
private volatile long lastDropWarnAt; private volatile long lastDropWarnAt;
@@ -73,7 +81,9 @@ public class SiteLogService {
this.layout = layout; this.layout = layout;
this.configs = configs; this.configs = configs;
this.props = props; this.props = props;
this.queue = new ArrayBlockingQueue<>(Math.max(16, props.getQueueCapacity())); int capacity = Math.max(16, props.getQueueCapacity());
this.queue = new ArrayBlockingQueue<>(capacity);
this.auditReserve = capacity / AUDIT_RESERVE_DIVISOR;
} }
@PostConstruct @PostConstruct
@@ -113,6 +123,16 @@ public class SiteLogService {
List.of(clean(actor), clean(action), clean(detail)))); List.of(clean(actor), clean(action), clean(detail))));
} }
/** Accepts events without starting the writer, so a test can fill the queue. */
void acceptWithoutWriting() {
running = true;
}
/** Events waiting to be written (tests). */
int queued() {
return queue.size();
}
/** The number of events dropped because the queue was full (best-effort observability). */ /** The number of events dropped because the queue was full (best-effort observability). */
public long droppedCount() { public long droppedCount() {
return dropped.get(); return dropped.get();
@@ -219,7 +239,9 @@ public class SiteLogService {
if (!running) { if (!running) {
return; return;
} }
if (!queue.offer(event)) { boolean accepted = event.kind() == LogKind.ACCESS && queue.remainingCapacity() <= auditReserve
? false : queue.offer(event);
if (!accepted) {
long total = dropped.incrementAndGet(); long total = dropped.incrementAndGet();
// A saturated queue silently losing events (audit lines included) is exactly what an operator needs // A saturated queue silently losing events (audit lines included) is exactly what an operator needs
// told — but the drop path must stay non-blocking and un-spammy, so warn at most once a minute. // told — but the drop path must stay non-blocking and un-spammy, so warn at most once a minute.
@@ -15,9 +15,9 @@ import org.slf4j.LoggerFactory;
* <h2>The blind spot this closes</h2> * <h2>The blind spot this closes</h2>
* {@link EdgeRejectFilter} sits at {@code FilterOrder.CORE_PROTECTION}, the outermost slot after the forwarded * {@link EdgeRejectFilter} sits at {@code FilterOrder.CORE_PROTECTION}, the outermost slot after the forwarded
* header gate, and a reject <b>does not call the chain</b>. {@code AccessLogFilter} sits at * header gate, and a reject <b>does not call the chain</b>. {@code AccessLogFilter} sits at
* {@code CORE_ACCESS_LOG}, the innermost. So every edge {@code 403}/{@code 429} short-circuits <i>before</i> * {@code CORE_ACCESS_LOG}, inside the floor (on purpose: see the throttling below). So every edge
* anything logs it: the request appears in no log anywhere in the product, and the access log never carried a * {@code 403}/{@code 429} short-circuits <i>before</i> anything logs it: without this recorder the request
* {@code User-Agent} to begin with. The practical result was that nobody could answer either half of the * appears in no log anywhere in the product, and the access log carries a {@code User-Agent} only when asked to. The practical result was that nobody could answer either half of the
* obvious question — <i>was a crawler throttled</i>, and <i>why was this request rejected</i>. * obvious question — <i>was a crawler throttled</i>, and <i>why was this request rejected</i>.
* *
* <p>A rejection is also emitted <b>before</b> {@code CORE_SITE_CONTEXT}, so there is no resolved site and it * <p>A rejection is also emitted <b>before</b> {@code CORE_SITE_CONTEXT}, so there is no resolved site and it
@@ -20,6 +20,7 @@ import org.springframework.core.Ordered;
* <pre> * <pre>
* CORE_FORWARDED Integer.MIN_VALUE EDGE_INGRESS TrustedForwardedHeaderFilter (gates X-Forwarded-*) * CORE_FORWARDED Integer.MIN_VALUE EDGE_INGRESS TrustedForwardedHeaderFilter (gates X-Forwarded-*)
* CORE_PROTECTION MIN_VALUE + 1 EDGE_INGRESS EdgeRejectFilter (the O(1) reject seam) * CORE_PROTECTION MIN_VALUE + 1 EDGE_INGRESS EdgeRejectFilter (the O(1) reject seam)
* CORE_ACCESS_LOG -500 (own slot) AccessLogFilter (one line per request past the floor)
* CORE_BANDWIDTH -300 EDGE_EGRESS BandwidthFilter (meters the on-the-wire bytes) * CORE_BANDWIDTH -300 EDGE_EGRESS BandwidthFilter (meters the on-the-wire bytes)
* CORE_SITE_METRICS -290 EDGE_EGRESS SiteRequestMetricsFilter (per-site request timing) * CORE_SITE_METRICS -290 EDGE_EGRESS SiteRequestMetricsFilter (per-site request timing)
* CORE_COMPRESSION -200 EDGE_EGRESS CompressionFilter (brotli / gzip, one decision) * CORE_COMPRESSION -200 EDGE_EGRESS CompressionFilter (brotli / gzip, one decision)
@@ -30,13 +31,13 @@ import org.springframework.core.Ordered;
* CORE_SITE_RELOAD 56 TENANT SiteReloadFilter (loopback /__reload/**) * CORE_SITE_RELOAD 56 TENANT SiteReloadFilter (loopback /__reload/**)
* CORE_CONSOLE_HOST 57 TENANT ConsoleHostFilter (operator console off site hosts) * CORE_CONSOLE_HOST 57 TENANT ConsoleHostFilter (operator console off site hosts)
* CORE_ROUTE_FORM_CAPTURE 58 TENANT RouteFormCaptureFilter (reads a plugin route's form body) * CORE_ROUTE_FORM_CAPTURE 58 TENANT RouteFormCaptureFilter (reads a plugin route's form body)
* CORE_FORM_CONTENT 59 TENANT RouteAwareFormContentFilter (PUT/PATCH/DELETE forms)
* CORE_SUSPENDED_SITE 60 TENANT SuspendedSiteFilter (503s a suspended tenant) * CORE_SUSPENDED_SITE 60 TENANT SuspendedSiteFilter (503s a suspended tenant)
* CORE_QUARANTINED_SITE 65 TENANT QuarantinedSiteFilter (503s a quarantined admin) * CORE_QUARANTINED_SITE 65 TENANT QuarantinedSiteFilter (503s a quarantined admin)
* CORE_MAINTENANCE 68 TENANT MaintenanceSiteFilter (503s a self-maintenance tenant) * CORE_MAINTENANCE 68 TENANT MaintenanceSiteFilter (503s a self-maintenance tenant)
* CORE_BANDWIDTH_LIMIT 69 TENANT BandwidthLimitFilter (503s a tenant over its quota) * CORE_BANDWIDTH_LIMIT 69 TENANT BandwidthLimitFilter (503s a tenant over its quota)
* CORE_EDGE_MODE 70 TENANT (reserved — read-only edge/replica topology, later) * CORE_EDGE_MODE 70 TENANT (reserved — read-only edge/replica topology, later)
* CORE_SECURITY 100 SECURITY the Spring Security FilterChainProxy * CORE_SECURITY 100 SECURITY the Spring Security FilterChainProxy
* CORE_ACCESS_LOG Integer.MAX_VALUE innermost AccessLogFilter (final status, post-chain)
* </pre> * </pre>
* *
* <h2>Why these values</h2> * <h2>Why these values</h2>
@@ -197,13 +198,33 @@ public final class FilterOrder {
/** /**
* The kernel route dispatcher for {@code EndpointContributor} routes (robots.txt, sitemap, …) — a terminal * The kernel route dispatcher for {@code EndpointContributor} routes (robots.txt, sitemap, …) — a terminal
* application handler, inner of the plugin APPLICATION window so a plugin filter can still wrap it. It * application handler, inner of the plugin APPLICATION window so a plugin filter can still wrap it. It
* short-circuits a matched route, so such responses are not seen by the (inner) access log — endpoint/bot * short-circuits a matched route; the access log, far outside it, still records the answer.
* traffic is a separate category from the public page access log.
*/ */
public static final int CORE_ENDPOINT_DISPATCH = Integer.MAX_VALUE - 100; public static final int CORE_ENDPOINT_DISPATCH = Integer.MAX_VALUE - 100;
/** {@code AccessLogFilter} — innermost, so its post observes the final status after every inner filter. */ /**
public static final int CORE_ACCESS_LOG = Ordered.LOWEST_PRECEDENCE; * {@code AccessLogFilter} — inner of the whole EDGE_INGRESS band (the kernel's reject floor and any plugin
* ingress filter) and outer of everything else, so every request that gets past the abuse floor is logged,
* whoever answers it: a tenant gate's {@code 503}, Spring Security (a login attempt, a CSRF {@code 403}), a
* slow body's {@code 408}, an endpoint route, a page. Its {@code post} runs after every inner filter has
* returned, so the status it reads is final.
*
* <p>Until 1.1.2 it sat innermost ({@code Integer.MAX_VALUE}), and every filter that answered without calling
* the chain answered unseen: a password-guessing run against a site's {@code /login} left no line at all.
* Floor rejections stay out on purpose: a flood the floor turns away in O(1) must not become a flood of log
* writes; {@code EdgeRejectionRecorder} reports them, throttled, under {@code runway.protect}.
*/
public static final int CORE_ACCESS_LOG = -500;
/**
* {@code RouteAwareFormContentFilter} (Boot's {@code FormContentFilter}, which parses a {@code PUT}/{@code PATCH}/
* {@code DELETE} form body into parameters, bounded). Boot's own order is {@code -9900}, outer of the access log,
* where its {@code 413} for an oversized body went unlogged. Here it is inner of the site binding, so the refusal
* is in that site's log too, and inner of {@link #CORE_ROUTE_FORM_CAPTURE}, which must read a route's body
* first; and outer of the tenant gates, every plugin TENANT filter and the security chain, which read
* parameters (the CSRF check above all).
*/
public static final int CORE_FORM_CONTENT = 59;
private FilterOrder() { private FilterOrder() {
} }
@@ -0,0 +1,167 @@
package mx.quest.runway.web;
import java.nio.ByteBuffer;
import org.eclipse.jetty.http.HttpException;
import org.eclipse.jetty.http.HttpStatus;
import org.eclipse.jetty.io.Content;
import org.eclipse.jetty.server.Handler;
import org.eclipse.jetty.server.Request;
import org.eclipse.jetty.server.Response;
import org.eclipse.jetty.util.Callback;
/**
* Refuses a request body that arrives more slowly than a minimum rate, on <b>every</b> read of the body: the
* servlet input stream, form parameters and multipart parts alike.
*
* <p><b>Why a handler of our own.</b> Jetty 12's own minimum request data rate is checked only where a servlet reads
* the body through {@code getInputStream()}. Form parameters ({@code getParameter}, which Spring Security's login
* reads) and multipart parts are parsed through Jetty's core request instead, and that path never checks it, so a
* client could trickle a form for as long as it kept sending something inside each idle interval, holding a request
* thread all the while. Measured on 1.1.0: form and multipart posts dripped at 20 bytes a second were held until the
* 30-second idle timeout. This handler sits under the server and wraps the core request, so every body read passes
* through it.
*
* <p><b>What is measured.</b> Only the time spent <em>waiting for the client</em>: from a read that found no data to
* the next one that did. Time the application spends before or between reads does not count, so a server that is
* slow to read is never blamed. The check keeps a balance: every byte received earns one, every second of waiting
* costs the rate's worth, and the balance is capped at {@link #CREDIT_SECONDS} of the rate, so a body sent fast at
* first cannot buy an hour of dripping later. It runs when data arrives: once the waiting time reaches one second and
* the balance is negative, the read fails with {@code 408 Request Timeout} and so does every later read. A client
* pausing between packets is therefore cut when its next packet arrives, at most one idle timeout later. A chunk that completes the body is never refused: once the client has finished, no thread
* is waiting on it any more, and a small form whose only packet arrived late (a network stall) is not punished for
* it; the body counts as complete at its last chunk or, with a {@code Content-Length}, at its last byte. A client that
* sends nothing at all is left to the connection idle timeout.
*
* <p>The refusal is answered {@code 408} however the application handled the failed read: a form or multipart parser
* would report it as {@code 400}, as if the body were malformed, and code reading the stream itself could leave an
* empty {@code 200} (see {@link RefusalStatusResponse}).
*/
final class RequestBodyRateHandler extends Handler.Wrapper {
/** Waiting shorter than this is never judged: a single network stall must not look like a slow client. */
static final long GRACE_NANOS = 1_000_000_000L;
/**
* The most waiting a body may have banked by arriving fast earlier: 30 seconds' worth of the rate, the connection
* idle timeout's default. Without a cap, a client that sent most of a large body at line speed and then dripped
* the rest could hold the thread for the body's size divided by the rate (16 MiB at 4 KiB/s: over an hour).
*/
static final long CREDIT_SECONDS = 30;
private final long bytesPerSecond;
private final long creditSeconds;
/** @param bytesPerSecond the slowest a body may arrive; must be positive (0 means "do not install") */
RequestBodyRateHandler(long bytesPerSecond) {
this(bytesPerSecond, CREDIT_SECONDS);
}
/** As {@link #RequestBodyRateHandler(long)}, with the credit cap in seconds (tests use a short one). */
RequestBodyRateHandler(long bytesPerSecond, long creditSeconds) {
if (bytesPerSecond <= 0 || creditSeconds <= 0) {
throw new IllegalArgumentException("rate and credit must be positive: " + bytesPerSecond + ", "
+ creditSeconds);
}
this.bytesPerSecond = bytesPerSecond;
this.creditSeconds = creditSeconds;
}
long bytesPerSecond() {
return bytesPerSecond;
}
@Override
public boolean handle(Request request, Response response, Callback callback) throws Exception {
RateCheckedRequest checked = new RateCheckedRequest(request, bytesPerSecond, creditSeconds);
return super.handle(checked, new RefusalStatusResponse(checked, response), callback);
}
/**
* Keeps the refusal's status. A form or multipart parser reports any failed read as {@code 400 Bad Request}
* ("unable to parse form content"), which would tell the client its body was malformed when it was only slow; and
* code that reads the stream itself lets the failure escape as an {@code IOException}, which Jetty handles like a
* client that went away, completing the response with the status it already had ({@code 200}, empty). Once this
* request's body was refused, a client error status set on the response becomes {@code 408}, and so does whatever
* status the response is committed with.
*/
private static final class RefusalStatusResponse extends Response.Wrapper {
private final RateCheckedRequest request;
RefusalStatusResponse(RateCheckedRequest request, Response wrapped) {
super(request, wrapped);
this.request = request;
}
@Override
public void write(boolean last, ByteBuffer content, Callback callback) {
if (request.refused != null && !isCommitted() && getStatus() != HttpStatus.REQUEST_TIMEOUT_408) {
super.setStatus(HttpStatus.REQUEST_TIMEOUT_408);
}
super.write(last, content, callback);
}
@Override
public void setStatus(int code) {
super.setStatus(request.refused != null && code >= 400 && code != HttpStatus.REQUEST_TIMEOUT_408
&& code < 500 ? HttpStatus.REQUEST_TIMEOUT_408 : code);
}
}
/** The request whose body reads are measured. Reads of one request are serial, as Jetty's demand model makes them. */
private static final class RateCheckedRequest extends Request.Wrapper {
private final long bytesPerSecond;
private final long creditCap;
private long received;
private long waitedNanos;
private long waitingSince = -1;
/** Bytes received minus the rate times the time waited, capped at {@link #creditCap}; negative = too slow. */
private long credit;
private Content.Chunk refused;
RateCheckedRequest(Request wrapped, long bytesPerSecond, long creditSeconds) {
super(wrapped);
this.bytesPerSecond = bytesPerSecond;
this.creditCap = bytesPerSecond * creditSeconds;
}
@Override
public Content.Chunk read() {
if (refused != null) {
return refused;
}
Content.Chunk chunk = super.read();
long now = System.nanoTime();
if (chunk == null) {
if (waitingSince < 0) {
waitingSince = now;
}
return null;
}
long waited = 0;
if (waitingSince >= 0) {
waited = now - waitingSince;
waitedNanos += waited;
waitingSince = -1;
}
if (Content.Chunk.isFailure(chunk)) {
return chunk;
}
int bytes = chunk.remaining();
received += bytes;
// Each byte earns credit and each second of waiting costs the rate's worth; earning is capped, so a body
// sent fast at first cannot bank more than CREDIT_SECONDS of waiting for a drip later.
credit = Math.min(creditCap, credit + bytes - bytesPerSecond * (waited / 1_000_000) / 1000);
boolean complete = chunk.isLast() || (getLength() >= 0 && received >= getLength());
if (!complete && waitedNanos >= GRACE_NANOS && credit < 0) {
chunk.release();
refused = Content.Chunk.from(new HttpException.RuntimeException(HttpStatus.REQUEST_TIMEOUT_408,
"request body slower than " + bytesPerSecond + " bytes/s"), true);
return refused;
}
return chunk;
}
}
}
@@ -16,15 +16,22 @@ import org.springframework.context.annotation.Configuration;
/** /**
* Keeps slow clients from holding request threads: a minimum rate for request bodies ({@code * Keeps slow clients from holding request threads: a minimum rate for request bodies ({@code
* runway.http.min-request-data-rate}, bytes per second; Settings → Server settings → Request limits), applied to every * runway.http.min-request-data-rate}, bytes per second; Settings → Server settings → Request limits), applied to every
* connector Jetty has when the server is built. * read of a request body by {@link RequestBodyRateHandler}, installed when the server is built.
* *
* <p><b>Why.</b> A servlet reads a request body on a request thread and blocks while it waits. Jetty's idle timeout * <p><b>Why.</b> A servlet reads a request body on a request thread and blocks while it waits. Jetty's idle timeout
* limits one stalled read, not the whole body, so a client that sends a byte inside every idle interval kept a thread * limits one stalled read, not the whole body, so a client that sends a byte inside every idle interval kept a thread
* for as long as it liked, and a few of them (with uploads allowed up to 256 MB) could take the pool. With a minimum * for as long as it liked, and a few of them (with uploads allowed up to 256 MB) could take the pool. With a minimum
* rate Jetty answers {@code 408 Request Timeout} as soon as the body has arrived more slowly than the rate since its * rate the request is answered {@code 408 Request Timeout} once the body arrives more slowly than the rate; time the
* first byte; time the application spends before reading does not count, because the rate is measured on what has * application spends before reading does not count. Measured on Jetty 12.1.8 with Runway 1.1.1: form, multipart and
* arrived. Measured on Jetty 12.1.8: a client sending one byte a second against 1 KiB/s was cut after about two * stream bodies dripped at 20 bytes a second against 4 KiB/s were answered {@code 408} after two seconds, on both
* seconds, and a server pausing three seconds before reading a body that arrived at once still answered {@code 200}. * login pages and a plugin's form route, and a server pausing three seconds before reading a body that arrived at
* once still answered {@code 200}.
*
* <p><b>One check, under every read.</b> Jetty's own minimum rate is checked only where the body is read through
* {@code getInputStream()}; form parameters and multipart parts are parsed through Jetty's core request and escaped
* it (1.1.0 shipped with that gap: a dripped login form was held until the idle timeout). {@link
* RequestBodyRateHandler} wraps the core request under the server, so every read passes it, and Jetty's own check
* is turned off so that the two cannot race ({@link #apply}).
* *
* <p><b>What it does not cover.</b> Slow header senders cost a connection, not a thread (Jetty parses headers without * <p><b>What it does not cover.</b> Slow header senders cost a connection, not a thread (Jetty parses headers without
* one); a proxy's connection cap is the limit there. A client that reads a response slowly is bounded by the * one); a proxy's connection cap is the limit there. A client that reads a response slowly is bounded by the
@@ -45,21 +52,34 @@ public class SlowClientConfig {
} }
/** /**
* Sets the minimum request data rate on every HTTP configuration of {@code server}'s connectors. * Installs the body-rate check on {@code server}: a {@link RequestBodyRateHandler} directly under the server, and
* Jetty's own minimum request data rate set to {@code 0} on every HTTP configuration of its connectors.
*
* <p>Jetty's own check covers {@code getInputStream()} only, and fires above this handler, so the two raced on
* the stream path: when Jetty's won, the failure escaped as an {@code IOException} that the application chain
* turned into an empty {@code 200} (measured on a plugin route that reads its form from the stream). One check,
* under every read, answers {@code 408} on every path. Boot has set the server's handler before its customizers
* run, and wraps the result in its own statistics handler afterwards.
* *
* @param bytesPerSecond the rate; 0 turns the check off * @param bytesPerSecond the rate; 0 turns the check off
* @return how many HTTP configurations were changed * @return how many HTTP configurations had Jetty's own check set to 0
*/ */
static int apply(Server server, long bytesPerSecond) { static int apply(Server server, long bytesPerSecond) {
int changed = 0; int changed = 0;
for (Connector connector : server.getConnectors()) { for (Connector connector : server.getConnectors()) {
for (ConnectionFactory factory : connector.getConnectionFactories()) { for (ConnectionFactory factory : connector.getConnectionFactories()) {
if (factory instanceof HttpConfiguration.ConnectionFactory http) { if (factory instanceof HttpConfiguration.ConnectionFactory http) {
http.getHttpConfiguration().setMinRequestDataRate(bytesPerSecond); http.getHttpConfiguration().setMinRequestDataRate(0);
changed++; changed++;
} }
} }
} }
if (bytesPerSecond > 0 && server.getHandler() != null
&& !(server.getHandler() instanceof RequestBodyRateHandler)) {
RequestBodyRateHandler rate = new RequestBodyRateHandler(bytesPerSecond);
rate.setHandler(server.getHandler());
server.setHandler(rate);
}
if (bytesPerSecond > 0) { if (bytesPerSecond > 0) {
log.info("request bodies slower than {} bytes/s are refused (runway.http.min-request-data-rate)", log.info("request bodies slower than {} bytes/s are refused (runway.http.min-request-data-rate)",
bytesPerSecond); bytesPerSecond);
@@ -320,10 +320,11 @@ runway:
trusted-cidrs: trusted-cidrs:
- "127.0.0.1/32" - "127.0.0.1/32"
- "::1/128" - "::1/128"
# How slowly a client may send a request body, in bytes per second, before Jetty answers 408 and frees the # How slowly a client may send a request body (any: forms, uploads, raw), in bytes per second, before Runway
# request thread (SlowClientConfig). Measured from the body's first byte on what has arrived, so a server that is # answers 408 and frees the request thread (SlowClientConfig, RequestBodyRateHandler). Only time spent waiting for
# slow to read is never blamed. 4096 is below any real connection; 0 turns the check off. Also on Settings -> # the client counts, so a server that is slow to read is never blamed, and a body that has arrived complete is never
# Server settings -> Request limits. # refused. 4096 is below any real connection; 0 turns the check off. Also on Settings -> Server settings -> Request
# limits.
http: http:
min-request-data-rate: 4096 min-request-data-rate: 4096
# Stored-backup retention (app-level, not tenant-editable). After a site backup is written, its own # Stored-backup retention (app-level, not tenant-editable). After a site backup is written, its own
@@ -633,6 +633,15 @@ op.sites.hosts.hint=Comma-separated. Leave empty to make this site reachable onl
op.sites.base=Base URL op.sites.base=Base URL
op.sites.base.hint=The origin every absolute link of the site is built on: canonical links, the sitemap, structured data, social cards. Leave it empty to use https:// and the first host. Set it when the site is served over http, on another port, or under another of its hosts (www). No path. op.sites.base.hint=The origin every absolute link of the site is built on: canonical links, the sitemap, structured data, social cards. Leave it empty to use https:// and the first host. Set it when the site is served over http, on another port, or under another of its hosts (www). No path.
op.sites.base.row=Links: {0} op.sites.base.row=Links: {0}
op.sites.hosts.short=Hosts
op.restore.review.title=Review how site {0} is reached
op.restore.review.hint=The restore applied the hosts and base URL saved in the backup. Check them, and correct them here if this installation reaches the site differently; saving does what Sites → Edit hosts does.
op.restore.review.noHosts=none: the site is reached only as the catch-all default site
op.restore.review.unreachable=none: no address reaches this site until you give it a host
op.restore.review.noBase=none: there is no host to build it from
op.restore.review.derived=not set, so {0} (https:// and the first host)
op.restore.review.kept.title=How the site is reached
op.restore.review.kept.hint=A restore made here keeps the site's hosts and base URL. Check them: only a platform administrator can change them, on the application console.
op.sites.edit=Edit op.sites.edit=Edit
op.sites.edit.title=Edit site op.sites.edit.title=Edit site
op.sites.edit.locales=Available languages op.sites.edit.locales=Available languages
@@ -1488,7 +1497,7 @@ op.ks.runway.csp.frame-ancestors.help=Which sites may show these pages in a fram
op.ks.runway.endpoints.max-form-bytes=Largest request before sign-in (bytes) op.ks.runway.endpoints.max-form-bytes=Largest request before sign-in (bytes)
op.ks.runway.endpoints.max-form-bytes.help=The most a visitor who is not signed in may send in one request, on any path. Default 262144 (256 KiB). op.ks.runway.endpoints.max-form-bytes.help=The most a visitor who is not signed in may send in one request, on any path. Default 262144 (256 KiB).
op.ks.runway.http.min-request-data-rate=Slowest request body (bytes per second) op.ks.runway.http.min-request-data-rate=Slowest request body (bytes per second)
op.ks.runway.http.min-request-data-rate.help=A request body arriving more slowly is answered 408 Request Timeout, so a client sending a byte now and then cannot hold a request thread. Measured on what has arrived since the body's first byte. Default 4096; 0 turns the check off. op.ks.runway.http.min-request-data-rate.help=A request body arriving more slowly is answered 408 Request Timeout: login and other forms, uploads and raw bodies alike, so a client sending a byte now and then cannot keep a request thread. Only time spent waiting for the client counts, and a body that has arrived complete is never refused. Sending part of a body fast earns at most 30 seconds of waiting. Default 4096; 0 turns the check off.
op.ks.runway.endpoints.max-body-bytes=Largest request to a plugin (bytes) op.ks.runway.endpoints.max-body-bytes=Largest request to a plugin (bytes)
op.ks.runway.endpoints.max-body-bytes.help=The most a signed-in user may send to a plugin's route. Default 10485760 (10 MiB). op.ks.runway.endpoints.max-body-bytes.help=The most a signed-in user may send to a plugin's route. Default 10485760 (10 MiB).
op.ks.spring.servlet.multipart.max-file-size=Largest uploaded file op.ks.spring.servlet.multipart.max-file-size=Largest uploaded file
@@ -634,6 +634,15 @@ op.sites.hosts.hint=Separados por comas. Déjelo vacío para que el sitio solo s
op.sites.base=URL base op.sites.base=URL base
op.sites.base.hint=El origen sobre el que se construyen todos los enlaces absolutos del sitio: enlaces canónicos, el mapa del sitio, los datos estructurados y las tarjetas para redes sociales. Déjelo vacío para usar https:// y el primer host. Fíjelo cuando el sitio se sirva por http, en otro puerto o con otro de sus hosts (www). Sin ruta. op.sites.base.hint=El origen sobre el que se construyen todos los enlaces absolutos del sitio: enlaces canónicos, el mapa del sitio, los datos estructurados y las tarjetas para redes sociales. Déjelo vacío para usar https:// y el primer host. Fíjelo cuando el sitio se sirva por http, en otro puerto o con otro de sus hosts (www). Sin ruta.
op.sites.base.row=Enlaces: {0} op.sites.base.row=Enlaces: {0}
op.sites.hosts.short=Hosts
op.restore.review.title=Revise cómo se llega al sitio {0}
op.restore.review.hint=La restauración aplicó los hosts y la URL base guardados en la copia. Revíselos y corríjalos aquí si esta instalación llega al sitio de otra forma; guardar hace lo mismo que Sitios → Editar hosts.
op.restore.review.noHosts=ninguno: al sitio solo se llega como sitio predeterminado (catch-all)
op.restore.review.unreachable=ninguno: ninguna dirección llega a este sitio hasta que le dé un host
op.restore.review.noBase=ninguna: no hay host con el que construirla
op.restore.review.derived=sin fijar, así que {0} (https:// y el primer host)
op.restore.review.kept.title=Cómo se llega al sitio
op.restore.review.kept.hint=Una restauración hecha aquí conserva los hosts y la URL base del sitio. Revíselos: solo un administrador de la plataforma puede cambiarlos, en la consola de la aplicación.
op.sites.edit=Editar op.sites.edit=Editar
op.sites.edit.title=Editar sitio op.sites.edit.title=Editar sitio
op.sites.edit.locales=Idiomas disponibles op.sites.edit.locales=Idiomas disponibles
@@ -1489,7 +1498,7 @@ op.ks.runway.csp.frame-ancestors.help=Qué sitios pueden mostrar estas páginas
op.ks.runway.endpoints.max-form-bytes=Solicitud máxima sin sesión (bytes) op.ks.runway.endpoints.max-form-bytes=Solicitud máxima sin sesión (bytes)
op.ks.runway.endpoints.max-form-bytes.help=Lo máximo que un visitante sin sesión puede enviar en una solicitud, en cualquier ruta. Por omisión 262144 (256 KiB). op.ks.runway.endpoints.max-form-bytes.help=Lo máximo que un visitante sin sesión puede enviar en una solicitud, en cualquier ruta. Por omisión 262144 (256 KiB).
op.ks.runway.http.min-request-data-rate=Cuerpo de solicitud más lento (bytes por segundo) op.ks.runway.http.min-request-data-rate=Cuerpo de solicitud más lento (bytes por segundo)
op.ks.runway.http.min-request-data-rate.help=Un cuerpo de solicitud que llega más despacio recibe 408 Request Timeout, así que un cliente que envía un byte de vez en cuando no puede ocupar un hilo de solicitud. Se mide sobre lo recibido desde el primer byte del cuerpo. Por omisión 4096; 0 desactiva la comprobación. op.ks.runway.http.min-request-data-rate.help=Un cuerpo de solicitud que llega más despacio recibe 408 Request Timeout: formularios (también el de inicio de sesión), subidas y cuerpos sin formato por igual, así que un cliente que envía un byte de vez en cuando no puede retener un hilo de solicitud. Solo cuenta el tiempo de espera por el cliente, y un cuerpo que ya llegó completo nunca se rechaza. Enviar rápido parte del cuerpo da como máximo 30 segundos de espera. Por omisión 4096; 0 desactiva la comprobación.
op.ks.runway.endpoints.max-body-bytes=Solicitud máxima a un complemento (bytes) op.ks.runway.endpoints.max-body-bytes=Solicitud máxima a un complemento (bytes)
op.ks.runway.endpoints.max-body-bytes.help=Lo máximo que un usuario con sesión puede enviar a una ruta de un complemento. Por omisión 10485760 (10 MiB). op.ks.runway.endpoints.max-body-bytes.help=Lo máximo que un usuario con sesión puede enviar a una ruta de un complemento. Por omisión 10485760 (10 MiB).
op.ks.spring.servlet.multipart.max-file-size=Archivo subido máximo op.ks.spring.servlet.multipart.max-file-size=Archivo subido máximo
@@ -12,6 +12,20 @@
</div> </div>
</div> </div>
<div class="card mb-3 border-primary" id="bk-review">
<div class="card-header"><h3 class="card-title" id="bk-review-title">How the site is reached</h3></div>
<div class="card-body">
<p class="text-secondary" id="bk-review-hint">A restore made here keeps the site's hosts and base URL.
Check them; only a platform administrator can change them.</p>
<dl class="row mb-0">
<dt class="col-sm-2" id="bk-review-l-hosts">Hosts</dt>
<dd class="col-sm-10 font-monospace" id="bk-review-hosts">example.com</dd>
<dt class="col-sm-2" id="bk-review-l-base">Base URL</dt>
<dd class="col-sm-10 font-monospace mb-0" id="bk-review-base">https://example.com</dd>
</dl>
</div>
</div>
<div class="row"> <div class="row">
<div class="col-md-6"> <div class="col-md-6">
<div class="card mb-3"> <div class="card mb-3">
@@ -7,6 +7,15 @@
<attr sel="#bk-pretitle" th:text="#{op.realm.tenant}"/> <attr sel="#bk-pretitle" th:text="#{op.realm.tenant}"/>
<attr sel="#bk-heading" th:text="#{op.backups.heading}"/> <attr sel="#bk-heading" th:text="#{op.backups.heading}"/>
<!-- After a restore (${reviewSite}): how the site is reached, read-only — a restore here keeps them. -->
<attr sel="#bk-review" th:if="${reviewSite != null}"/>
<attr sel="#bk-review-title" th:text="#{op.restore.review.kept.title}"/>
<attr sel="#bk-review-hint" th:text="#{op.restore.review.kept.hint}"/>
<attr sel="#bk-review-l-hosts" th:text="#{op.sites.hosts.short}"/>
<attr sel="#bk-review-hosts" th:text="${reviewSite == null or reviewSite.hosts().isEmpty()} ? (${reviewIsDefault} ? #{op.restore.review.noHosts} : #{op.restore.review.unreachable}) : ${#strings.listJoin(reviewSite.hosts(), ', ')}"/>
<attr sel="#bk-review-l-base" th:text="#{op.sites.base}"/>
<attr sel="#bk-review-base" th:text="${reviewSite?.baseUrl() != null} ? ${reviewSite.baseUrl()} : (${reviewSite == null or reviewSite.hosts().isEmpty()} ? #{op.restore.review.noBase} : #{op.restore.review.derived('https://' + ${reviewSite.hosts().get(0)})})"/>
<attr sel="#bk-l-make" th:text="#{op.backups.make}"/> <attr sel="#bk-l-make" th:text="#{op.backups.make}"/>
<attr sel="#bk-make-hint" th:text="#{op.backups.make.hint}"/> <attr sel="#bk-make-hint" th:text="#{op.backups.make.hint}"/>
<attr sel="#bk-download-now" th:if="${canDownloadFull}" th:text="#{op.backups.downloadNow}"/> <attr sel="#bk-download-now" th:if="${canDownloadFull}" th:text="#{op.backups.downloadNow}"/>
@@ -16,6 +16,38 @@
</div> </div>
</div> </div>
<div class="card mb-3 border-primary" id="ab-review">
<div class="card-header"><h3 class="card-title" id="ab-review-title">Review how the site is reached</h3></div>
<div class="card-body">
<p class="text-secondary" id="ab-review-hint">The restore applied the hosts and base URL saved in the
backup. Check them, and correct them here if this installation reaches the site differently.</p>
<dl class="row mb-3">
<dt class="col-sm-2" id="ab-review-l-hosts">Hosts</dt>
<dd class="col-sm-10 font-monospace" id="ab-review-hosts">example.com</dd>
<dt class="col-sm-2" id="ab-review-l-base">Base URL</dt>
<dd class="col-sm-10 font-monospace" id="ab-review-base">https://example.com</dd>
</dl>
<form id="ab-review-form" method="post" action="#">
<input id="ab-review-csrf" type="hidden" name="_csrf" value="">
<div class="row">
<div class="col-md-6 mb-2">
<label class="form-label" id="ab-review-l-hosts-input" for="ab-review-hosts-input">Hosts</label>
<input class="form-control" id="ab-review-hosts-input" name="hosts" autocomplete="off"
placeholder="example.com, www.example.com">
<small class="form-hint" id="ab-review-hosts-hint">Comma-separated.</small>
</div>
<div class="col-md-6 mb-2">
<label class="form-label" id="ab-review-l-base-input" for="ab-review-base-input">Base URL</label>
<input class="form-control" id="ab-review-base-input" name="baseUrl" type="url" maxlength="300"
autocomplete="off" spellcheck="false">
<small class="form-hint" id="ab-review-base-hint">The origin of the site's absolute links.</small>
</div>
</div>
<button type="submit" class="btn btn-primary" id="ab-review-save">Save hosts</button>
</form>
</div>
</div>
<div class="card mb-3"> <div class="card mb-3">
<div class="card-header"><h3 class="card-title" id="cs-l">Create a site from a backup</h3></div> <div class="card-header"><h3 class="card-title" id="cs-l">Create a site from a backup</h3></div>
<div class="card-body"> <div class="card-body">
@@ -5,6 +5,27 @@
<attr sel="#ab-pretitle" th:text="#{op.realm.application}"/> <attr sel="#ab-pretitle" th:text="#{op.realm.application}"/>
<attr sel="#ab-heading" th:text="#{op.appbackups.heading}"/> <attr sel="#ab-heading" th:text="#{op.appbackups.heading}"/>
<!-- After a restore or a site created from a backup (${reviewSite}): the site's hosts and base URL as they stand,
with the same editor as Sites -> Edit hosts (it posts there, so that route's checks and activity line apply).
Restoring here already required a platform administrator, who may edit any site's hosts. -->
<attr sel="#ab-review" th:if="${reviewSite != null}"/>
<attr sel="#ab-review-title" th:text="#{op.restore.review.title(${reviewSite?.id()})}"/>
<attr sel="#ab-review-hint" th:text="#{op.restore.review.hint}"/>
<attr sel="#ab-review-l-hosts" th:text="#{op.sites.hosts.short}"/>
<attr sel="#ab-review-hosts" th:text="${reviewSite == null or reviewSite.hosts().isEmpty()} ? (${reviewIsDefault} ? #{op.restore.review.noHosts} : #{op.restore.review.unreachable}) : ${#strings.listJoin(reviewSite.hosts(), ', ')}"/>
<attr sel="#ab-review-l-base" th:text="#{op.sites.base}"/>
<attr sel="#ab-review-base" th:text="${reviewSite?.baseUrl() != null} ? ${reviewSite.baseUrl()} : (${reviewSite == null or reviewSite.hosts().isEmpty()} ? #{op.restore.review.noBase} : #{op.restore.review.derived('https://' + ${reviewSite.hosts().get(0)})})"/>
<attr sel="#ab-review-form" th:attr="action='/__app/sites/' + ${reviewSite?.id()} + '/hosts'"/>
<attr sel="#ab-review-csrf"
th:attr="name=${_csrf != null ? _csrf.parameterName : '_csrf'},value=${_csrf != null ? _csrf.token : ''}"/>
<attr sel="#ab-review-l-hosts-input" th:text="#{op.sites.hosts}"/>
<attr sel="#ab-review-hosts-input" th:attr="value=${reviewSite == null ? '' : #strings.listJoin(reviewSite.hosts(), ', ')}"/>
<attr sel="#ab-review-hosts-hint" th:text="#{op.sites.hosts.hint}"/>
<attr sel="#ab-review-l-base-input" th:text="#{op.sites.base}"/>
<attr sel="#ab-review-base-input" th:attr="value=${reviewSite?.baseUrl()},placeholder=${reviewSite == null or reviewSite.hosts().isEmpty() ? '' : 'https://' + reviewSite.hosts().get(0)}"/>
<attr sel="#ab-review-base-hint" th:text="#{op.sites.base.hint}"/>
<attr sel="#ab-review-save" th:text="#{op.sites.hosts.save}"/>
<attr sel="#cs-l" th:text="#{op.appbackups.create}"/> <attr sel="#cs-l" th:text="#{op.appbackups.create}"/>
<attr sel="#cs-hint" th:text="#{op.appbackups.create.hint}"/> <attr sel="#cs-hint" th:text="#{op.appbackups.create.hint}"/>
<attr sel="#cs-csrf" <attr sel="#cs-csrf"
@@ -131,6 +131,64 @@ class AppBackupsScreenTest {
assertTrue(sites.exists("acme"), "the source site is untouched"); assertTrue(sites.exists("acme"), "the source site is untouched");
} }
/**
* A restore applies the hosts and base URL saved in the backup, so the screen then shows them for review with the
* hosts editor; saving it goes through Sites -> Edit hosts and changes the site.
*/
@Test
void aRestoreIsFollowedByTheRestoredHostsWithTheirEditor() throws Exception {
Site original = sites.find("acme").orElseThrow();
ByteArrayOutputStream baos = new ByteArrayOutputStream();
backups.backup("acme", baos); // carries acme.test and https://acme.test
try {
sites.save(new Site("acme", "Acme", List.of("acme.live"), Locale.ENGLISH, List.of(Locale.ENGLISH), null,
SiteStatus.ACTIVE));
MockHttpSession admin = sessionFor("admin");
MockMultipartFile file = new MockMultipartFile("file", "acme.zip", "application/zip", baos.toByteArray());
mvc.perform(multipart("/__app/backups/acme/restore").file(file).session(admin)
.with(csrf()))
.andExpect(status().is3xxRedirection())
.andExpect(flash().attribute(AppBackupsController.REVIEW_HOSTS, "acme"));
String page = mvc.perform(get("/__app/backups").session(admin))
.andExpect(status().isOk()).andReturn().getResponse().getContentAsString();
assertTrue(page.contains("Review how site acme is reached"), "the review card is shown");
assertTrue(page.contains(">acme.test<"), "the hosts as restored from the backup, not acme.live");
assertTrue(page.contains(">https://acme.test<"), "the restored base URL");
assertTrue(page.contains("action=\"/__app/sites/acme/hosts\""), "the editor posts to Sites -> Edit hosts");
assertTrue(page.contains("value=\"acme.test\""), "the editor starts from the hosts as they stand");
String plain = mvc.perform(get("/__app/backups").session(admin))
.andExpect(status().isOk()).andReturn().getResponse().getContentAsString();
assertFalse(plain.contains("Review how site"), "no review card without a restore");
mvc.perform(org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post("/__app/sites/acme/hosts")
.session(admin).with(csrf()).param("hosts", "acme.fixed").param("baseUrl", ""))
.andExpect(status().is3xxRedirection());
assertEquals(List.of("acme.fixed"), sites.find("acme").orElseThrow().hosts(), "corrected from the review");
} finally {
sites.save(original);
}
}
/** A site created from a backup without hosts is not the default site: the review says nothing reaches it. */
@Test
void aSiteCreatedWithoutHostsIsReportedUnreachableNotAsTheDefault() throws Exception {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
backups.backup("acme", baos);
MockHttpSession admin = sessionFor("admin");
MockMultipartFile file = new MockMultipartFile("file", "acme.zip", "application/zip", baos.toByteArray());
mvc.perform(multipart("/__app/backups/create-site").file(file).session(admin).with(csrf())
.param("newId", "hostless").param("name", "Hostless").param("hosts", ""))
.andExpect(status().is3xxRedirection())
.andExpect(flash().attribute(AppBackupsController.REVIEW_HOSTS, "hostless"));
String page = mvc.perform(get("/__app/backups").session(admin))
.andExpect(status().isOk()).andReturn().getResponse().getContentAsString();
assertTrue(page.contains("Review how site hostless is reached"));
assertTrue(page.contains("none: no address reaches this site until you give it a host"), "not the default");
assertFalse(page.contains("catch-all default site"), "it is not the default site");
}
/** An archive from a newer Runway: the operator is told to upgrade, and nothing is replaced or created. */ /** An archive from a newer Runway: the operator is told to upgrade, and nothing is replaced or created. */
@Test @Test
void aNewerFormatBackupIsRefusedWithTheUpgradeMessage() throws Exception { void aNewerFormatBackupIsRefusedWithTheUpgradeMessage() throws Exception {
@@ -284,6 +284,31 @@ class TenantBackupsScreenTest {
assertEquals("ORIGINAL_CONTENT", Files.readString(home, StandardCharsets.UTF_8), "the page was restored"); assertEquals("ORIGINAL_CONTENT", Files.readString(home, StandardCharsets.UTF_8), "the page was restored");
} }
/** After a restore the screen shows how the site is reached, read-only: a restore here keeps the hosts. */
@Test
void aRestoreIsFollowedByTheSitesHostsForReview() throws Exception {
MockHttpSession admin = sessionFor("admin");
mvc.perform(post("/__admin/backups/create").session(admin).with(csrf())).andExpect(status().is3xxRedirection());
mvc.perform(get("/__admin/backups").session(admin)).andExpect(status().isOk()); // the create's redirect
String name = backups.list("acme").get(0).name();
mvc.perform(post("/__admin/backups/" + name + "/restore").session(admin).with(csrf()))
.andExpect(status().is3xxRedirection())
.andExpect(flash().attribute(AppBackupsController.REVIEW_HOSTS, Boolean.TRUE));
MvcResult shown = mvc.perform(get("/__admin/backups").session(admin)).andExpect(status().isOk()).andReturn();
String page = shown.getResponse().getContentAsString();
assertTrue(page.contains("id=\"bk-review\""), "the review card is shown");
assertTrue(page.contains("How the site is reached"));
assertTrue(page.contains("only a platform administrator can change them"));
assertTrue(page.contains(">localhost<"), "the site's host");
assertTrue(page.contains("not set, so https://localhost (https:// and the first host)"), "the derived base URL");
assertTrue(!page.contains("/__app/sites/acme/hosts"), "no editor on the site console");
String plain = mvc.perform(get("/__admin/backups").session(admin))
.andExpect(status().isOk()).andReturn().getResponse().getContentAsString();
assertTrue(!plain.contains("id=\"bk-review\""), "no review card without a restore");
}
/** An archive from a newer Runway is refused on both restore paths, with the upgrade message. */ /** An archive from a newer Runway is refused on both restore paths, with the upgrade message. */
@Test @Test
void aNewerFormatBackupIsRefusedWithTheUpgradeMessage() throws Exception { void aNewerFormatBackupIsRefusedWithTheUpgradeMessage() throws Exception {
@@ -85,8 +85,7 @@ class RouteAwareFormContentFilterTest {
} }
@Test @Test
void itKeepsBootsOrder() { void itSitsInsideTheAccessLogAndTheSiteBindingSoItsRefusalsAreLogged() {
assertEquals(org.springframework.boot.servlet.filter.OrderedFormContentFilter.DEFAULT_ORDER, assertEquals(mx.quest.runway.web.FilterOrder.CORE_FORM_CONTENT, filter(registry()).getOrder());
filter(registry()).getOrder());
} }
} }
@@ -4,8 +4,11 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue; import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.mockito.ArgumentMatchers.anyInt;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.Mockito.mock; import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when; import static org.mockito.Mockito.never;
import static org.mockito.Mockito.verify;
import ch.qos.logback.classic.Logger; import ch.qos.logback.classic.Logger;
import ch.qos.logback.classic.spi.ILoggingEvent; import ch.qos.logback.classic.spi.ILoggingEvent;
@@ -17,10 +20,12 @@ import org.junit.jupiter.api.Test;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.mock.web.MockHttpServletRequest; import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.mock.web.MockHttpServletResponse; import org.springframework.mock.web.MockHttpServletResponse;
import java.util.Optional; import mx.quest.runway.site.SiteContextFilter;
import mx.quest.runway.site.SiteResolver;
/** The access log fires from the post-phase (final status) for public traffic, and skips internal surfaces. */ /**
* The access log fires from the post-phase (final status) for public traffic, and skips internal surfaces. Which
* requests reach it on the running application, whoever answers them, is {@code AccessLogCoverageEndToEndTest}.
*/
class AccessLogFilterTest { class AccessLogFilterTest {
private Logger accessLogger; private Logger accessLogger;
@@ -39,10 +44,10 @@ class AccessLogFilterTest {
accessLogger.detachAppender(appender); accessLogger.detachAppender(appender);
} }
private static AccessLogFilter filter() { private final SiteLogService siteLog = mock(SiteLogService.class);
SiteResolver resolver = mock(SiteResolver.class);
when(resolver.current()).thenReturn(Optional.empty()); private AccessLogFilter filter() {
return new AccessLogFilter(resolver, mock(SiteLogService.class)); return new AccessLogFilter(siteLog, false);
} }
private void runWithFinalStatus(String path, int finalStatus) throws Exception { private void runWithFinalStatus(String path, int finalStatus) throws Exception {
@@ -94,4 +99,25 @@ class AccessLogFilterTest {
assertEquals(1, appender.list.size(), "the access log fires from finally even on an exception"); assertEquals(1, appender.list.size(), "the access log fires from finally even on an exception");
assertTrue(appender.list.get(0).getFormattedMessage().contains("/about")); assertTrue(appender.list.get(0).getFormattedMessage().contains("/about"));
} }
@Test
void theSiteThatAnsweredGetsTheLineFromTheRequestAttribute() throws Exception {
// The site-context filter is inner of this one: by the post-phase its thread binding is gone, and only the
// attribute it set on the request says which site answered.
MockHttpServletRequest request = new MockHttpServletRequest("POST", "/login");
request.setRequestURI("/login");
request.setRemoteAddr("198.51.100.4");
filter().doFilter(request, new MockHttpServletResponse(), (req, res) -> {
req.setAttribute(SiteContextFilter.SITE_ID_ATTRIBUTE, "acme");
((HttpServletResponse) res).setStatus(403);
});
verify(siteLog).access("acme", "198.51.100.4", "POST", "/login", 403);
}
@Test
void aRequestNoSiteAnsweredGoesToThePlatformLogOnly() throws Exception {
runWithFinalStatus("/about", 404);
assertEquals(1, appender.list.size());
verify(siteLog, never()).access(anyString(), anyString(), anyString(), anyString(), anyInt());
}
} }
@@ -103,7 +103,14 @@ class SiteInsightsServiceTest {
line(TODAY, "11:29:00", "GET", "/.well-known/security.txt", 404), line(TODAY, "11:29:00", "GET", "/.well-known/security.txt", 404),
line(TODAY, "11:30:00", "GET", "/actuator/health", 200), line(TODAY, "11:30:00", "GET", "/actuator/health", 200),
line(TODAY, "11:31:00", "GET", "/app/x", 404), line(TODAY, "11:31:00", "GET", "/app/x", 404),
line(TODAY, "11:32:00", "GET", "/broken", 500)); // neither 2xx nor 404 line(TODAY, "11:32:00", "GET", "/broken", 500), // neither 2xx nor 404
// Answers the access log has carried since 1.1.2 (refusals and login traffic): none is a view.
line(TODAY, "11:40:00", "POST", "/login", 403), // a bot's post without a form token
line(TODAY, "11:41:00", "POST", "/login", 302), // a login attempt
line(TODAY, "11:42:00", "POST", "/login", 408), // a refused slow body
line(TODAY, "11:43:00", "GET", "/members", 302), // sent to the login page
line(TODAY, "11:44:00", "GET", "/members", 403), // signed in, not allowed
line(TODAY, "11:45:00", "GET", "/", 503)); // suspended, maintenance, quota
Report r = service().report("acme", 7); Report r = service().report("acme", 7);
@@ -117,7 +124,7 @@ class SiteInsightsServiceTest {
assertEquals(TODAY + " 11:10:00", row(r.topNotFound(), "/missing").lastSeen()); assertEquals(TODAY + " 11:10:00", row(r.topNotFound(), "/missing").lastSeen());
assertEquals(1, row(r.topNotFound(), "/img/logo.png").count()); assertEquals(1, row(r.topNotFound(), "/img/logo.png").count());
assertEquals(2, r.topNotFound().size()); assertEquals(2, r.topNotFound().size());
assertEquals(20, r.linesScanned()); assertEquals(26, r.linesScanned());
assertEquals(1, r.filesScanned()); assertEquals(1, r.filesScanned());
assertFalse(r.lineCapReached()); assertFalse(r.lineCapReached());
assertFalse(r.approximate()); assertFalse(r.approximate());
@@ -161,4 +161,22 @@ class SiteLogServiceTest {
assertEquals(3, lines.size()); assertEquals(3, lines.size());
assertTrue(lines.get(2).endsWith("/page-19999\t200"), lines.get(2)); // the newest line survives assertTrue(lines.get(2).endsWith("/page-19999\t200"), lines.get(2)); // the newest line survives
} }
@Test
void underAFloodAccessLinesAreDroppedBeforeAuditLines() {
props.setQueueCapacity(16); // reserve: 16 / 8 = 2 slots for audit only
SiteLogService svc = new SiteLogService(layout, configs, props);
svc.acceptWithoutWriting();
for (int i = 0; i < 20; i++) {
svc.access("acme", "203.0.113.9", "POST", "/login", 302);
}
assertEquals(14, svc.queued(), "access lines stop short of the audit reserve");
assertEquals(6, svc.droppedCount());
svc.audit("acme", "-", "login.failure", "user=a");
svc.audit("acme", "-", "login.failure", "user=b");
assertEquals(16, svc.queued(), "the reserve takes the audit lines the flood would have crowded out");
assertEquals(6, svc.droppedCount());
svc.audit("acme", "-", "login.failure", "user=c");
assertEquals(7, svc.droppedCount(), "a full queue drops an audit line too: the reserve is not unbounded");
}
} }
@@ -11,7 +11,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.web.servlet.FilterRegistrationBean; import org.springframework.boot.web.servlet.FilterRegistrationBean;
/** The protection floor and access log sit at their pinned slots, and the kernel default guard passes. */ /** The protection floor and the access log just inside it sit at their pinned slots; the default guard passes. */
@SpringBootTest @SpringBootTest
class EdgeProtectionConfigTest { class EdgeProtectionConfigTest {
@@ -30,9 +30,10 @@ class EdgeProtectionConfigTest {
} }
@Test @Test
void theAccessLogSitsInnermost() { void theAccessLogSitsJustInsideTheFloor() {
assertEquals(FilterOrder.CORE_ACCESS_LOG, accessLog.getOrder()); assertEquals(FilterOrder.CORE_ACCESS_LOG, accessLog.getOrder());
assertEquals(Integer.MAX_VALUE, accessLog.getOrder()); assertTrue(accessLog.getOrder() > edgeReject.getOrder(), "floor rejections stay out of the access log");
assertTrue(accessLog.getOrder() < FilterOrder.CORE_SITE_CONTEXT, "outer of every gate that answers alone");
} }
@Test @Test
@@ -12,8 +12,8 @@ import org.junit.jupiter.api.Test;
/** /**
* The recorder that closes the edge-rejection blind spot: a reject short-circuits at * The recorder that closes the edge-rejection blind spot: a reject short-circuits at
* {@code FilterOrder.CORE_PROTECTION} without calling the chain, so it never reaches the innermost access log * {@code FilterOrder.CORE_PROTECTION} without calling the chain, so it never reaches the access log (inside the
* and appeared in <b>no</b> log anywhere in the product. * floor) and appeared in <b>no</b> log anywhere in the product.
* *
* <p>The behaviour under test is mostly about what must remain true <em>under abuse</em>, since that is exactly * <p>The behaviour under test is mostly about what must remain true <em>under abuse</em>, since that is exactly
* when this code runs: the count must stay exact, the log must not become an amplifier, and the memory used to * when this code runs: the count must stay exact, the log must not become an amplifier, and the memory used to
@@ -0,0 +1,263 @@
package mx.quest.runway.web;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;
import ch.qos.logback.classic.Logger;
import ch.qos.logback.classic.spi.ILoggingEvent;
import ch.qos.logback.core.read.ListAppender;
import java.io.IOException;
import java.io.OutputStream;
import java.net.Socket;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.function.BooleanSupplier;
import java.util.function.Supplier;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import mx.quest.runway.log.LogKind;
import mx.quest.runway.log.SiteLogService;
import mx.quest.runway.protect.EdgeGuard;
import mx.quest.runway.protect.EdgeVerdict;
import mx.quest.runway.site.Site;
import mx.quest.runway.site.SiteStatus;
import mx.quest.runway.site.SiteStore;
import mx.quest.runway.storage.StorageLayout;
import mx.quest.runway.storage.StorageProperties;
import mx.quest.runway.storage.YamlStore;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.context.TestConfiguration;
import org.springframework.boot.test.web.server.LocalServerPort;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Primary;
import org.springframework.test.context.DynamicPropertyRegistry;
import org.springframework.test.context.DynamicPropertySource;
/**
* Every request the abuse floor lets through is in the access log, however it is answered: in the platform's
* {@code runway.access} stream and in the answering site's own log. Until 1.1.2 the access log sat innermost, and
* each answer below except the plain page was given by a filter outside it, so none of them was logged: a login
* attempt, a CSRF refusal, a suspended or maintenance site, a refused slow body, an oversized form refused unread,
* an endpoint route. Floor rejections and the internal surfaces stay out.
*
* <p>Against a real Jetty and the real filter chain, over raw sockets, because the gap was the chain's shape.
*/
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
class AccessLogCoverageEndToEndTest {
private static final Pattern CSRF = Pattern.compile("name=\"_csrf\"[^>]*?value=\"([^\"]*)\"");
/** The test guard turns this path away at the floor. */
private static final String FLOOR_REJECTED = "/floor-rejected";
@DynamicPropertySource
static void config(DynamicPropertyRegistry registry) throws IOException {
Path external = Files.createTempDirectory("runway-access-log");
ConsoleHostEndToEndTest.seed(external, null);
StorageProperties props = new StorageProperties();
props.setExternal(external);
SiteStore sites = new SiteStore(StorageLayout.from(props), new YamlStore());
sites.save(new Site("sus", "Sus", List.of("sus.test"), Locale.ENGLISH, List.of(Locale.ENGLISH), null,
SiteStatus.SUSPENDED, false, null));
sites.save(new Site("mnt", "Mnt", List.of("mnt.test"), Locale.ENGLISH, List.of(Locale.ENGLISH), null,
SiteStatus.ACTIVE, true, "Back soon"));
registry.add("runway.storage.external", () -> external.toString());
registry.add("runway.security.app-master-id", () -> "app-master");
registry.add("runway.health.content-check", () -> "false");
registry.add("runway.http.min-request-data-rate", () -> "1024");
}
@TestConfiguration
static class Beans {
@Bean
@Primary
EdgeGuard floorRejectingOnePath() {
return request -> FLOOR_REJECTED.equals(request.path()) ? EdgeVerdict.reject(429) : EdgeVerdict.pass();
}
}
@LocalServerPort
private int port;
@Autowired
private SiteLogService siteLogs;
private Logger accessLogger;
private ListAppender<ILoggingEvent> platformLines;
@BeforeEach
void attach() {
accessLogger = (Logger) LoggerFactory.getLogger("runway.access");
platformLines = new ListAppender<>();
platformLines.start();
accessLogger.addAppender(platformLines);
}
@AfterEach
void detach() {
accessLogger.detachAppender(platformLines);
}
@Test
void aPageIsLogged() throws IOException {
String path = "/page-" + System.nanoTime();
assertEquals(404, get("main.test", path).status());
assertLogged("main", "GET", path, 404);
}
@Test
void aLoginPostWithoutItsFormTokenIsLogged() throws IOException {
assertEquals(403, RawHttp.send(port, "POST", "main.test:" + port, "/login",
"username=guess&password=guess").status());
assertLogged("main", "POST", "/login", 403);
}
@Test
void aFailedLoginAttemptIsLogged() throws IOException {
RawHttp.Response page = get("main.test", "/login");
assertEquals(200, page.status());
Matcher token = CSRF.matcher(page.body());
assertTrue(token.find(), "a form token on /login");
RawHttp.Response attempt = RawHttp.send(port, "POST", "main.test:" + port, "/login",
"username=nobody&password=wrong-guess&_csrf=" + URLEncoder.encode(token.group(1),
StandardCharsets.UTF_8), Map.of("Cookie", String.join("; ", page.cookies())));
assertEquals(302, attempt.status(), "Spring Security answers the attempt itself, with a redirect");
assertLogged("main", "POST", "/login", 302);
}
@Test
void aSuspendedSitesRefusalIsLogged() throws IOException {
String path = "/suspended-" + System.nanoTime();
assertEquals(503, get("sus.test", path).status());
assertLogged("sus", "GET", path, 503);
}
@Test
void aSiteInMaintenanceIsLogged() throws IOException {
String path = "/maintenance-" + System.nanoTime();
assertEquals(503, get("mnt.test", path).status());
assertLogged("mnt", "GET", path, 503);
}
@Test
void anEndpointRouteIsLogged() throws IOException {
int status = get("main.test", "/manifest.webmanifest").status();
assertLogged("main", "GET", "/manifest.webmanifest", status);
}
@Test
void anOversizedPutFormRefusedUnreadIsLogged() throws IOException {
// The form-content filter answers 413 from the declared length, without reading the body or calling the chain.
String path = "/put-form-" + System.nanoTime();
assertEquals(413, RawHttp.send(port, "PUT", "main.test:" + port, path, null, Map.of(
"Content-Type", "application/x-www-form-urlencoded", "Content-Length", "99999999")).status());
assertLogged("main", "PUT", path, 413);
}
@Test
void aRefusedSlowLoginBodyIsLogged() throws Exception {
try (Socket socket = new Socket("127.0.0.1", port)) {
OutputStream out = socket.getOutputStream();
out.write(("POST /login HTTP/1.1\r\nHost: main.test:" + port + "\r\nContent-Type: "
+ "application/x-www-form-urlencoded\r\nContent-Length: 1000\r\nConnection: close\r\n\r\n"
+ "username=").getBytes(StandardCharsets.US_ASCII));
out.flush();
try {
for (int i = 0; i < 20; i++) {
Thread.sleep(1000);
out.write('a');
out.flush();
}
} catch (IOException closedByServer) {
// expected: answered and closed while the client was still trickling
}
socket.setSoTimeout(40_000);
String response = new String(socket.getInputStream().readAllBytes(), StandardCharsets.US_ASCII);
assertTrue(response.startsWith("HTTP/1.1 408"), response.lines().findFirst().orElse(""));
}
assertLogged("main", "POST", "/login", 408);
}
@Test
void aFloorRejectionStaysOutOfTheAccessLog() throws IOException {
assertEquals(429, get("main.test", FLOOR_REJECTED).status());
String control = "/after-floor-" + System.nanoTime();
get("main.test", control);
awaitSiteLine("main", control);
assertFalse(platformText().contains(FLOOR_REJECTED), platformText());
assertFalse(siteText("main").contains(FLOOR_REJECTED), "reported by runway.protect, throttled, instead");
}
@Test
void theInternalSurfacesStayOut() throws IOException {
get("main.test", "/app/login");
get("127.0.0.1:" + port, "/app/login");
String control = "/after-internal-" + System.nanoTime();
get("main.test", control);
awaitSiteLine("main", control);
assertFalse(platformText().contains("/app/login"), platformText());
assertFalse(siteText("main").contains("/app/login"));
}
// ---------------------------------------------------------------------------------------------------------------
private RawHttp.Response get(String host, String path) throws IOException {
return RawHttp.send(port, "GET", host.contains(":") ? host : host + ":" + port, path);
}
/**
* Both sinks carry the request with its final status. Both are waited for: the line is written when the chain
* unwinds, which can be after the client has read a response the application already completed and closed.
*/
private void assertLogged(String siteId, String method, String path, int status) {
String platform = " " + method + " " + path + " -> " + status + " (";
await(() -> platformText().contains(platform), () -> "runway.access lacks [" + platform + "]: "
+ platformText());
awaitSiteLine(siteId, "\t" + method + "\t" + path + "\t" + status);
}
private String platformText() {
StringBuilder text = new StringBuilder();
for (ILoggingEvent event : List.copyOf(platformLines.list)) {
text.append(event.getFormattedMessage()).append('\n');
}
return text.toString();
}
private String siteText(String siteId) {
return String.join("\n", siteLogs.tail(siteId, LogKind.ACCESS, 1000));
}
/** Waits (up to 15 s) until the site's access log has a line containing {@code text}. */
private void awaitSiteLine(String siteId, String text) {
await(() -> siteText(siteId).contains(text),
() -> "no access line with [" + text + "] for " + siteId + ": " + siteText(siteId));
}
private static void await(BooleanSupplier condition, Supplier<String> failure) {
long deadline = System.nanoTime() + 15_000_000_000L;
while (System.nanoTime() < deadline) {
if (condition.getAsBoolean()) {
return;
}
try {
Thread.sleep(50);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
break;
}
}
throw new AssertionError(failure.get());
}
}
@@ -410,7 +410,9 @@ class EncodedPathEndToEndTest {
get("main.test", control); get("main.test", control);
awaitLine("main", LogKind.ACCESS, control); awaitLine("main", LogKind.ACCESS, control);
List<String> lines = siteLogs.tail("main", LogKind.ACCESS, 1000); List<String> lines = siteLogs.tail("main", LogKind.ACCESS, 1000);
assertFalse(lines.stream().anyMatch(l -> l.contains("%6Cogin") || l.contains("%5F%5Fapp")), lines.toString()); // The console's paths only: a site's own login spelled /%6Cogin is public traffic, and logged since 1.1.2.
assertFalse(lines.stream().anyMatch(l -> l.contains("/app/%6Cogin") || l.contains("%5F%5Fapp")),
lines.toString());
} }
// --- Health, reload, Prometheus, console assets, the error page ------------------------------------------------- // --- Health, reload, Prometheus, console assets, the error page -------------------------------------------------
@@ -13,6 +13,9 @@ class FilterOrderTest {
int[] ladder = { int[] ladder = {
FilterOrder.CORE_FORWARDED, FilterOrder.CORE_FORWARDED,
FilterOrder.CORE_PROTECTION, FilterOrder.CORE_PROTECTION,
FilterOrder.CORE_ACCESS_LOG,
FilterOrder.CORE_BANDWIDTH,
FilterOrder.CORE_SITE_METRICS,
FilterOrder.CORE_COMPRESSION, FilterOrder.CORE_COMPRESSION,
FilterOrder.CORE_CSP_FINALIZE, FilterOrder.CORE_CSP_FINALIZE,
FilterOrder.CORE_HEAD_INJECTION, FilterOrder.CORE_HEAD_INJECTION,
@@ -21,13 +24,13 @@ class FilterOrderTest {
FilterOrder.CORE_SITE_RELOAD, FilterOrder.CORE_SITE_RELOAD,
FilterOrder.CORE_CONSOLE_HOST, FilterOrder.CORE_CONSOLE_HOST,
FilterOrder.CORE_ROUTE_FORM_CAPTURE, FilterOrder.CORE_ROUTE_FORM_CAPTURE,
FilterOrder.CORE_FORM_CONTENT,
FilterOrder.CORE_SUSPENDED_SITE, FilterOrder.CORE_SUSPENDED_SITE,
FilterOrder.CORE_QUARANTINED_SITE, FilterOrder.CORE_QUARANTINED_SITE,
FilterOrder.CORE_ESSENTIAL_FLOOR, FilterOrder.CORE_ESSENTIAL_FLOOR,
FilterOrder.CORE_EDGE_MODE, FilterOrder.CORE_EDGE_MODE,
FilterOrder.CORE_SECURITY, FilterOrder.CORE_SECURITY,
FilterOrder.CORE_ENDPOINT_DISPATCH, FilterOrder.CORE_ENDPOINT_DISPATCH,
FilterOrder.CORE_ACCESS_LOG,
}; };
for (int i = 1; i < ladder.length; i++) { for (int i = 1; i < ladder.length; i++) {
assertTrue(ladder[i - 1] < ladder[i], assertTrue(ladder[i - 1] < ladder[i],
@@ -97,9 +100,13 @@ class FilterOrderTest {
// TENANT: after the kernel tenant gates, before security. // TENANT: after the kernel tenant gates, before security.
assertTrue(tenant.outer() > FilterOrder.CORE_EDGE_MODE); assertTrue(tenant.outer() > FilterOrder.CORE_EDGE_MODE);
assertTrue(tenant.inner() < FilterOrder.CORE_SECURITY); assertTrue(tenant.inner() < FilterOrder.CORE_SECURITY);
// APPLICATION: inner of security (never preempts it), outer of the access log. // APPLICATION: inner of security (never preempts it).
assertTrue(application.outer() > FilterOrder.CORE_SECURITY); assertTrue(application.outer() > FilterOrder.CORE_SECURITY);
assertTrue(application.inner() < FilterOrder.CORE_ACCESS_LOG); // The access log: inner of every EDGE_INGRESS filter (floor rejections stay out of it), outer of every
// other band, so whatever a plugin filter answers is logged.
assertTrue(ingress.inner() < FilterOrder.CORE_ACCESS_LOG);
assertTrue(FilterOrder.CORE_ACCESS_LOG < FilterOrder.CORE_BANDWIDTH);
assertTrue(FilterOrder.CORE_ACCESS_LOG < egress.outer());
// The windows are disjoint and nested outer→inner. // The windows are disjoint and nested outer→inner.
assertTrue(ingress.inner() < egress.outer()); assertTrue(ingress.inner() < egress.outer());
assertTrue(egress.inner() < tenant.outer()); assertTrue(egress.inner() < tenant.outer());
@@ -36,7 +36,23 @@ class PluginFilterPlacementTest {
for (int offset : new int[] {Integer.MIN_VALUE, -1000, 0, 5, 999_000, Integer.MAX_VALUE}) { for (int offset : new int[] {Integer.MIN_VALUE, -1000, 0, 5, 999_000, Integer.MAX_VALUE}) {
int order = PluginFilterPlacement.resolve(FilterBand.APPLICATION, offset); int order = PluginFilterPlacement.resolve(FilterBand.APPLICATION, offset);
assertTrue(order > FilterOrder.CORE_SECURITY, "APPLICATION offset " + offset + " escaped inner-of-security"); assertTrue(order > FilterOrder.CORE_SECURITY, "APPLICATION offset " + offset + " escaped inner-of-security");
assertTrue(order < FilterOrder.CORE_ACCESS_LOG, "APPLICATION offset " + offset + " escaped outer-of-access-log"); assertTrue(order > FilterOrder.CORE_ACCESS_LOG, "APPLICATION offset " + offset + " escaped the access log");
}
}
@Test
void onlyAnIngressPluginFilterSitsOuterOfTheAccessLog() {
// Ingress filters turn abuse away like the floor and stay out of the access log with it; whatever any other
// plugin filter answers is logged.
for (FilterBand band : FilterBand.values()) {
if (!band.contributable()) {
continue;
}
for (int offset : new int[] {Integer.MIN_VALUE, -1000, 0, 5, 999_000, Integer.MAX_VALUE}) {
int order = PluginFilterPlacement.resolve(band, offset);
assertTrue(band == FilterBand.EDGE_INGRESS ? order < FilterOrder.CORE_ACCESS_LOG
: order > FilterOrder.CORE_ACCESS_LOG, band + " offset " + offset + " -> " + order);
}
} }
} }
@@ -26,16 +26,18 @@ import org.springframework.boot.web.server.WebServer;
/** /**
* The minimum request data rate, against a real Jetty: a body trickled in is cut with {@code 408} instead of holding a * The minimum request data rate, against a real Jetty: a body trickled in is cut with {@code 408} instead of holding a
* request thread, and a server that is slow to start reading is not blamed for it. Guards the behaviour across Jetty * request thread, whether the servlet reads the stream, form parameters or multipart parts, and a server that is slow
* upgrades, since the rate check is Jetty's. * to start reading is not blamed for it. The check is {@link RequestBodyRateHandler}'s; Jetty's own is turned off.
*/ */
class SlowClientConfigTest { class SlowClientConfigTest {
/** The bean, as Spring binds and applies it: the property, the clamp, and every connector of Boot's own Jetty. */ /** The bean, as Spring binds and applies it: the property, the clamp, and every connector of Boot's own Jetty. */
@Test @Test
void theBoundPropertyReachesEveryConnectorOfTheServerBootBuilds() throws Exception { void theBoundPropertyReachesEveryConnectorOfTheServerBootBuilds() throws Exception {
assertThat(rateOnBootsServer("1024")).containsOnly(1024L).isNotEmpty(); assertThat(rateOnBootsServer("1024")).as("Jetty's own check off on every connector; ours in Boot's chain")
assertThat(rateOnBootsServer("-5")).as("a negative value is clamped to off").containsOnly(0L); .containsOnly(0L, 1024L * 1_000_000).contains(0L, 1024L * 1_000_000);
assertThat(rateOnBootsServer("-5")).as("a negative value is clamped to off, and no handler is installed")
.containsOnly(0L).isNotEmpty();
} }
private java.util.List<Long> rateOnBootsServer(String configured) throws Exception { private java.util.List<Long> rateOnBootsServer(String configured) throws Exception {
@@ -55,6 +57,13 @@ class SlowClientConfigTest {
} }
} }
} }
// The handler chain, outermost first: a RequestBodyRateHandler is reported as its rate x 1_000_000.
for (org.eclipse.jetty.server.Handler h = ((JettyWebServer) web).getServer().getHandler(); h != null;
h = h instanceof org.eclipse.jetty.server.Handler.Wrapper w ? w.getHandler() : null) {
if (h instanceof RequestBodyRateHandler rate) {
rates.add(rate.bytesPerSecond() * 1_000_000);
}
}
return rates; return rates;
} finally { } finally {
web.stop(); web.stop();
@@ -70,27 +79,66 @@ class SlowClientConfigTest {
} }
} }
/** How the servlet reads the body: the input stream (Jetty's own check), form parameters, or multipart parts. */
private enum Body { STREAM, FORM, MULTIPART, SWALLOWED, ESCAPED }
/** A server whose servlet reads the whole body after {@code pauseMillis}, with the rate applied by the config. */ /** A server whose servlet reads the whole body after {@code pauseMillis}, with the rate applied by the config. */
private int start(long bytesPerSecond, long pauseMillis) throws Exception { private int start(long bytesPerSecond, long pauseMillis) throws Exception {
return start(bytesPerSecond, pauseMillis, Body.STREAM);
}
private int start(long bytesPerSecond, long pauseMillis, Body body) throws Exception {
return start(bytesPerSecond, pauseMillis, body, RequestBodyRateHandler.CREDIT_SECONDS);
}
private int start(long bytesPerSecond, long pauseMillis, Body body, long creditSeconds) throws Exception {
server = new Server(); server = new Server();
ServerConnector connector = new ServerConnector(server, new HttpConnectionFactory()); ServerConnector connector = new ServerConnector(server, new HttpConnectionFactory());
connector.setPort(0); connector.setPort(0);
connector.setIdleTimeout(30_000); connector.setIdleTimeout(30_000);
server.addConnector(connector); server.addConnector(connector);
ServletContextHandler context = new ServletContextHandler(); ServletContextHandler context = new ServletContextHandler();
context.addServlet(new ServletHolder(new HttpServlet() { ServletHolder holder = new ServletHolder(new HttpServlet() {
@Override @Override
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException { protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws IOException, jakarta.servlet.ServletException {
try { try {
Thread.sleep(pauseMillis); Thread.sleep(pauseMillis);
} catch (InterruptedException e) { } catch (InterruptedException e) {
Thread.currentThread().interrupt(); Thread.currentThread().interrupt();
} }
response.getWriter().write("read " + request.getInputStream().readAllBytes().length); String read = switch (body) {
case STREAM -> "read " + request.getInputStream().readAllBytes().length;
case FORM -> "a=" + request.getParameter("a").length();
case MULTIPART -> "parts " + request.getParts().size();
case SWALLOWED -> { // the read fails and the code carries on as if nothing happened
try {
request.getInputStream().readAllBytes();
} catch (IOException ignored) {
// swallowed on purpose
} }
}), "/*"); yield "fine";
}
case ESCAPED -> { // the failure escapes, as from a filter that reads the stream itself
request.getInputStream().readAllBytes();
yield "unreachable";
}
};
response.getWriter().write(read);
}
});
if (body == Body.MULTIPART) {
holder.getRegistration().setMultipartConfig(new jakarta.servlet.MultipartConfigElement(""));
}
context.addServlet(holder, "/*");
server.setHandler(context); server.setHandler(context);
assertThat(SlowClientConfig.apply(server, bytesPerSecond)).isEqualTo(1); assertThat(SlowClientConfig.apply(server, bytesPerSecond)).isEqualTo(1);
if (creditSeconds != RequestBodyRateHandler.CREDIT_SECONDS
&& server.getHandler() instanceof RequestBodyRateHandler installed) {
RequestBodyRateHandler shortCredit = new RequestBodyRateHandler(bytesPerSecond, creditSeconds);
shortCredit.setHandler(installed.getHandler());
server.setHandler(shortCredit);
}
server.start(); server.start();
return connector.getLocalPort(); return connector.getLocalPort();
} }
@@ -136,6 +184,133 @@ class SlowClientConfigTest {
} }
} }
/** Sends {@code head}, then {@code drip} one byte a second until the server answers or 20 bytes are sent. */
private static String drip(int port, String head) throws Exception {
long started = System.nanoTime();
try (Socket socket = new Socket("127.0.0.1", port)) {
OutputStream out = socket.getOutputStream();
out.write(head.getBytes(StandardCharsets.US_ASCII));
out.flush();
try {
for (int i = 0; i < 20; i++) {
Thread.sleep(1000);
out.write('a');
out.flush();
}
} catch (IOException closedByServer) {
// expected: answered and closed while the client was still trickling
}
String status = statusLine(socket);
assertThat(Duration.ofNanos(System.nanoTime() - started)).as("cut long before the idle timeout")
.isLessThan(Duration.ofSeconds(15));
return status;
}
}
@Test
void aTrickledFormIsCutToo() throws Exception {
// 1.1.0: form parameters were read past Jetty's own check, and this request was held for the idle timeout.
int port = start(1024, 0, Body.FORM);
assertThat(drip(port, "POST / HTTP/1.1\r\nHost: x\r\nContent-Type: application/x-www-form-urlencoded\r\n"
+ "Content-Length: 1000\r\nConnection: close\r\n\r\na=")).isEqualTo("HTTP/1.1 408 Request Timeout");
}
@Test
void aTrickledMultipartBodyIsCutToo() throws Exception {
int port = start(1024, 0, Body.MULTIPART);
assertThat(drip(port, "POST / HTTP/1.1\r\nHost: x\r\nContent-Type: multipart/form-data; boundary=XyZ\r\n"
+ "Content-Length: 1000\r\nConnection: close\r\n\r\n--XyZ\r\n"
+ "Content-Disposition: form-data; name=\"a\"\r\n\r\n")).isEqualTo("HTTP/1.1 408 Request Timeout");
}
@Test
void aRefusedBodyIsAnswered408HoweverTheCodeHandledTheFailedRead() throws Exception {
// Measured on 1.1.1-SNAPSHOT before this guard: a route reading the stream itself answered an empty 200.
for (Body body : new Body[] {Body.SWALLOWED, Body.ESCAPED}) {
int port = start(4096, 0, body);
assertThat(drip(port, "POST / HTTP/1.1\r\nHost: x\r\nContent-Type: application/octet-stream\r\n"
+ "Content-Length: 1000\r\nConnection: close\r\n\r\n")).as(body.name())
.isEqualTo("HTTP/1.1 408 Request Timeout");
server.stop();
server = null;
}
}
@Test
void aBodySentFastAtFirstCannotBuyALongDripLater() throws Exception {
// 32 KiB at line speed, then a byte a second: averaged over the whole body (1.1.0, and this fix's first form)
// that bought 32 s of dripping at 1 KiB/s, and with 16 MiB over an hour. The credit is capped (2 s here).
int port = start(1024, 0, Body.FORM, 2);
long started = System.nanoTime();
try (Socket socket = new Socket("127.0.0.1", port)) {
OutputStream out = socket.getOutputStream();
out.write(("POST / HTTP/1.1\r\nHost: x\r\nContent-Type: application/x-www-form-urlencoded\r\n"
+ "Content-Length: 65536\r\nConnection: close\r\n\r\na=" + "b".repeat(32 * 1024))
.getBytes(StandardCharsets.US_ASCII));
out.flush();
try {
for (int i = 0; i < 20; i++) {
Thread.sleep(1000);
out.write('c');
out.flush();
}
} catch (IOException closedByServer) {
// expected
}
assertThat(statusLine(socket)).isEqualTo("HTTP/1.1 408 Request Timeout");
}
assertThat(Duration.ofNanos(System.nanoTime() - started)).isLessThan(Duration.ofSeconds(10));
}
@Test
void aSmallFormWhoseOnlyPacketArrivesLateIsAccepted() throws Exception {
// A network stall before the body: the body then arrives whole, so no thread is held by a slow client.
int port = start(1024, 0, Body.FORM);
try (Socket socket = new Socket("127.0.0.1", port)) {
OutputStream out = socket.getOutputStream();
out.write(("POST / HTTP/1.1\r\nHost: x\r\nContent-Type: application/x-www-form-urlencoded\r\n"
+ "Content-Length: 12\r\nConnection: close\r\n\r\n").getBytes(StandardCharsets.US_ASCII));
out.flush();
Thread.sleep(2500);
out.write("a=1234567890".getBytes(StandardCharsets.US_ASCII));
out.flush();
assertThat(statusLine(socket)).isEqualTo("HTTP/1.1 200 OK");
}
}
@Test
void aLargeFormAtAGoodRateIsAccepted() throws Exception {
int port = start(4096, 0, Body.FORM);
int size = 64 * 1024;
try (Socket socket = new Socket("127.0.0.1", port)) {
OutputStream out = socket.getOutputStream();
out.write(("POST / HTTP/1.1\r\nHost: x\r\nContent-Type: application/x-www-form-urlencoded\r\n"
+ "Content-Length: " + (size + 2) + "\r\nConnection: close\r\n\r\na=")
.getBytes(StandardCharsets.US_ASCII));
for (int i = 0; i < size / 4096; i++) { // 4 KiB every 100 ms: 40 KiB/s, ten times the minimum
out.write("b".repeat(4096).getBytes(StandardCharsets.US_ASCII));
out.flush();
Thread.sleep(100);
}
socket.setSoTimeout(10_000);
String response = new String(socket.getInputStream().readAllBytes(), StandardCharsets.US_ASCII);
assertThat(response).startsWith("HTTP/1.1 200 OK").endsWith("a=" + size);
}
}
@Test
void aFormServerSlowToReadIsNotBlamed() throws Exception {
int port = start(1024, 3000, Body.FORM);
try (Socket socket = new Socket("127.0.0.1", port)) {
OutputStream out = socket.getOutputStream();
out.write(("POST / HTTP/1.1\r\nHost: x\r\nContent-Type: application/x-www-form-urlencoded\r\n"
+ "Content-Length: 102\r\nConnection: close\r\n\r\na=" + "c".repeat(100))
.getBytes(StandardCharsets.US_ASCII));
out.flush();
assertThat(statusLine(socket)).isEqualTo("HTTP/1.1 200 OK");
}
}
@Test @Test
void theDefaultIsFourKilobytesPerSecond() { void theDefaultIsFourKilobytesPerSecond() {
assertThat(new SlowClientConfig.HttpLimitProperties().getMinRequestDataRate()).isEqualTo(4096); assertThat(new SlowClientConfig.HttpLimitProperties().getMinRequestDataRate()).isEqualTo(4096);
@@ -0,0 +1,126 @@
package mx.quest.runway.web;
import static org.assertj.core.api.Assertions.assertThat;
import java.io.IOException;
import java.io.OutputStream;
import java.net.Socket;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.time.Duration;
import java.util.List;
import java.util.Locale;
import java.util.Set;
import mx.quest.runway.security.PasswordEncoders;
import mx.quest.runway.security.PasswordStrength;
import mx.quest.runway.security.Roles;
import mx.quest.runway.security.User;
import mx.quest.runway.security.UserStore;
import mx.quest.runway.site.Site;
import mx.quest.runway.site.SiteStatus;
import mx.quest.runway.site.SiteStore;
import mx.quest.runway.spi.model.Realm;
import mx.quest.runway.storage.StorageLayout;
import mx.quest.runway.storage.StorageProperties;
import mx.quest.runway.storage.YamlStore;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.web.server.LocalServerPort;
import org.springframework.test.context.DynamicPropertyRegistry;
import org.springframework.test.context.DynamicPropertySource;
/**
* The slow-body limit on the running application, where it was missing in 1.1.0: the login forms of both realms and a
* multipart post, trickled in, are answered {@code 408} within seconds instead of holding a request thread until the
* idle timeout. Through the whole chain (Spring Security reads the login form), which a bare Jetty cannot stand in
* for: there, a refused read that the chain treats as a client gone away was answered an empty {@code 200}.
*/
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
class SlowRequestBodyEndToEndTest {
private static final String HOST = "localhost";
/** The console is never served on a site's host; this one is no site's. */
private static final String CONSOLE_HOST = "127.0.0.1";
@DynamicPropertySource
static void config(DynamicPropertyRegistry registry) throws IOException {
Path external = Files.createTempDirectory("runway-slow-body");
StorageProperties props = new StorageProperties();
props.setExternal(external);
YamlStore yaml = new YamlStore();
new SiteStore(StorageLayout.from(props), yaml).save(new Site("acme", "Acme", List.of(HOST), Locale.ENGLISH,
List.of(Locale.ENGLISH), null, SiteStatus.ACTIVE, false, null));
String hash = PasswordEncoders.argon2id(PasswordStrength.STANDARD).encode("Slow-Body-7x");
new UserStore(yaml).save(external.resolve("app-users.yml"),
new User("app-master", "root", hash, "Root", "", true, true, Realm.APPLICATION,
Set.of(Roles.SYSTEM_SUPERADMIN), List.of()));
registry.add("runway.storage.external", () -> external.toString());
registry.add("runway.security.app-master-id", () -> "app-master");
registry.add("runway.health.content-check", () -> "false");
registry.add("runway.http.min-request-data-rate", () -> "1024");
}
@LocalServerPort
private int port;
/** Sends the head of a 1000-byte body, then one byte a second; returns the status line and how long it took. */
private String drip(String path, String contentType, String bodyStart) throws Exception {
String host = path.startsWith("/app/") ? CONSOLE_HOST : HOST;
long started = System.nanoTime();
try (Socket socket = new Socket("127.0.0.1", port)) {
OutputStream out = socket.getOutputStream();
out.write(("POST " + path + " HTTP/1.1\r\nHost: " + host + "\r\nContent-Type: " + contentType
+ "\r\nContent-Length: 1000\r\nConnection: close\r\n\r\n" + bodyStart)
.getBytes(StandardCharsets.US_ASCII));
out.flush();
try {
for (int i = 0; i < 20; i++) {
Thread.sleep(1000);
out.write('a');
out.flush();
}
} catch (IOException closedByServer) {
// expected: answered and closed while the client was still trickling
}
socket.setSoTimeout(40_000);
String response = new String(socket.getInputStream().readAllBytes(), StandardCharsets.US_ASCII);
assertThat(Duration.ofNanos(System.nanoTime() - started)).as(path + ": cut long before the idle timeout")
.isLessThan(Duration.ofSeconds(15));
return response.isEmpty() ? "" : response.substring(0, response.indexOf("\r\n"));
}
}
@Test
void aTrickledSiteLoginIsAnswered408() throws Exception {
assertThat(drip("/login", "application/x-www-form-urlencoded", "username="))
.isEqualTo("HTTP/1.1 408 Request Timeout");
}
@Test
void aTrickledConsoleLoginIsAnswered408() throws Exception {
assertThat(drip("/app/login", "application/x-www-form-urlencoded", "username="))
.isEqualTo("HTTP/1.1 408 Request Timeout");
}
@Test
void aTrickledMultipartPostIsAnswered408() throws Exception {
assertThat(drip("/app/login", "multipart/form-data; boundary=XyZ",
"--XyZ\r\nContent-Disposition: form-data; name=\"username\"\r\n\r\n"))
.isEqualTo("HTTP/1.1 408 Request Timeout");
}
@Test
void aLoginSentAtOnceIsNotTouched() throws Exception {
try (Socket socket = new Socket("127.0.0.1", port)) {
String body = "username=root&password=wrong";
socket.getOutputStream().write(("POST /app/login HTTP/1.1\r\nHost: " + CONSOLE_HOST
+ "\r\nContent-Type: application/x-www-form-urlencoded\r\nContent-Length: " + body.length()
+ "\r\nConnection: close\r\n\r\n" + body).getBytes(StandardCharsets.US_ASCII));
socket.setSoTimeout(10_000);
String response = new String(socket.getInputStream().readAllBytes(), StandardCharsets.US_ASCII);
assertThat(response).as("refused for its missing CSRF token, as before: not a slow body")
.startsWith("HTTP/1.1 403");
}
}
}
+1 -1
View File
@@ -7,7 +7,7 @@
<parent> <parent>
<groupId>mx.quest</groupId> <groupId>mx.quest</groupId>
<artifactId>runway</artifactId> <artifactId>runway</artifactId>
<version>1.1.0</version> <version>1.1.2</version>
</parent> </parent>
<artifactId>runway-dist</artifactId> <artifactId>runway-dist</artifactId>
+1 -1
View File
@@ -6,7 +6,7 @@ name: Essential Protection
# The essential plugin ships with the kernel, in the same release, on the kernel's version line (docs/SPI-STABILITY.md, # The essential plugin ships with the kernel, in the same release, on the kernel's version line (docs/SPI-STABILITY.md,
# "The essential-plugin exception"): its version is the kernel's plain MAJOR.MINOR.PATCH. Seeding compares SHA-256 # "The essential-plugin exception"): its version is the kernel's plain MAJOR.MINOR.PATCH. Seeding compares SHA-256
# hashes, not versions, and no plugin may `requires:` an essential plugin, so nothing keys on it. # hashes, not versions, and no plugin may `requires:` an essential plugin, so nothing keys on it.
version: 1.1.0 version: 1.1.2
essential: true essential: true
# The mandatory floor (SPI 1.0.0): every plugin with a mainClass declares one; the kernel's own plugin declares the # The mandatory floor (SPI 1.0.0): every plugin with a mainClass declares one; the kernel's own plugin declares the
# SPI major's floor (>=1.0.0, met by every 1.x kernel; raised only when it uses a newer SPI member), so the floor rule # SPI major's floor (>=1.0.0, met by every 1.x kernel; raised only when it uses a newer SPI member), so the floor rule
+1 -1
View File
@@ -7,7 +7,7 @@
<parent> <parent>
<groupId>mx.quest</groupId> <groupId>mx.quest</groupId>
<artifactId>runway</artifactId> <artifactId>runway</artifactId>
<version>1.1.0</version> <version>1.1.2</version>
</parent> </parent>
<artifactId>runway-plugin-protection</artifactId> <artifactId>runway-plugin-protection</artifactId>
@@ -35,7 +35,7 @@ class ProtectionDescriptorK4Test {
PluginDescriptor descriptor = shipped(); PluginDescriptor descriptor = shipped();
assertEquals("protection", descriptor.id()); assertEquals("protection", descriptor.id());
assertTrue(descriptor.isEssential()); assertTrue(descriptor.isEssential());
assertEquals("1.1.0", descriptor.version(), "versioned on the kernel's line"); assertEquals("1.1.2", descriptor.version(), "versioned on the kernel's line");
assertEquals(PluginVersion.parse("1.0.0"), descriptor.spiFloor()); assertEquals(PluginVersion.parse("1.0.0"), descriptor.spiFloor());
assertEquals(PluginVersion.parse(RunwaySpi.VERSION).major(), descriptor.spiFloor().major(), assertEquals(PluginVersion.parse(RunwaySpi.VERSION).major(), descriptor.spiFloor().major(),
"the floor names the kernel's own SPI major line"); "the floor names the kernel's own SPI major line");
+1 -1
View File
@@ -7,7 +7,7 @@
<parent> <parent>
<groupId>mx.quest</groupId> <groupId>mx.quest</groupId>
<artifactId>runway</artifactId> <artifactId>runway</artifactId>
<version>1.1.0</version> <version>1.1.2</version>
</parent> </parent>
<artifactId>runway-spi-testkit</artifactId> <artifactId>runway-spi-testkit</artifactId>
+1 -1
View File
@@ -7,7 +7,7 @@
<parent> <parent>
<groupId>mx.quest</groupId> <groupId>mx.quest</groupId>
<artifactId>runway</artifactId> <artifactId>runway</artifactId>
<version>1.1.0</version> <version>1.1.2</version>
</parent> </parent>
<artifactId>runway-spi</artifactId> <artifactId>runway-spi</artifactId>
+1 -1
View File
@@ -38,7 +38,7 @@ S = [
("runway.csp.form-action","string","'self'",None,"server.csp",True,None,"form-action","Where forms may submit.","form-action","A dónde pueden enviarse los formularios."), ("runway.csp.form-action","string","'self'",None,"server.csp",True,None,"form-action","Where forms may submit.","form-action","A dónde pueden enviarse los formularios."),
("runway.csp.frame-ancestors","string","'self'",None,"server.csp",True,None,"frame-ancestors","Which sites may show these pages in a frame. 'none' forbids all.","frame-ancestors","Qué sitios pueden mostrar estas páginas en un marco. 'none' lo prohíbe."), ("runway.csp.frame-ancestors","string","'self'",None,"server.csp",True,None,"frame-ancestors","Which sites may show these pages in a frame. 'none' forbids all.","frame-ancestors","Qué sitios pueden mostrar estas páginas en un marco. 'none' lo prohíbe."),
("runway.endpoints.max-form-bytes","int","262144","1024..104857600","server.limits",False,None,"Largest request before sign-in (bytes)","The most a visitor who is not signed in may send in one request, on any path. Default 262144 (256 KiB).","Solicitud máxima sin sesión (bytes)","Lo máximo que un visitante sin sesión puede enviar en una solicitud, en cualquier ruta. Por omisión 262144 (256 KiB)."), ("runway.endpoints.max-form-bytes","int","262144","1024..104857600","server.limits",False,None,"Largest request before sign-in (bytes)","The most a visitor who is not signed in may send in one request, on any path. Default 262144 (256 KiB).","Solicitud máxima sin sesión (bytes)","Lo máximo que un visitante sin sesión puede enviar en una solicitud, en cualquier ruta. Por omisión 262144 (256 KiB)."),
("runway.http.min-request-data-rate","int","4096","0..1048576","server.limits",True,None,"Slowest request body (bytes per second)","A request body arriving more slowly is answered 408 Request Timeout, so a client sending a byte now and then cannot hold a request thread. Measured on what has arrived since the body's first byte. Default 4096; 0 turns the check off.","Cuerpo de solicitud más lento (bytes por segundo)","Un cuerpo de solicitud que llega más despacio recibe 408 Request Timeout, así que un cliente que envía un byte de vez en cuando no puede ocupar un hilo de solicitud. Se mide sobre lo recibido desde el primer byte del cuerpo. Por omisión 4096; 0 desactiva la comprobación."), ("runway.http.min-request-data-rate","int","4096","0..1048576","server.limits",True,None,"Slowest request body (bytes per second)","A request body arriving more slowly is answered 408 Request Timeout: login and other forms, uploads and raw bodies alike, so a client sending a byte now and then cannot keep a request thread. Only time spent waiting for the client counts, and a body that has arrived complete is never refused. Sending part of a body fast earns at most 30 seconds of waiting. Default 4096; 0 turns the check off.","Cuerpo de solicitud más lento (bytes por segundo)","Un cuerpo de solicitud que llega más despacio recibe 408 Request Timeout: formularios (también el de inicio de sesión), subidas y cuerpos sin formato por igual, así que un cliente que envía un byte de vez en cuando no puede retener un hilo de solicitud. Solo cuenta el tiempo de espera por el cliente, y un cuerpo que ya llegó completo nunca se rechaza. Enviar rápido parte del cuerpo da como máximo 30 segundos de espera. Por omisión 4096; 0 desactiva la comprobación."),
("runway.endpoints.max-body-bytes","int","10485760","1024..1073741824","server.limits",False,None,"Largest request to a plugin (bytes)","The most a signed-in user may send to a plugin's route. Default 10485760 (10 MiB).","Solicitud máxima a un complemento (bytes)","Lo máximo que un usuario con sesión puede enviar a una ruta de un complemento. Por omisión 10485760 (10 MiB)."), ("runway.endpoints.max-body-bytes","int","10485760","1024..1073741824","server.limits",False,None,"Largest request to a plugin (bytes)","The most a signed-in user may send to a plugin's route. Default 10485760 (10 MiB).","Solicitud máxima a un complemento (bytes)","Lo máximo que un usuario con sesión puede enviar a una ruta de un complemento. Por omisión 10485760 (10 MiB)."),
("spring.servlet.multipart.max-file-size","string","256MB",None,"server.limits",False,None,"Largest uploaded file","For uploads such as a backup to restore. A size like 256MB or 1GB. Default 256MB.","Archivo subido máximo","Para subidas como una copia a restaurar. Un tamaño como 256MB o 1GB. Por omisión 256MB."), ("spring.servlet.multipart.max-file-size","string","256MB",None,"server.limits",False,None,"Largest uploaded file","For uploads such as a backup to restore. A size like 256MB or 1GB. Default 256MB.","Archivo subido máximo","Para subidas como una copia a restaurar. Un tamaño como 256MB o 1GB. Por omisión 256MB."),
("spring.servlet.multipart.max-request-size","string","256MB",None,"server.limits",False,None,"Largest upload request","All the files of one upload together. A size like 256MB. Default 256MB.","Solicitud de subida máxima","Todos los archivos de una subida juntos. Un tamaño como 256MB. Por omisión 256MB."), ("spring.servlet.multipart.max-request-size","string","256MB",None,"server.limits",False,None,"Largest upload request","All the files of one upload together. A size like 256MB. Default 256MB.","Solicitud de subida máxima","Todos los archivos de una subida juntos. Un tamaño como 256MB. Por omisión 256MB."),