diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9e5b83f..5ed7117 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -24,19 +24,20 @@ # What has been done to narrow the darwin/linux gap without a runner: # 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 126/126, -# integration 73/73, smoke 19/19, first try (at 8fba844). Compose gate in docker:cli against +# - 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 # 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: 39/39. The +# the same console-check.cjs driving it in a real Linux Chromium: 44/44. 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. And the Linux numbers are as of -# 8fba844: the rehearsal has not been re-run since, so a suite count quoted -# above (126/73/39) is one behind the tree at the head of this file, where the -# host run measured 128 unit, 89 integration and 42 console assertions. +# 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 +# artifact) and freshness (pin 2026-10 = newest 2026-10). name: ci diff --git a/README.md b/README.md index 5772376..92a69ae 100644 --- a/README.md +++ b/README.md @@ -310,6 +310,21 @@ 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. +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` +and `PUT /countries/U.?allowed=false` both answered 204: `GET /countries` then +listed `12: denied` and `U.: denied` while a source from the busiest country +still got through with a 404 — the operator's table claimed two countries were +denied and the edge enforced nothing (denying `US` for real turns that same +probe into 451, which is the difference the table was hiding). The code is now +refused by name — `code must be a two-letter ISO country code; got "12"` — and +`DELETE /admin-api/countries/{code}` takes a rule out of the table and out of +the snapshot, answering `no country rule for "ZZ"` when there is nothing to +remove. That second half matters because a rule used to be permanent: the +console gate's own comment read "a country rule cannot be deleted, only +overwritten", and the residue outlived `compose down` in the data volume. + `redirectTo` on a block is the one field that ends up in a response header, and the shipped image used to accept any string in it — `POST /admin-api/blocks` answered 204 for all of these, and the next request from that source paid: @@ -345,9 +360,10 @@ It also writes, with the two controls an incident actually reaches for: block 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. There is no DELETE for a -country rule, so the toggle back is `PUT ?allowed=true`: the row stays behind -and means "not denied". +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}` +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 built and how old it is (marked past the 90-day runtime alarm), and the snapshot age against the TTL it is measured against — because on a single edge the TTL is @@ -384,7 +400,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 42 things. The read side: it authenticated, listed the streak as +and asserts 44 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 @@ -399,7 +415,11 @@ 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 can be set and put back. The quiet +expiry and can be removed, 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 +the previous run is not a gate. The quiet failure mode is asserted too: typing `not-an-ip` into the block form has to come back as the API's own error (`not an IP address: not-an-ip`) with no new row, because an operator who believes they blocked an address and did not is worse @@ -429,22 +449,22 @@ 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 `8fba844` — the rehearsal has **not** -been re-run past that commit, so every Linux number in this paragraph describes -`8fba844`, not the tree at the head of this file. What was measured at the head -(`0e2aee6`) is the same suite on the macOS host: unit **128/128**, integration -**89/89**, smoke **passed 19, failed 0**, compose **43 passed, 0 failed**, -console **42 assertions, 0 failed**, image 261 MB. Source gates: Ubuntu +Rehearsed 2026-10-02, most recently at `fc90f50`, 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 `fc90f50` +gives the same counts: unit **128/128**, integration **99/99**, smoke **passed +19, failed 0**, compose **43 passed, 0 failed**, console **44 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 **126/126**, integration -**73/73**, smoke **19/19**, first try, nothing to fix. The first +`setup-dotnet` with `10.0.x` satisfies the pin), unit **128/128**, integration +**99/99**, smoke **19/19**, 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 alerting assertions, 41 before the alert-edge ones), enforcement lag 0 ms, 12 ms -and 36 ms in three runs. Console gate on Linux: **39 assertions, 0 failed** — +and 36 ms in three runs. Console gate on Linux: **44 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 @@ -466,7 +486,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`: **39 assertions, 0 failed**, including +aarch64, node v24.20.0, `chromium-1243`: **44 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**. @@ -475,11 +495,11 @@ 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 `8fba844` — and every job +`catthehacker/ubuntu:act-latest`, most recently at `fc90f50` — and every job reported success: `lint` (both pinned tools download, verify their checksums -and find nothing), `source` (unit 126/126, integration 73/73, smoke 19/19), +and find nothing), `source` (unit 128/128, integration 99/99, smoke 19/19), `image` (`openwaf:ci` 261 MB, compose smoke 43 passed / 0 failed), `console` -(39 assertions / 0 failed with `playwright@1.63.0` and `chromium-1243`, +(44 assertions / 0 failed with `playwright@1.63.0` and `chromium-1243`, screenshot artifact published) 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 @@ -523,10 +543,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/ 89 tests driving the real pipeline against a fake upstream + OpenWaf.Tests.Integration/ 99 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 39 assertions against the page, in a real Chromium +scripts/console-check.cjs 44 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