diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5ed7117..f96f74a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -25,18 +25,18 @@ # scripts/ci-linux-rehearsal.sh runs the gates in containers. Source gates # (restore, build, unit, integration, smoke) in mcr.microsoft.com/dotnet/sdk:10.0 # - Ubuntu 24.04.5, SDK 10.0.401 resolving the pinned global.json: unit 128/128, -# integration 99/99, smoke 19/19, first try (at fc90f50). Compose gate in docker:cli against -# the host daemon: 43/43 on Linux. Console gate in +# integration 113/113, smoke 22/22, first try (at c97c7a1). Compose gate in docker:cli against +# the host daemon: 47/47 on Linux. Console gate in # mcr.microsoft.com/playwright:v1.63.0-noble - the stack seeded by docker:cli, -# the same console-check.cjs driving it in a real Linux Chromium: 44/44. The +# the same console-check.cjs driving it in a real Linux Chromium: 50/50. The # only wall clock ever measured for the source job is 1:02.81 cold (first # rehearsal); later rehearsals were not re-timed, so that number is quoted as # measured once, not as current. So every gate this file runs has a Linux # number. What it does not have is a runner: the repository has no remote, so # this file has never executed on GitHub. It has been executed by a local # Actions-compatible runner (nektos/act 0.2.89, catthehacker/ubuntu:act-latest) -# at fc90f50: 5 jobs succeeded, 0 failed - lint, source (128/128, 99/99, smoke -# 19/0), image (261 MB, compose smoke 43/0), console (44 assertions, screenshot +# at c97c7a1: 5 jobs succeeded, 0 failed - lint, source (128/128, 113/113, smoke +# 22/0), image (261 MB, compose smoke 47/0), console (50 assertions, screenshot # artifact) and freshness (pin 2026-10 = newest 2026-10). name: ci diff --git a/README.md b/README.md index 16ae685..f6af05c 100644 --- a/README.md +++ b/README.md @@ -264,7 +264,7 @@ delete the warning and exactly the first one fails. GET /admin-api/blocks?source=operator|engine&live=true POST /admin-api/blocks {"ip","reason","redirectTo"} DELETE /admin-api/blocks?source=engine[&key=…] -GET /admin-api/allow POST {"match","note","expiresInMinutes"} DELETE /admin-api/allow/{id} +GET /admin-api/allow?live[=false]&limit&offset POST {"match","note","expiresInMinutes"} DELETE /admin-api/allow/{id} GET /admin-api/policy PUT {"mode":"Enforce","streakThreshold":8,…} GET /admin-api/observations per-source streaks, durable — the maximum ever seen GET /admin-api/streaks the streak standing right now, in this process, with the threshold @@ -310,6 +310,32 @@ the same run prints "newest 25 of 42 recorded sources" and "Newest 25 of 274 alerts": the data volume survives `compose down`, which is precisely where a table that looks like a window stops being honest. +The exemption listing was the last one left uncapped, and it had a second fault +worth more than the ceiling. `GET /admin-api/allow` answered with every row ever +written and no statement of whether any of them still meant anything. Measured on +the shipped image — one entry written for one minute against an operator block on +the same address: `POST /admin-api/allow {"match":"192.168.65.1", +"expiresInMinutes":1}` at 03:58:16; that address answered **502** (through to the +upstream, the exemption outranking the block) at 03:58:20 and **301** (blocked +again) at 03:59:38; and at 03:59:39 `GET /admin-api/allow` still printed the row +with no liveness field while `/admin-api/state` still answered +`"allowEntries":1`. The engine was right and the surface was a minute behind it, +in the one table whose whole purpose is "who is exempt right now". With 1,101 rows +the same endpoint answered 130,386 bytes with no `X-Total-Count` and no +`X-Truncated`, and ignored every paging parameter — `?limit=10`, `?offset=1000`, +`?limit=0` and `?limit=100000` each returned all 1,101. It takes `live` (default +true; `live=false` means "do not filter", the same shape `/blocks` uses), `limit` +1–2,000 and `offset` now, refuses a limit nobody meant by name, carries +`X-Total-Count` and `X-Truncated` computed from the same predicate as the rows, +and puts `live` on every row — computed from `AllowEntry.IsLive`, the rule the +engine itself applies, which is what keeps the listing and the wire from drifting +apart again. `/admin-api/state` answers `allowEntries` as the number of exemptions +in force, with `allowEntriesExpired` beside it. The dead rows are not pruned, on +purpose: retention ages out observations, engine bans and alerts, and an +operator's own writes are not the machine's to delete — which is precisely why +they have to be visible instead of quietly absent from the only table that shows +them. + A country rule is matched against the two-letter code the geo database returns, so the code has to be two letters. `PUT /admin-api/countries/{code}` used to check only the length, and on the shipped image `PUT /countries/12?allowed=false` @@ -415,7 +441,9 @@ one address with a reason, and allowlist an address or CIDR with a note and an optional expiry (the "my customer is locked out" control — an allow entry outranks every ban). Each ban row has a delete that removes that row, each allow row a remove, and each country row a rule toggle plus — only when a rule -actually exists — a "remove rule" button. `DELETE /admin-api/countries/{code}` +actually exists — a "remove rule" button. An allow entry whose expiry has passed +stays in the table and says "EXPIRED, the edge no longer honours it", and the pill +above it counts live exemptions and expired rows apart — the row is not the answer. `DELETE /admin-api/countries/{code}` takes the rule out of the table and out of the snapshot; flipping it to `allowed=true` does not, it leaves a row behind that only means "not denied". The summary line states which geo database this edge is enforcing on, when it was @@ -454,7 +482,7 @@ deployment. The console gate starts the stack, seeds a source sitting at 2 of a threshold of 3 and an operator block with a reason, four 502s from an address chosen for this run (`/boom`, see the alerting note above), drives `/admin` in a real Chromium, -and asserts 47 things. The read side: it authenticated, listed the streak as +and asserts 50 things. The read side: it authenticated, listed the streak as current-over-threshold rather than as a historical maximum, listed the operator block with its reason, listed observations and countries with bars that have real pixel widths, said how many recorded sources the observation table is only @@ -469,7 +497,10 @@ then refused (301 with the policy's redirect Location — the probe uses comes back 200, which is how this assertion first read as a failure while the edge was refusing the client the whole time), the per-row delete removes that one ban and the address reaches the upstream again, an allow entry appears with an -expiry and can be removed, and a country rule is written from no rule at all, +expiry and can be removed, an allow entry whose minute passed a minute ago is +still listed and marked `EXPIRED` while a live one is not (the seed writes it with +a one-minute TTL ahead of waits the gate already pays, so the expired state +arrives for free), and a country rule is written from no rule at all, toggled both ways and then removed (`— → allowed → denied → —`). The gate used to assume a US rule was already there, so on a fresh volume — where the first click allows instead of denying — it failed; a gate that only passes on residue from @@ -503,22 +534,23 @@ macOS working tree make the next `--no-build` try to exec an ELF file — inside `mcr.microsoft.com/dotnet/sdk:10.0`. The compose gate runs in `docker:cli` against the host daemon, so the image build and the stack are Linux. -Rehearsed 2026-10-02, most recently at `6e6461a`, each stage run on its own, so +Rehearsed 2026-10-02, most recently at `c97c7a1`, each stage run on its own, so the numbers below describe the tree at the head of this file rather than a -commit several fixes behind it. The same suite on the macOS host at `6e6461a` -gives the same counts: unit **128/128**, integration **109/109**, smoke **passed -19, failed 0**, compose **43 passed, 0 failed**, console **47 assertions, 0 +commit several fixes behind it. The same suite on the macOS host at `c97c7a1` +gives the same counts: unit **128/128**, integration **113/113**, smoke **passed +22, failed 0**, compose **47 passed, 0 failed**, console **50 assertions, 0 failed**, image 261 MB. Source gates: Ubuntu 24.04.5, SDK **10.0.401** resolving `dotnet/global.json` (pinned `10.0.100`, `rollForward: latestFeature` — which is also the answer to whether `setup-dotnet` with `10.0.x` satisfies the pin), unit **128/128**, integration -**109/109**, smoke **19/19**, first try, nothing to fix. The first +**113/113**, smoke **22/22**, first try, nothing to fix. The first rehearsal of this pipeline timed a cold container and a cold NuGet cache at **1:02.81**; the runs after it were not re-timed, so that is the only wall clock measured here, and the source job's 25-minute timeout is not close either way. -Compose gate on Linux: **43 passed, 0 failed** (27 before the geo-pin and +Compose gate on Linux: **47 passed, 0 failed** (27 before the geo-pin and alerting assertions, 41 before the alert-edge ones), enforcement lag 0 ms, 12 ms -and 36 ms in three runs, 12 ms at `a77ab53`, 13 ms at `6e6461a`. Console gate on Linux: **47 assertions, 0 failed** — +and 36 ms in three runs, 12 ms at `a77ab53`, 13 ms at `6e6461a`, 11 ms at +`c97c7a1`. Console gate on Linux: **50 assertions, 0 failed** — described below. `scripts/geo-db-freshness.sh` was run in `mcr.microsoft.com/dotnet/sdk:10.0` too: current pin answers 0, and a forced `PIN=2026-05` answers 1 with the bump command, so the gate that decides whether @@ -540,7 +572,7 @@ and the stack is torn down afterwards. That image ships the browsers but not the npm package, so the script installs `playwright-core` into `/tmp` and points `PLAYWRIGHT_CORE` at it, mounting the repository read-only so the install never lands in the working tree. Rehearsed the same day on Linux 7.0.12-linuxkit -aarch64, node v24.20.0, `chromium-1243`: **47 assertions, 0 failed**, including +aarch64, node v24.20.0, `chromium-1243`: **50 assertions, 0 failed**, including the round-trip the page alone cannot fake — a ban drawn on the page answers 301 on the next request from that address. All three scenes in one cold run: **2:14.33**. @@ -549,12 +581,12 @@ on the next request from that address. All three scenes in one cold run: Honest status of the workflow itself: it has never executed on a GitHub-hosted runner, because the repository has no remote. It *has* been executed start to finish by a local Actions-compatible runner — `nektos/act` 0.2.89 on -`catthehacker/ubuntu:act-latest`, most recently at `6e6461a` — 5 jobs +`catthehacker/ubuntu:act-latest`, most recently at `c97c7a1` — 5 jobs succeeded, 0 failed: `lint` (both pinned tools download, verify their checksums -and find nothing), `source` (unit 128/128, integration 109/109, smoke 19/19), -`image` (`openwaf:ci` 261 MB, compose smoke 43 passed / 0 failed), `console` -(47 assertions / 0 failed with `playwright@1.63.0` and `chromium-1243`, -screenshot artifact published, 590,488-byte zip) and the `freshness` job (pin +and find nothing), `source` (unit 128/128, integration 113/113, smoke 22/22), +`image` (`openwaf:ci` 261 MB, compose smoke 47 passed / 0 failed), `console` +(50 assertions / 0 failed with `playwright@1.63.0` and `chromium-1243`, +screenshot artifact published, 606,514-byte zip) and the `freshness` job (pin 2026-10 = newest 2026-10). That is a stronger claim than "the steps were run by hand", and a weaker one than "CI is green": it proves the YAML executes and the pinned tools resolve, not that GitHub's image agrees. The @@ -597,10 +629,10 @@ dotnet/ OpenWaf.Infrastructure/ EF Core (sqlite/postgres), snapshot store, writers, MMDB geo OpenWaf.Edge/ the deployable: guard, observer, admin API, healthcheck mode OpenWaf.Tests.Unit/ 128 tests over the decision logic - OpenWaf.Tests.Integration/ 109 tests driving the real pipeline against a fake upstream -scripts/smoke.sh 19 assertions against a running edge + a real upstream -scripts/compose-smoke.sh 43 assertions against the built image (compose + nginx) -scripts/console-check.cjs 47 assertions against the page, in a real Chromium + OpenWaf.Tests.Integration/ 113 tests driving the real pipeline against a fake upstream +scripts/smoke.sh 22 assertions against a running edge + a real upstream +scripts/compose-smoke.sh 47 assertions against the built image (compose + nginx) +scripts/console-check.cjs 50 assertions against the page, in a real Chromium scripts/geo-db-freshness.sh the pinned geo database vs the vendor (0/1/2) .github/workflows/ci.yml runs the gates on every push .github/workflows/geo-freshness.yml the same check on a schedule