main
153
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
a77ab53ea8 |
A storage failure was reported to the operator as success, as their own bad request, and as ready
Measured on two shipped images of the same stand — openwaf:prefix built from
|
||
|
|
72d37ad3f1 |
The Linux numbers describe the head tree again
The rehearsal had been quoted from |
||
|
|
fc90f50de8 |
A country rule made of any two characters was stored, shown to the operator, and obeyed by nobody
PUT /admin-api/countries/{code} checked one thing about the code: that it was
two characters long. Measured on the shipped image (openwaf:ci):
PUT /admin-api/countries/12?allowed=false -> 204
PUT /admin-api/countries/U.?allowed=false -> 204
GET /admin-api/countries -> "12: denied", "U.: denied", "US: allowed"
probe from a source the geo database puts in a real country -> 404
A country rule is matched against the two-letter code the geo database returns,
so "12" and "U." can never match anything: the operator's table said two
countries were denied and the edge enforced nothing. With US denied for real the
same probe answers 451, which is the difference the table was hiding. And there
was no DELETE, so the row was permanent — the console gate's own comment used to
read "a country rule cannot be deleted, only overwritten", and the residue out
lived `compose down` because it lives in the data volume.
Now the code must be two ASCII letters or the write is refused by name:
"code must be a two-letter ISO country code; got \"12\"". DELETE
/admin-api/countries/{code} removes a rule and invalidates the snapshot, and
says `no country rule for "ZZ"` when there is nothing to remove. The page offers
"remove rule" on a row that has a rule, and the gate's cleanup deletes the US
rule it sets instead of leaving it behind.
The country part of the console gate was also fixed, and it was a gate bug worth
naming: it assumed a US rule already existed. With residue in the volume the
first click denied the country; on a fresh volume it allowed it, so the
assertion only ever passed on leftover state. It now starts from no rule and
asserts — → allowed → denied → removed.
Teeth, each reverted and counted, then restored: length-only code check -> 5
integration failures; DELETE endpoint removed -> 2; both out -> 9.
Gates on this tree: unit 128/128, integration 99/99, smoke passed 19 failed 0,
compose 43 passed 0 failed, console 44 assertions 0 failed, image 261 MB.
|
||
|
|
53947516b2 |
The README says which run it describes, and which commit that run was on
The listing-completeness fix ( |
||
|
|
0e2aee6beb |
A capped listing answered like it was the whole answer, and one said it was capped when it was not
?source= is refused by name now; a limit nobody meant still silently became a
different limit. Measured on the shipped image (openwaf:ci), 1103 sources
recorded:
GET /admin-api/observations?limit=100000 -> 200, 1000 rows, no total, no
truncation flag. 103 recorded sources were unreachable and the response
read like a complete answer.
GET /admin-api/observations?limit=0 and ?limit=-1 -> 200, one row each.
GET /admin-api/streaks?limit=1000 -> 200, 2 streaks, trackedSources 3,
X-Truncated: true. Nothing had been cut: the header compared the page
against the size of the streak map, and the map keeps a source whose
streak a clean answer ended while the listing leaves those out on purpose.
The block listing already carried X-Total-Count and X-Truncated, with a comment
saying that is what stops a page reading like a complete answer. The two
listings the console reads most had neither. Now every capped listing carries
both, takes an offset that reaches the rest, and refuses a limit outside its
range by name: "limit must be 1..1000; got 0". /streaks measures truncation
against standing streaks, reports standingStreaks next to trackedSources, and
pages.
The page says what it is showing. The console gate run printed "newest 25 of 42
recorded sources" and "Newest 25 of 274 alerts" — before this change both tables
rendered as if the page were the window, and the volume that survives compose
down is exactly where that matters.
Teeth, each reverted and counted, then restored: headers removed -> 2
integration failures; limit/offset clamped instead of refused -> 13; streak
header counted against the map again -> 1; standingTotal counted as the map size
-> 1 unit + 1 integration.
Gates on this tree: unit 128/128, integration 89/89, smoke passed 19 failed 0,
compose 43 passed 0 failed, console 42 assertions 0 failed.
|
||
|
|
e1f7456629 |
The numbers now describe a run of the tree that has the provenance fix
README.md and .github/workflows/ci.yml quoted counts measured at |
||
|
|
8fba8447e9 |
A misspelled provenance filter deleted the operator's own block list
ParseSource mapped any unrecognised string to BlockSource.Operator. Measured on
the shipped image (openwaf:ci), with two operator blocks and three engine bans
live:
GET /admin-api/blocks?source=enigne -> 200, the operator list, engine bans hidden
DELETE /admin-api/blocks?source=enigne -> 200 {"deleted":1}, then operator=0 engine=3
The caller who mistyped "engine" while clearing automatic bans erased the
operator's hand-maintained list instead — the exact failure the comment above
that endpoint says the provenance parameter exists to prevent. A missing source
was already refused with 400; a misspelled one was not.
After the fix, same image, same script:
GET ?source=enigne -> 400 source must be operator|engine|all; got "enigne"
DELETE ?source=enigne -> 400, counts unchanged (operator=2 engine=3)
DELETE ?source=engine -> 200 {"deleted":3}, then operator=2 engine=0
Two more of the same family, both measured on the image:
expiresInMinutes: 0 and -5 -> 204 with expiresAt: null. Not "no expiry given",
but a permanent allow entry — the one control that outranks every ban — from
a field left at zero. Absent is now the only way to say never; present must
be 1..5256000 or it is a 400. The console page refuses 0 in the field before
the round trip, and the gate asserts both halves: 0 is refused, empty still
means never.
a 1 MB reason and a 1 MB note -> 204, and the listings then returned
~1,000,287 and ~1,000,722 bytes for a handful of rows. Operator notes are
bounded at 512 characters, the budget the attacker-written path field
already gets, so the two columns in the same table are the same size.
unit 126/126 (unchanged), integration 62 -> 73 (+11), console 37 -> 39
Teeth, each measured by putting the old line back: old ParseSource -> exactly 5
integration tests fail; expiry guard off -> exactly 3; length guards off ->
exactly 1.
|
||
|
|
870db6b97e |
The numbers now describe a run of the tree that has the redirect guard
Rehearsal and the local Actions runner were both re-run at
|
||
|
|
00f6dd9513 |
A block's redirect target went into a header unchecked, and one of them turned the block into a 500
Measured on the shipped image (openwaf:ci). POST /admin-api/blocks answered 204 for every one of these, and the next request from that source paid for it: "https://example.com/ok" 301 Location: https://example.com/ok "http://bad target" 301 Location: http://bad target "http://x.invalid/<CRLF>X-Injected: 1" 500 Internal Server Error, Content-Length: 0 "javascript:alert(1)" 301 Location: javascript:alert(1) "not-a-url" 301 Location: not-a-url The CRLF row is the defect rather than the wart: Kestrel refuses to write the header, so the operator's own block — written with a 204 — became a server error for that visitor. Nothing was injected; the server validated the header, which is the only part of the old behaviour that was safe. javascript: and data: are absolute URIs too, and a redirect is a navigation, so those are an execution request made on the operator's behalf by a string somebody typed into a form. RedirectTarget.IsSendable is now the one judge: absolute, http(s), no control characters or surrounding whitespace. The API answers 400 naming the field, and DecisionEngine ignores a target it cannot send and answers the block's own default instead — for a row that arrived by a restored backup or a hand edit, where the API guard never ran. The console gate also asserts the other half of the same boundary: every value that came from the API is rendered through esc(), and two of those values are not authored by the person reading the page — the path in an observation row is whatever an anonymous visitor asked for, and a block reason is a form field. The seed now sends a percent-encoded path carrying <img onerror=...> and an operator block whose reason carries <svg onload=...>, and the page must show both as text and create no elements from them. unit 105 -> 126 (+21: the target table, and the decision point's fallback) integration 55 -> 62 (+7: 400 by name for five targets, a valid target reaching the wire as 301, and a hand-written row with CRLF answering 301 to the default target instead of the 500 it used to answer) console 33 -> 37 assertions Teeth, each measured by removing the thing: esc() reduced to identity in the shipped page makes the console gate go red with 6 failures, and the page title becomes "XSS" — the anonymous visitor's path executed script in the operator's browser. Dropping the API guard fails exactly 5 integration tests; dropping the decision-point guard fails exactly 6 unit tests and the 1 hand-written-row test. |
||
|
|
5e16e7e28c |
The README numbers now describe a run of the tree that has the policy ranges
Rehearsal and the local Actions runner were both re-run at |
||
|
|
52f4167867 |
A policy value nobody believed was stored, echoed back, and obeyed
The admin API answered 200 to anything. Measured on the shipped image
(openwaf:ci) before this commit:
PUT {"streakThreshold":0} -> 200, streakThreshold still 3, 0 log lines
PUT {"maxTrackedSources":0} -> 200, unchanged
PUT {"banDurationMinutes":-1} -> 200, unchanged
PUT {"streakWindowMinutes":0} -> 200, unchanged
PUT {"refusalRange":"not-a-range"} -> 200, unchanged
PUT {"engineBlockStatus":999} -> 200, and the edge answered HTTP/1.1 999
PUT {"engineBlockStatus":1000} -> 200, and every banned request died as
"curl: (1) Unsupported HTTP/1 subversion
in response" — no HTTP response at all
PUT {"ipv4KeyPrefixLength":0} -> 200, one 404 banned the key "*", and the
next three never-seen addresses were
refused on their first request
PUT {"ipv4KeyPrefixLength":999} -> 200, GET echoed 999, enforcement used 32
Two different failures hid behind that 200. A value the code did not want was
dropped without a word, so the operator read "OK" over a policy that had not
moved. A value the code did want was stored and obeyed literally, and one of
those (engineBlockStatus=1000) takes the site down for every banned visitor
from one admin call.
So the ranges now live in one place, PolicyBounds, next to the reason for each
one, and three layers read it:
* the admin endpoint answers 400 naming the key and the range — the same
shape mode, geo and the state TTL already used;
* the loader ignores a row outside the range and logs the key and the value,
for a backup restored or a row edited by hand;
* DecisionEngine refuses to put an unsendable status on the wire at all, and
answers 403 instead.
ipv4KeyPrefixLength keeps a floor of 8 rather than 0, because 0 is not a coarse
grouping, it is the literal key "*" — one streak and one ban shared by every
IPv4 address on the internet.
Tests: 46 unit (the bounds table, the "*" mechanism, the wire guard) and 18
integration (400 by name, a refused write changing nothing, an accepted value
reaching the wire as 451, a hand-edited row ignored). Teeth, each measured by
removing the layer: no API validation -> 16 integration tests fail; no wire
guard -> 3 unit tests fail; no loader gate -> 1 integration test fails.
|
||
|
|
0a6520eeba |
Every number that describes a run now describes a run of this tree
The retention tests changed the integration count from 34 to 37, and three places quoted the old count as if it were current: - README, Linux rehearsal paragraph: re-ran the whole rehearsal at |
||
|
|
c7dae284e0 |
Retention had a privacy answer and no test that ever ran it
RetentionWorker is the reason this project can say a source key sits in the database for a bounded time: observations older than ObservationRetention, engine bans expired before BanRetention, and alerts older than BanRetention get deleted on a timer. Both windows default to 7 days. Nothing had ever called PruneAsync. Not a unit test, not scripts/smoke.sh, not scripts/compose-smoke.sh, not the CI workflow — the worker is registered as a hosted service with a 30-minute first tick, so no gate in the repo reaches it. The claim "the aggregates age out" was a number in a record and an unexecuted code path. Three integration tests now execute it (dotnet/OpenWaf.Tests.Integration/ RetentionPruneTests.cs): - observations: 3 sources written and flushed, 2 backdated 8 days -> prune leaves 1. This also pins the DateTimeOffset-vs-SQLite-text comparison: a wrong offset ordering would delete all three or none. - blocks: an engine ban expired 8 days ago goes, one expired yesterday stays (an automatic ban has to stay explainable after it stops being live), and an operator row is never touched — neither the one with a past expiry nor the one with none. - alerts: 9 days old goes, 6 days and 2 hours old stay. Teeth, counted rather than assumed: making PruneAsync return before its first delete fails exactly these 3 tests and leaves 34 passing. Gates on this tree: build 0 warnings / 0 errors, unit 59/59, integration 37/37. What this did NOT find: the worker is not broken. Prune works on SQLite, keeps operator rows, and respects both windows. What it did find is that BanRetention and ObservationRetention are read from nowhere — no configuration key, no admin surface — so an operator who needs a shorter window than 7 days has no lever, unlike the snapshot TTL (OPEN-13). That asymmetry is recorded as an open question rather than fixed here, because the window is a privacy and forensics tradeoff, not a knob to hand out by default. |
||
|
|
e892472d16 | Reflow the paragraph about running the workflow locally | ||
|
|
05ea079b45 | The act run in the README names the commit it was run at | ||
|
|
a9c49236b7 |
Two pushes in a row no longer queue two full gate runs
The workflow triggers on every push with no concurrency group, so pushing twice in a minute runs the whole gate set twice, in series, and the second run's numbers are the ones a reviewer reads while the first is still scrolling. concurrency is now set per workflow+ref with cancel-in-progress: false. The false is the considered half: a finished run is the evidence a merge decision gets read later, so cancelling the run that is already executing throws away proof to save nothing. GitHub still drops the runs that were only queued. Verified by executing the file again rather than trusting the schema: actionlint 1.7.12 exits 0, and act (0.2.89, catthehacker/ubuntu:act-latest) plays all five jobs green on this commit - lint (shellcheck 0.11.0, pinned), source (unit 59/59, integration 34/34, smoke 19/19), image (openwaf:ci 261 MB, compose smoke 43 passed / 0 failed), console (33 assertions, 0 failed), freshness (pin 2026-10 current). 95 assertion lines across the three live gates, same as before the change. |
||
|
|
bef197ec83 |
The honest-status comments now say what actually ran, and at what level
Three files said "this has never run". After executing the workflows with nektos/act 0.2.89 on catthehacker/ubuntu:act-latest, that sentence was too broad, and a status note that is too broad is the same mistake as one that is too narrow. What is true, per file: - ci.yml: all four jobs executed start to finish and reported success — lint (actionlint 1.7.12 and shellcheck 0.11.0 both download, verify their sha256 and find nothing), source (unit 59/59, integration 34/34, smoke 19/19), image (openwaf:ci 261 MB, compose smoke 43 passed / 0 failed), console (33 assertions / 0 failed with playwright@1.63.0 and chromium-1243; the screenshot step published console-evidence.png 335998 B and console-evidence.phone.png 264597 B). - geo-freshness.yml: the job executed ("pin 2026-10 / newest 2026-10 / the pin is current", exit 0). The schedule has still never fired, and that is the part the file is for. - README: the same numbers, plus the point the run bought — ubuntu-latest ships shellcheck 0.9.0-1, developers run 0.11.0, and the two disagree about one line of scripts/geo-db-bump.sh. Fixed in the previous commit. The distinction each file keeps saying out loud: a local Actions-compatible runner proves the YAML plays and the pinned tools resolve. It does not prove a GitHub-hosted run is green, and the repository still has no remote. |
||
|
|
a48ebd650d |
Running the workflow, not just linting it, turned the lint job red
The workflow file had never been executed anywhere. It was linted, and its
steps were run by hand through scripts/ci-gates.sh, but nothing had ever taken
the YAML and played it start to finish. nektos/act (0.2.89, sha256
48ae218af96725f7635a66de2b87e1e346893b02add0f16b92f560296b2151fc) does that in a
Docker container, so the file itself got executed.
It found a defect on the first run. The lint job called `shellcheck` expecting
the copy baked into ubuntu-latest - 0.9.0-1, per the runner image's own package
list. Local shellcheck is 0.11.0 and says nothing about
scripts/geo-db-bump.sh:42; 0.9.0 flags it (SC2015: `A && B || C` is not
if-then-else). So the gate's verdict depended on which tool version the image
happened to ship, and the first push to a real runner would have gone red on a
pattern that is legal, just ambiguous.
Two changes, both version-independent:
- geo-db-bump.sh: the guard is now an explicit `if [ -z "$newest" ] || [
"$newest" = unknown ]`. Verified with the version that found it: shellcheck
0.9.0 in a Linux container now exits 0 over scripts/*.sh, and 0.11.0 on the
host exits 0. The script's behaviour is unchanged: DRY_RUN with a current pin
exits 0 ("nothing to do"), and an edition the vendor does not serve exits 2
("REFUSED - the freshness check could not name a newer release").
- ci.yml: shellcheck is pinned to 0.11.0 with a checksum per architecture, the
same way actionlint already is, and the step prints the version so the log
says which version did the linting.
Executed end to end in act on catthehacker/ubuntu:act-latest, arm64:
lint - Job succeeded (checkout, actionlint 1.7.12 sha256 OK, shellcheck
0.11.0 sha256 OK, 0 findings over scripts/*.sh)
source - Job succeeded (setup-dotnet, restore, build, unit, integration
34/34, smoke 19/19)
image - Job succeeded (docker build -> openwaf:ci 261 MB, compose smoke
43 passed / 0 failed)
This is not GitHub: it is a local Actions-compatible runner, so it proves the
file executes and the pinned tools resolve, not that a GitHub-hosted run is
green. The console job is the remaining one and is reported separately.
|
||
|
|
e6373a6289 |
The rehearsal paragraph names the commit the numbers came from
Re-ran the full Linux rehearsal at |
||
|
|
5722d64529 |
The lint job linted one workflow file while the repo has two
actionlint in ci.yml was invoked on .github/workflows/ci.yml only, so geo-freshness.yml — the scheduled geo gate — was linted by whoever happened to run it locally, not by the pipeline. A workflow added later would have been unlinted by default, which is how a gate quietly stops covering the thing it is for. Fixed by globbing the workflows directory, so the step covers whatever is there instead of a list someone has to remember. Verified on this commit: actionlint 1.7.12 -no-color .github/workflows/*.yml exits 0 with no findings over both files (ci.yml, geo-freshness.yml). |
||
|
|
a6cc42065a |
The admin-token comment said the same thing twice, and its numbers were stale
The reasoning paragraph in AdminEndpoints was pasted twice by an earlier patch,
and the measurement it quoted ("0 token lines at the shipped level, 2 at
Information") came from a single request without saying so. Re-measured against
the image built from this tree (openwaf:ci, 261 MB): one query-string request
leaves 0 lines containing the token at the shipped level and 2 at Information -
"Request starting" and "Request finished" - so two such requests leave 4, and
a header request leaves 0 at either level.
Teeth counted on this tree, not on the earlier one: guarding the warning behind
an env var that is never set makes exactly 1 integration test fail -
A_token_in_the_query_string_is_served_but_named_in_the_log_without_the_secret -
and leaves 33 passing. The sibling test cannot catch that removal: it asserts
the absence of a warning, so it passes either way. The pair is one trap, not two.
Gates on the committed tree: build 0 warnings / 0 errors, unit 59/59,
integration 34/34.
|
||
|
|
3f39029c22 |
The rehearsal numbers in the docs were one commit behind the tree
README quoted unit 58/58 and integration 32/32 for the Linux rehearsal, and
ci.yml's header quoted 32/32. Both were true when written; the tree has 59 unit
and 34 integration tests now, so the docs were quoting a run that no longer
matches the code they describe.
Re-ran every gate this head had not been run on, on
|
||
|
|
842b70566f |
The query-string token is kept, but it no longer happens silently
?token= on the admin API is an affordance for an operator typing curl; the console never uses it and none of the gates do (0 occurrences of token= in scripts/). Refusing it is how an operator ends up switching auth off instead of learning the header. What was wrong was the silence. Measured on the shipped image before deciding: a container hit with /admin-api/state?token=<secret> logged 0 lines containing the token at the shipped level (Microsoft.AspNetCore: Warning), and 2 lines at Microsoft.AspNetCore=Information, including the full URL. Raising that level is the ordinary next move while debugging, so the leak is one environment variable away, not a hypothetical. Now a request authenticated by the query string logs a warning naming the path and never the token. Two tests: the query form is served and named; the header form produces no such warning and no token anywhere in the captured logs. Teeth: delete the warning and exactly the query test fails (1 failed, 33 passed). Also refreshed the ci.yml header, whose Linux numbers had gone stale (54/54 + 30/30 + 41/41 -> 59/59 + 32/32 + 43/43 + 33/33), and kept the wall clock quoted as measured once rather than current. Gates: build 0 warnings, unit 59/59, integration 34/34, actionlint 0 problems. |
||
|
|
eea385e90c |
A refusal ended the error run but not the alert episode, so the next outage was silent
Review finding on the edge-trigger rule. The Refusal branch zeroes ConsecutiveServerErrors without clearing LastAlertedServerErrors, so a source alternating 5xx with 4xx kept a stale "already alerted at 12" mark while its error count restarted at 1: the next twelve broken answers stayed silent until the count doubled the stale mark. One refusal inside the window was enough. Now the mark goes with the run it describes. A_refusal_ends_the_server_error_ episode_so_the_next_outage_is_not_silent pins it: 3 alerts, one refusal, 3 more alerts. With the reset removed exactly that test fails (1 failed, 58 passed). Gates: build 0 warnings, unit 59/59, integration 32/32, smoke 19/19. |
||
|
|
34a13ce796 | D5: the alert dedup is per process, and two edges is where that shows | ||
|
|
b2ae7754b2 | The rehearsal numbers in the README were the ones from before this change | ||
|
|
9615352144 |
Both alerts were level-triggered, so a storm wrote one alert row per request
The streak engine raised an alert on every response once the count was past the threshold, and neither condition ends on its own: a 5xx never bans, and in Observe mode nothing bans at all, so the source stays observable on every request. Measured on the shipped image in the compose gate: 12 upstream 502s at N=3 wrote 10 alert rows, and 11 refusals in a dry run wrote 9. That is attacker-shaped growth kept for the whole retention window, and the operator's alert list (newest 100 in the console, limit=500 on the endpoint) showed one source and nothing else. Both kinds are now edge-triggered: one row on the crossing, then one per doubling. Same two measurements answer 3 and 2. A gap past the window or a clean answer ends the episode, so the next outage announces itself again — alerting once per source per process would hide an outage that got ten times worse while nobody was looking. Teeth, measured rather than asserted: with IsEscalation forced to the old level-triggered answer, exactly the four new unit tests and the two new integration tests fail, and the compose gate reports 10 and 9 and fails those two checks; the other 41 compose checks stay green. Gates on this commit — host (macOS): build 0 warnings, unit 58/58, integration 32/32, smoke 19/19, image 261 MB, compose-smoke 43/43. Linux rehearsal (scripts/ci-linux-rehearsal.sh): source, compose and console gates all PASS, exit 0. |
||
|
|
f7ced94f75 |
The TTL knob got measured, and a sentence in the research turned out to be stale
`research/2026-10-01-multi-instance/RESULTS.md` said, correctly at the time, that
the snapshot TTL "is not operator-tunable... so 'shorten the TTL' is currently a
rebuild, not a deployment change". OPEN-13 made it
`OpenWaf:State:RefreshTtlSeconds` (validated 1-300 s, startup aborts naming the
key outside that range). A claim that was true and is now false is still a claim
sitting in a document, so it is corrected in place, with what changed and when,
rather than quietly rewritten.
`run4.sh` measures the option that claim was blocking. Same stack and same method
as D3 — edge-b serves a steady 200-only stream from one source (a refusal stream
bans its own probe, which is the mistake `run2.sh` made), edge-a writes an
operator block at t0, the first sample edge-b answers as a refusal is the
propagation number. Two phases, and the TTL is read back from `/healthz` rather
than assumed from the environment, because a typo in the key name would otherwise
measure 30 s twice and report it as two different settings.
ttl=30 (default) samples=1223 over 44.1 s (~27.7 req/s) enforced 23 100 ms after the write
ttl=5 samples=1247 over 44.3 s (~28.1 req/s) enforced 3 367 ms after the write
**23.1 s → 3.4 s: a 6.9x cut**, and the 30 s phase independently reproduces D3's
23.7 s, which is the second time that number has come out the same.
What it does not say. The request path through edge-b during the same runs: p50
1.75 ms / p95 3.15 ms at TTL 30, p50 1.93 ms / p95 2.78 ms at TTL 5, n=200 each.
The two percentiles move in opposite directions, so the honest reading is "inside
noise", not "cheaper" — and a shorter TTL is more refresh round trips per process
per minute (12 against 2), cheap at the snapshot size that was measured (~3 ms of
queries at 2000 blocks) and unmeasured at any larger size.
For OPEN-12 this turns option (b) from an assumption into a measurement, and
leaves its limit exactly where it was: shortening the TTL fixes propagation, and
does nothing about D1 — four refusals split 2+2 across two edges at threshold 3
still produce no ban anywhere. The streak map is still the thing that would have
to move.
`docs/ARCHITECTURE.md` evolution triggers 2 and 3 updated with what is now true:
the geo-staleness trigger partly fired and was handled (including the case the
90-day runtime alarm does not catch), and the multi-instance trigger now carries
both reproduced findings and the measured TTL effect.
|
||
|
|
cbee0e4208 |
The geo endpoint gets asserted as an endpoint, not only as a pill
Last commit covered `/admin-api/geo` behaviourally: the page fetches it and the
summary pill fails if the value is missing. That is coverage of the page, not of
the contract { if a field were renamed, or `loaded` started answering for
something else, the pill could still render and the assertion would still be
satisfied by the shape it happens to look for.
Three direct assertions in `compose-smoke.sh`: the endpoint says a database is
loaded, names what it loaded (`DBIP-Country-Lite`), and reports an age in days as
a number. 38 → **41 assertions**.
The helper that reads scalar fields caught itself: `jval` printed Python's `True`
where the assertion expected JSON's `true`, so the first run failed on spelling
rather than on the product. It emits JSON spellings now.
Numbers: host **41 passed, 0 failed**; the same script in the Linux rehearsal
(`docker:cli`, host daemon) **41 passed, 0 failed**. actionlint 1.7.12 over both
workflow files: 0 problems; shellcheck and `bash -n` clean.
|
||
|
|
208b04290b |
Two endpoints the console read and no gate had ever called
An audit of the admin surface by gate coverage turned up two endpoints with zero
appearances in any gate: `/admin-api/state` and `/admin-api/geo`. The first is
the one the console's entire summary line is built from — the page could have
been reporting a mode the edge is not in, or a ban count that is not the count,
and every assertion in every script would have stayed green.
`/admin-api/state` also lacked one field the summary needs. It reported the age
of the in-memory snapshot and not the TTL that age is measured against, so
"snapshot 0.4s" was half a number. On a single edge the TTL is invisible; behind
a load balancer it *is* the delay a ban has, which is the whole subject of the
multi-instance question. `/healthz` already reported it — the endpoint the page
actually reads did not.
The summary line now says, in one place an operator looks at:
mode Enforce · snapshot 0.1s / ttl 30s · tracked 3 · engine bans 0
operator blocks 0 · allow entries 0 · geo DBIP-Country-Lite · built 2026-10-01 · 0.6d
The geo pill is marked past 90 days, the same rule `/healthz` reports as
`geoStale`, and the assertion checks it is *not* marked while the database is
inside the alarm — an always-green warning is a warning nobody reads.
Gates: `compose-smoke.sh` asserts `/state` at the moment a ban exists, so the
numbers have known values rather than "some number" — mode `Enforce`, TTL `30`,
`engineBans` 1 — 35 → **38 assertions**. `console-check.cjs` asserts the TTL in
the summary, the geo database with its build date and age, and the marking: 30 →
**33** assertions. `SnapshotStalenessTests` got the
fast half for the new field.
That test caught the test, not the product: the first version read `/state` with
a bare client and got a 401, because the admin surface is token-gated while
`/healthz` deliberately is not. The endpoint was right and the test was wrong.
Numbers on this tree. Host: build 0 warnings, unit 54/54, integration **30/30**,
compose-smoke **38/38**. Linux rehearsal, one invocation, EXIT=0: source gates
54/54 + 30/30 + smoke 19/19, compose **38/38**, console **33/33** in a real
Chromium. actionlint 1.7.12 over both workflow files: 0 problems; shellcheck,
`bash -n`, `node --check` clean.
Still the same boundary as every other commit here: none of it has executed on a
runner, because the repository has no remote (OPEN-15).
|
||
|
|
8082e6a598 |
The alerting pillar had an endpoint and nobody reading it
`GET /admin-api/alerts` appeared in **zero** gate scripts. Both alert kinds were proven in-process, against `FakeUpstream`, at the database level — and the half that matters for an alert, the half where a human sees it, had nothing on the other end. The console read six endpoints and this was not one of them. The page now renders them: kind, source, count, last status and path, when. The kind an operator has to act on is marked rather than only printed, and the note above the table says what each kind means in words, because `server_error_streak` and `candidate_ban` are different sentences: your upstream is failing (and the edge will not ban the visitor who saw it) versus the rule would have banned and the mode is Observe. `scripts/console-smoke.sh` seeds four 502s from an address chosen for this run (`/boom`, added last commit), and `scripts/console-check.cjs` asserts the row by **source and count**, the note text, the marking, and that the table survives the phone pass: 26 → **30 assertions**. The wiring was the interesting part. The seeding runs in one container and the browser in another, so the address chosen at seed time cannot be inherited — an empty `SEED_ERROR` on the driver side would have quietly turned "the alert this run wrote" into "some alert exists somewhere". The seed now writes its values to `console-seed.env` (gitignored) and the rehearsal passes them to the browser container. `AdminConsoleTests` got the fast half: the markup contains the alerts table and fetches the endpoint. A static check cannot assert the row is there — that is what the browser gate is for — but it can notice the table disappearing without waiting for Chromium. 28 → **29 integration tests**. Numbers. Host: build 0 warnings, unit 54/54, integration 29/29. Linux rehearsal, one invocation on this tree, EXIT=0: source gates 54/54 + 29/29 + smoke 19/19, compose **35/35**, console **30/30** in a real Chromium. actionlint 1.7.12 over both workflow files: 0 problems; shellcheck, `bash -n` and `node --check` clean. Two things said plainly. The console number above is the Linux one: this laptop's browser cache has chromium-1223/1228/1234 and the pinned Playwright wants 1243, so the darwin console gate was not re-run for this change. And during the run the table's own note read "Newest 25" — the endpoint is capped and residue from earlier runs fills the page. That is OPEN-18's amplification showing up where an operator would see it, and the note states the cap instead of pretending the table is everything. |
||
|
|
b6126c2fd2 |
Two rules that had only ever been proven inside a test process
`Server errors alert, they never ban` and `Observe mode records the decision and
blocks nothing` are the two claims that protect honest traffic from this WAF: a
bad deploy must not lock out the site's own visitors, and a dry run must be
judgeable before it is allowed to act. Both were proven in-process, against
`FakeUpstream`, in `EdgeBlockingTests`. Neither had ever been proven against the
image users actually run. And `GET /admin-api/alerts` appeared in **zero** gate
scripts — the operator-visible half of the alerting pillar had no gate at all,
which is how the console gate found its first bug: everything below the surface
looks fine while nothing reads it.
`deploy/upstream.conf` is nginx's own default plus one path that answers 502,
mounted read-only into the compose upstream. `scripts/compose-smoke.sh` grew two
sections, 28 → **35 assertions**:
- server errors alert, and never ban
a 502 reaches the client through the edge / four 502s did not ban the source
that saw them / no engine ban written / a server_error_streak alert exists
- Observe mode records the decision and blocks nothing
five refusals still reach the upstream / no ban written / the dry run is
visible as a candidate_ban alert
Numbers: host **35 passed, 0 failed**; the same script in the Linux rehearsal
(`docker:cli` against the host daemon) **35 passed, 0 failed**.
Two lessons about counting, both written into the script:
- The data volume survives `compose down`, so an absolute alert count asserts
history rather than this run. Alerts are counted as a delta now.
- The alert is written *after* the response is, so a count read the instant the
last request returns undercounts. The first version of the measurement line
printed 1 where the settled number is 2. A number that is wrong by a race is
worse than no number, so the count is taken after a pause.
The measurement itself is the finding: **4 requests past N=3 wrote 2 alert rows**
— one row per response past the threshold, not one per source. A real 5xx storm
therefore writes at request rate. Retention ages alerts out (`BanRetention`), so
they do not accumulate forever, but the write rate is a number an operator should
know before their upstream falls over.
Honest about the fixture: the 502 is nginx returning it directly, not an
application failing behind nginx. The edge's classifier sees a status code on a
socket, which is exactly what the rule is about; the fixture does not simulate a
crashed process, and nothing should read it as if it did.
|
||
|
|
7afa7541a2 |
The geo pin has a shelf life now, and a gate that checks it
The Dockerfile pins `ARG DBIP_VERSION=YYYY-MM`, and moving that pin was a habit
someone kept by hand: 2026-10 on 2026-10-01, 2026-09 the month before that. The
runtime answer was not better. `/healthz`'s `geoStale` is a 90-day alarm, and a
month behind is not 90 days. Measured on this tree: a container whose named
volume held `dbip-country-lite-2026-09` while the Dockerfile asked for `2026-10`
reported `geoBuiltAt: 2026-09-01T01:32:45+00:00` and `geoStale: false` — and
every geo assertion in `compose-smoke.sh` stayed green, the country deny list
still refusing 8.8.8.8 with 451. The policy was being enforced on a database
nobody chose, reported as healthy.
Three pieces:
- `scripts/geo-db-freshness.sh` compares the pin with the newest release the
vendor actually serves (14 HEAD probes, newest first). Three exit codes, not
two: 0 current, 1 the vendor has something newer, 2 could not tell — no
network, or a pin the vendor has never served, which would make the image
build fail on a 404. `MACHINE=1` prints one line for the bump script.
- `scripts/geo-db-bump.sh` rewrites the ARG and prints the two commands that
make the new database actually land. It refuses to write anything when the
check could not run: a pin moved on the strength of a check that did not run
is worse than a pin left alone.
- `.github/workflows/geo-freshness.yml` runs the check on the 1st and the 8th
(dbip publishes on the 1st; the second date catches a late publish or one
failed run). It deliberately does not open a PR — a bot that cannot run the
geo assertions bumping a data dependency is a worse default than a red job.
`scripts/compose-smoke.sh` grew the assertion that ties the pin to the running
container: `the loaded geo database is the pinned one`. Its teeth were checked,
not assumed — the stale volume above produced exactly one failure:
FAIL the loaded geo database is the pinned one Dockerfile pins 2026-10, the container loaded 2026-09
a named volume is seeded once: docker volume rm openwaf_openwaf-geoip
compose smoke: 27 passed, 1 failed
and after `docker volume rm`, **28 passed, 0 failed**.
Numbers on this tree. Host, `scripts/ci-gates.sh all`, EXIT=0: build 0 warnings,
unit 54/54, integration 28/28, smoke 19/19, image 261 MB, compose-smoke 28/28.
Linux rehearsal (third run today), EXIT=0: source PASS (54/54, 28/28, 19/19),
compose 28/28 with enforcement lag 36 ms, console 26/26. The freshness script
itself in `mcr.microsoft.com/dotnet/sdk:10.0`: current pin exits 0, a forced
`PIN=2026-05` exits 1 with the bump command. actionlint 1.7.12 over both
workflow files: 0 problems; shellcheck and `bash -n` clean.
Honest edges. The scheduled job has never run, because the repository has no
remote; and GitHub disables schedules on a repository with no push for 60 days,
so a cron is a nudge with a failure mode. A red freshness job can mean "no
network" rather than "stale" — the message names which, and exit 2 is not exit 0.
|
||
|
|
e02e442ae2 |
The console gate has a Linux number now, in a real Chromium
The rehearsal covered the dotnet suites, smoke.sh and compose-smoke.sh, and then printed "console gate: not covered here (needs a real Chromium)". That was the one honest line in the summary, and it was also the last hole: the console job in `.github/workflows/ci.yml` runs on ubuntu-latest, so its gate was verified only on darwin. `scripts/ci-linux-rehearsal.sh console` closes it. `scripts/console-smoke.sh` grew `SEED_ONLY=1` (start the stack, seed the streaks/bans/allow entries the page must show, then stop before driving the page) and an `EDGE` override, so the seeding half runs in `docker:cli` against the host daemon and the browser half runs in `mcr.microsoft.com/playwright:v1.63.0-noble` — the Playwright version pinned there is the version the CI console job pins, or the rehearsal is rehearsing something else. The stack is torn down either way. Two facts about that image, both now comments in the script: - It ships the browsers (`/ms-playwright`: chromium-1243) but **not** the npm package — there is no playwright-core anywhere in it. So the stage installs `playwright@1.63.0` into `/tmp` and points `PLAYWRIGHT_CORE` at `/tmp/node_modules/playwright-core`. - The repo is mounted read-only for this stage. Writable, the install would have dropped `node_modules` into the working tree of the checkout. The summary line also stopped lying by accident: `verdict()` now separates a stage the caller never asked for ("not run") from a stage that could not run ("skipped (no docker socket)"), and the exit code includes the console stage. Two full rehearsals on this tree, one invocation each, both EXIT=0: source gates (restore/build/unit/integration/smoke): PASS 54/54, 28/28, 19/19 compose gate: PASS 27 passed, 0 failed console gate: PASS 26 assertions, 0 failed wall: 2:14.33 (cold containers, cold NuGet cache) 72 assertions pass from inside Linux, and the console half includes the round-trip a page cannot fake: a ban drawn on the page answers 301 on the next request from that address, and the address passes again once the row is deleted. actionlint 1.7.12 (same pinned checksum as CI): 0 problems. shellcheck and `bash -n` clean. Still true: none of this has executed on a runner, because the repository has no remote. The Linux numbers narrow what a first run can discover; they do not replace one. |
||
|
|
c290aa06f6 |
Every gate this workflow runs now has a Linux number except one
`scripts/ci-linux-rehearsal.sh` (added in `42d4af9`) covered the dotnet suites
and `smoke.sh`. The third thing the objective asks CI to run — `scripts/
compose-smoke.sh` — did not have a Linux number, and "we run it on macOS against
a Linux image" is only half a proof: the script itself is the part that could be
a darwin habit.
It now runs in `docker:cli` against the host daemon, so the image build, the
stack and the asserting shell are all Linux. Full rehearsal, one invocation:
source gates (restore/build/unit/integration/smoke): PASS 54/54, 28/28, 19/19
compose gate: PASS 27 passed, 0 failed
console gate: not covered here (needs a real Chromium)
wall: 47.61 s
Getting it green surfaced two facts about the harness, not the product, and both
are now comments in the script where the next person will hit them:
- `compose-smoke.sh` asserts over JSON with **python3** (`jcount`/`jget`) and
reads the clock with it. A bare container failed **23 of 27** assertions for
nothing else. The runner image has python3; `docker:cli` does not, so the
stage installs bash, curl and python3 itself.
- The stack is created by the host daemon, so its published port lives in the
host's network namespace. Without `EDGE=http://host.docker.internal:8080`,
every HTTP assertion returns curl code `000` **while the image's own
HEALTHCHECK reports healthy** — a green stack with red assertions, the most
confusing failure this gate can produce. The gate already had an `EDGE`
override; this is what it is for.
The compose stage also printed its own instrumentation again: enforcement lag
**12 ms** between writing a ban and the edge refusing the source — the snapshot
invalidation path, measured on Linux this time.
Still true and still said plainly: none of these jobs has executed on a runner,
because the repository has no remote. The Linux numbers narrow what a first run
could still discover; they do not replace one.
|
||
|
|
bf1129a8d8 |
The failure mode on a write form is the one nobody demos
The console now writes, so the question stopped being "does the table show the ban" and became "what happens when the operator types the wrong thing". A form that accepts `not-an-ip`, says nothing, and adds no row leaves an operator believing an address is blocked when it is not — which is worse than giving them no console at all. Two assertions added to the browser gate. The API already rejected the value (`BlockStore.AddOperatorAsync` returns `not an IP address: not-an-ip`, the endpoint answers 400, the page already surfaces `body.error` in its status line); what is new is that a gate now proves that chain instead of assuming it. The run prints the actual string: `not an IP address: not-an-ip`, and no phantom row in the bans table. Console gate: **26/26**. Also measured, because a timeout written at a desk is a guess: the Linux rehearsal (`scripts/ci-linux-rehearsal.sh`, added in `42d4af9`) was re-run with `time`. Cold container, cold NuGet cache, Ubuntu 24.04.5, SDK 10.0.401: **1:02.81** wall for restore + build + unit + integration + smoke. The source job's `timeout-minutes: 25` is not close, even allowing for a runner's slower CPU. Before this, the number in the workflow was folklore from a build that once stalled ~12 minutes on a single apt-get step. No source-tree change in this commit: gate assertions and the numbers written down where the next reader will look for them. Unchanged and still said plainly: no job of this workflow has executed on a runner — the repository has no remote. |
||
|
|
42d4af9a76 |
The gates were rehearsed on the runner's operating system, without a runner
Every green number this project has quoted was produced on darwin. The workflow
runs on ubuntu-latest. That is not a cosmetic difference: a gate that passes on
macOS and fails on Linux is a local habit wearing a gate's clothes, and the
first person to find out would be the first CI run — which, with no remote, is
still a run that has not happened.
`scripts/ci-linux-rehearsal.sh` copies the tree (no `.git`, no host build
output — Linux binaries landing in a macOS working tree make the next
`--no-build` try to exec an ELF file) and runs restore, build, unit, integration
and smoke inside `mcr.microsoft.com/dotnet/sdk:10.0`. Result, first try, nothing
to fix:
Ubuntu 24.04.5 LTS, x86_64
sdk resolving global.json: 10.0.401
unit Passed! 54/54
integration Passed! 28/28
smoke passed 19, failed 0
The SDK line answers a question the workflow would otherwise have asked in front
of an audience: `dotnet/global.json` pins `10.0.100` with
`rollForward: latestFeature`, and `setup-dotnet` with `10.0.x` installs
`10.0.401` — that combination resolves, measured rather than assumed.
What it does not cover, said plainly: `compose-smoke` needs a docker daemon
inside the container, and the console gate needs a real Chromium. Both of those
already drive a Linux image, so the un-rehearsed part there is the host-side
script, not the thing under test. The script installs `python3` in the container
because the dotnet SDK image has no python and `smoke.sh` uses
`python3 -m http.server` as the upstream it knows nothing about — the runner
image has python3, so this is a rehearsal detail, not a project dependency.
Nothing in the source tree changed: this commit adds the rehearsal script and
writes down what it proved. The honest status sentence is unchanged — no job of
this workflow has ever executed on a runner, because the repository has no
remote.
|
||
|
|
31d8633975 |
A console that can only read is a dashboard, not a console
The page could clear engine bans and switch the mode. During an incident the two
things an operator actually reaches for are: put one address behind a block with
a reason, and pull one customer range back out from under the bans. Both
endpoints already existed (`POST /admin-api/blocks`, `POST /admin-api/allow`,
`DELETE /admin-api/blocks?key=`, `DELETE /admin-api/allow/{id}`,
`PUT /admin-api/countries/{code}?allowed=`); the page just did not expose them.
Now it does: a block form, an allow form with an optional expiry, a delete on
every ban row, a remove on every allow row, and a rule toggle on every country
row. Row buttons carry their key in a data attribute and one delegated handler
reads it, so nothing is spliced into an inline onclick string. Still no decision
logic on the page — every control is exactly one call.
The gate now checks the write on the wire, not just in the table, and that is
where the two findings were:
- An operator block answers **301 with the policy's redirect Location**
(`OperatorBlockStatus=301`, `DefaultRedirectTargets=[iana example]`), not 403.
A `fetch` that follows redirects walks out to the public internet and comes
back **200** — which is how the new assertion first reported "the ban drawn on
the page is not enforced" while the edge had been refusing that client with a
301 from the start. The probe uses `redirect: 'manual'` now. The same trap
would catch anyone writing a smoke check against this edge, so it is a comment
in the gate and a sentence in the README.
- The baseline probe in my own gate ran *after* the block was written, so it
asserted "reaches the upstream" about an address that was already blocked.
Caught because the numbers disagreed with each other, not because I re-read
the code.
Sequence the gate now proves end to end: address answers 404 → page writes a ban
→ same address answers 301 with a Location → per-row delete removes that one row
→ address answers 404 again; an allow entry appears with an expiry and can be
removed; a country rule is set to denied and put back. There is no DELETE for a
country rule, so "put back" is `PUT ?allowed=true` and the row stays behind
meaning "not denied" — documented rather than papered over. `console-smoke.sh`
now also clears allow entries on teardown, so a run that dies halfway cannot
leave an allowlist behind in the data volume and quietly change the next run.
The fast suite notices the controls too: one integration test asserts the write
controls are in the served page, so their removal fails in seconds rather than
waiting for the browser gate.
Gates on this commit: build 0 warnings / 0 errors, unit 54/54, integration
**28/28**, smoke 19/19, image 261 MB, compose-smoke 27/27, console **24/24**
(wire sequence above, phone pass at 375 px dark: scrollWidth 375, contrast
11.85:1, bars 67 px), actionlint 0, shellcheck 0. Unchanged and said plainly:
no job has ever run on a runner — the repository has no remote.
|
||
|
|
66df999cdf |
The country table got a shape, and the page caught me colliding with itself
The console's country view was a column of numbers. "Where is this traffic
coming from" is a comparison, so each row now carries a bar sized against the
busiest country, and the table says what it counted. No tiles, no CDN, no asset
file: the runtime image is distroless and the page has to work at the moment the
site in front of it is being attacked. A geographic map is still not here and
the README now says why plainly — the admin API exposes counts per ISO code, not
coordinates, and an outline drawn from memory would be decoration that misleads.
The first run after the change failed, for a real reason: the class I added was
`.bar`, and the page already had a `.bar` — the toolbar. The toolbar collapsed
to 0.55em tall, `div#summary` started intercepting pointer events, and every
assertion after the token click died on a click timeout. Renamed to
`.sharebar`.
The gate itself got the same treatment as the page. It used to leave a reviewer
with nothing but a stack trace; now it writes a screenshot both when the page
cannot be driven at all and when it is driven and wrong. That path was checked
by making it red on purpose: with seeds that do not match the stack it exits 1
naming 3 failed assertions and writes a 105078-byte picture.
Measured, not assumed, in the same pass:
- `ci-gates.sh` gained a `console` gate and the workflow calls it by that name
instead of retyping the script: one definition, two callers. It is
deliberately NOT in `all` — without a Chromium the gate exits 2 ("cannot
run"), which is a different answer from 1 ("the page is wrong"), and folding
it in would make the one-command entry point unrunnable off a CI runner.
- `ci-gates.sh all` no longer stops at the last gate for want of an admin
token: it was dying at compose-smoke with `OPENWAF_ADMIN_TOKEN: set …` before
it could print a verdict. The throwaway for the stack the gate starts and
tears down itself is defaulted there; the standalone scripts still refuse to
invent one, because run by hand they can be pointed at a real deployment.
- The console job publishes the desktop and phone screenshots as artifacts,
with `if: always()` so the failure case is the one you can look at. The
relative SCREENSHOT path and the `console-evidence*.png` glob were verified
locally: 107935 and 86179 bytes written.
- DBIP_VERSION 2026-09 -> 2026-10. Not a cache hit: 8348509 bytes fetched,
image 261 MB, compose smoke 27/27 afterwards.
- The trap that bump exposes, measured rather than reasoned about: the same
rebuilt image reported `geoBuiltAt: 2026-09-01T01:32:45Z` against the
existing `openwaf_openwaf-geoip` volume and `2026-10-01T01:36:12Z` after
removing it. Docker seeds a named volume from the image only when the volume
is first created, so a rebuild alone never replaces the geo database.
Gates on this commit: build 0 warnings / 0 errors, unit 54/54, integration
27/27, smoke 19/19, image 261 MB, compose-smoke 27/27, console 16/16 (desktop
bar 513 px inside a 529 px cell; phone pass at 375 px in dark mode: scrollWidth
375, status contrast 11.85:1, bars 67 px), actionlint 0, shellcheck 0. Still
true, and unchanged by any of the above: not one of these jobs has run on a
runner, because the repository has no remote.
|
||
|
|
1014712c99 |
The console was unreadable on a phone in dark mode — measured, then fixed
The console gate had never looked at anything but a 1280 px desktop in light
mode, and I had recorded that as a gap twice. Probing it properly found two
real defects, both with numbers before and after.
Contrast. The page declares color-scheme: light dark, so Chromium paints a dark
canvas — but .ok and .warn were fixed colours chosen for white paper. The
status line, which is the only feedback the page gives ("token rejected" vs
"refreshed"), measured 2.82:1 against rgb(18,18,18). Below WCAG AA. The two
colours now have dark-scheme values; the same measurement reads 11.85:1.
Width. At a 375 px viewport the seven-column tables measured 501 px and pushed
the whole document to 520 px of sideways scroll — the token field and the
summary pills slid off screen, on the one device an operator reaches for when
they have blocked themselves. Each table now scrolls inside its own box; the
document measures 375 against a 375 viewport.
The gate covers both, so the gap cannot silently reopen: console-check.cjs runs
a second pass at 375x720 in dark mode and asserts the document does not
overflow, the status line clears 4.5:1 against the Canvas the browser actually
paints (computed, not eyeballed), the standing streak is still listed, the
token is still absent from the markup, and no javascript threw. Twelve
assertions pass on this commit.
Also fixed while here: SCREENSHOT without an extension made Chromium throw
"unsupported mime type", which reads like a page failure and is not one.
Gates on this commit: scripts/ci-gates.sh all — build 0 errors, unit 54/54,
integration 27/27, smoke 19/19, image built, compose-smoke 27/27; console gate
12/12 against the running image.
|
||
|
|
b9a6c7e532 |
One definition of a gate, and a gate for the page itself
OPEN-10's honest caveat has always been the same sentence: the workflow has never executed on a runner, so it proves what CI will run rather than being green. That gap cannot be closed from this machine — the repository has no remote — but the gap behind it can. Until now ci.yml retyped every command, so "an agent ran these commands on a laptop" and "CI runs these commands" were two claims that could drift apart without anyone noticing. scripts/ci-gates.sh is now the single definition: restore, build, unit, integration, smoke, image, compose-smoke, or all. The workflow calls one gate per step, so the job log still names the gate that failed, and an operator running scripts/ci-gates.sh all before pushing is running the same file. The console had no gate at all. Its evidence was an agent driving Chromium from a script in /tmp. scripts/console-smoke.sh starts the stack, seeds a source sitting at 2 of a threshold of 3 and an operator block with a reason, drives /admin in a real Chromium and asserts seven things: the page authenticated, the standing streak is shown as current/threshold rather than as a historical maximum, the block shows its reason, observations and the country summary rendered, the token is nowhere in the markup, and the page threw no javascript. It needs playwright-core and exits non-zero when that is missing — a gate that reports success having asserted nothing is worse than no gate. The negative control was run: with a wrong token it exits 1. Verified on this commit: scripts/ci-gates.sh all end to end — build 0 errors, unit 54/54, integration 27/27, smoke 19/19, image built, compose-smoke 27/27; console-smoke 7/7 assertions against the running stack (playwright-core 1.61.1); actionlint 0; shellcheck over scripts/*.sh 0. The new console job pins playwright@1.63.0, a version checked against the registry rather than guessed, and it has never run on a runner — the README says so in the same breath as the rest of the workflow. README gains a Gates section and the per-process cost bullet now quotes the measurement instead of the worry. |
||
|
|
f516b3fc85 |
Show the streak that is standing, and make a clean answer end it
Two things, found in that order, and the second one is the reason the first
was worth building.
The console could say how many sources the edge was tracking but not which one
was three refusals from a ban. GET /admin-api/streaks now answers that with the
current consecutive count — not the maximum the durable observation row keeps,
which reports a source that has been clean for an hour as if it were still at
the gate. The payload names its own scope ("this-process") and carries the
threshold, the window and the map cap, because the number is meaningless
without them; the console says so above the table. This is the same fact the
two-edge measurement in research/2026-10-01-multi-instance/ cost real time to
establish, now visible to whoever is operating the box.
Reading that endpoint is what exposed the bug. The README promises "a 2xx/3xx
resets the streak to zero" and lists it as the mitigation for banning honest
traffic off a shared egress. StreakTracker honours that. The observer never
told it: ResponseObservationMiddleware returned early for every neutral
response, so on the wire a visitor alternating a 404 with a normal page view
accumulated refusals across every honest request and still matured a ban. The
documented mitigation existed in the domain object and not in the pipeline.
Fix: the observer calls StreakTracker.ResetIfTracked for a 2xx/3xx. No evidence
is built and no MMDB read is paid for a clean answer; an untracked source costs
one dictionary lookup. Measured in the image, 600 proxied clean answers, before
and after: p50 1.45 -> 1.50 ms, p95 2.98 -> 2.96 ms. Nothing to see.
Gates on this commit: build 0 warnings; unit 54/54; integration 27/27;
scripts/smoke.sh 19/19; scripts/compose-smoke.sh 27/27. The new tests have
teeth, checked by removing the fix: with ResetIfTracked commented out, exactly
two tests fail - the wire-level one and the streaks listing - and all 27 pass
when it is put back. On the wire in the container, threshold 3: probe, clean,
probe, clean, probe leaves a streak of 1; three consecutive probes take it to
4; one clean answer empties the list.
|
||
|
|
12a0f49d0c |
Make the snapshot TTL a setting, and say what it is for
OPEN-12's option (b) — share the block list and shorten the TTL — was not a deployment decision, it was a rebuild: EdgeStateStore.RefreshTtl was a property initialised to 30 s with no configuration binding anywhere in the tree. The measurement in research/2026-10-01-multi-instance/ showed why that matters: the TTL is not a tuning knob, it is the propagation delay between edges (23.7 s under ~36 req/s, 1.7 s on an idle one), so an operator who runs more than one instance is choosing a staleness bound they cannot set and cannot see. The key is OpenWaf:State:RefreshTtlSeconds, default 30, and the default is unchanged so nothing moves for anyone who does not touch it. A value outside 1-300 aborts startup instead of falling back silently, because a typo in the staleness bound is a security setting failing quietly. /healthz now reports snapshotTtlSeconds, so an operator can read the TTL they actually got. Verified on this commit: 49 unit and 23 integration tests pass (13 new unit cases on the parser; 3 new integration tests that write a ban the way another instance would — straight into the database, no InvalidateAsync — and show a 1 s TTL closing the window inside 5 s while a 300 s TTL keeps serving a source the database has already banned); scripts/smoke.sh 19/19; scripts/compose-smoke.sh 27/27 against the rebuilt image; in a container RefreshTtlSeconds=5 reports snapshotTtlSeconds:5 on /healthz, and =0 aborts the process with the key named in the log. One thing the check taught and the README now says instead of hiding: when startup aborts inside the image, the container stays Up with nothing listening until the HEALTHCHECK goes unhealthy. That is how every startup failure in this image looks, not something this change introduces. |
||
|
|
768dd17a88 |
Measure the two-edge deployment instead of arguing about it
OPEN-12 asks whether the per-process snapshot is worth replacing. Until now the answer rested on an SQLite measurement. This runs the deployable image against PostgreSQL with two edges and one shared database and writes down what actually happens: round-robin over two edges multiplies the effective streak threshold (four refusals split 2+2 at threshold 3 produced no ban at all), a block issued by one edge is enforced by the other after up to the 30 s snapshot TTL (23.7 s measured under 36 req/s, 1.7 s on an idle edge), and the refresh itself is not the cost (3 ms of queries at 2000 blocks, request p95 unchanged at 3.3 ms). Concurrent migrations on one database are safe. docs/ARCHITECTURE.md's multi-instance evolution trigger now points at the measurement instead of restating the worry. |
||
|
|
0161018d4d |
Say when the block listing is not the whole answer
GET /admin-api/blocks silently returned the newest 500 rows. The delete beside it is not capped, so an operator counting 500 rows on a page — or in the console — under-counts their own block list in one direction and over-trusts the clear button in the other. Found while measuring the snapshot refresh cost: 2 000 seeded blocks, 500 rows back, no word about it. The cap stays (a 2 000-row dump is not a page), but it now travels with the answer: X-Total-Count and X-Truncated headers, plus limit/offset (default 500, max 2000). The console renders the difference: showing the newest 500 of 2000, and clearing by provenance removes all of them, not just this page. Verified on the deployed image, not only in the fixture: with 600 blocks the default listing answers X-Total-Count: 600 / X-Truncated: true, and limit=1000 answers X-Truncated: false with all 600 rows. The first attempt at that check ran against a stale compose image — compose up without --build reuses it. The README and compose-smoke.sh both use --build; the check had to. Gates: 36 unit + 20 integration, 0 failed; smoke 19/19; compose-smoke 27/27; actionlint and shellcheck both 0. |
||
|
|
9491f01b86 |
CI: lint the workflow and the shell that runs the gates
A gate that is only checked by eye is a gate that fails silently. Two additions to ci.yml: * a lint job running actionlint 1.7.12 pinned by a checksum-verified tarball — not piped from a setup script, because a gate someone can move by republishing a tag is not a gate. actionlint also shellchecks the run: blocks it reads, including its own. * shellcheck over scripts/*.sh. Both smoke scripts are gates, so a broken one has to fail loudly rather than report a green run with zero assertions. shellcheck found four real things in compose-smoke.sh: an unguarded cd, and unquoted source IPs in the X-Forwarded-For helpers. Fixed; the script now passes shellcheck and still reports 27/27 against the built image. Verified, not assumed: actionlint exits 0 on this file locally (shellcheck integration active), and the lint step's body — checksum, tar, actionlint — was run on ubuntu:24.04, the family ubuntu-latest runs on, with the pinned digest confirmed against the published artifact (sha256sum -c: OK). What is still not verified is the workflow running on a GitHub runner: the repository has no remote. |
||
|
|
0a8d0e7695 |
Operator console at /admin, over the endpoints that already exist
The admin API has been complete since
|
||
|
|
2dd1c43b5c |
CI: run the four gates on every push
OPEN-2's evidence says, four times, that no CI pipeline exists and every gate was run locally by an agent. That is the weakest link in the project's claims, so this closes it: .github/workflows/ci.yml runs restore, build (TreatWarningsAsErrors is on in Directory.Build.props, so this is also the warning gate), the unit and integration suites, scripts/smoke.sh, docker build, and scripts/compose-smoke.sh against the built image. Every command in the file was run on this commit and passed: restore 0, build 0 with 0 errors, 36 unit + 15 integration, smoke 19/19, docker build 0 (image 261 MB), compose-smoke 24/24. The script's exit convention is checked both ways (rc=0 on pass, rc=1 on failure), so a failing gate really does fail the job. What is NOT claimed: the workflow has never run on a runner — the repository has no remote. The file states that in its own header, because a CI config is not evidence that CI is green. Timeouts are explicit: the first build of this project stalled ~12 minutes on one apt-get step, and a hung job is worse than a failed one. |
||
|
|
a32319b430 |
Test the property the persistence design rests on
docs/ARCHITECTURE.md claims a failed snapshot refresh keeps the previous snapshot — fail closed for blocks. Nothing held that claim: the criterion was in OPEN-4's acceptance list with no test behind it. A_failed_snapshot_refresh_keeps_the_previous_picture_of_the_operators_list drops block_entries under a live store (what a restart or a lost volume does), invalidates, and asserts the operator's block is still in the snapshot, the snapshot was not swapped, and the wire still answers 301. 15 integration tests, 0 failed. |
||
|
|
0234cc1c72 |
Verify the deployed image end to end; ship country-lite by default
The image built, but nothing had ever run it. scripts/compose-smoke.sh now asserts the ship shape against the built image: the image HEALTHCHECK reaches healthy, a streak ban is enforced over a real socket with Retry-After and a reason, a bystander from another source is untouched, an operator block redirects, an allow entry outranks it, DELETE ?source=engine cannot clear an operator row, and a denied country answers 451 while another source passes. 24 assertions, 0 failures. Two build fixes found by actually building: * ARG DBIP_VERSION was declared inside the build stage, so the geoip stage's re-declaration expanded to an empty string and the URL 404'd. Both ARGs are global now. * curlimages/curl runs as uid 100, so /geoip was not writable; the download lands in /tmp and COPY re-owns it. The bundled database is dbip-country-lite (4 MB) rather than city-lite (127 MB unpacked): the geo pillar decides on the ISO country code, and city only feeds two observation columns. --build-arg DBIP_EDITION=city restores it, and MaxMindGeoIpLookup reads DatabaseType rather than the filename, so no code change is involved either way. |