Commit Graph
94 Commits
Author SHA1 Message Date
Pavlo Ratushnyi bd1b8a4e86 185 compose assertions now, and the numbers describe the tree that has them
The gate grew by 20 assertions across two commits (19 for the country rule on
the image, 1 for the ban pillar's wait budget) and the file still said 165 in
six places, including the line that names the script's own size. Same failure
as the last two sweeps: the numbers drift away from the tree that runs them.

Swept to dc88f36, each stage re-run on this head rather than quoted from the
previous one:
  host   unit 132/132, integration 173/173, smoke 28/0, image 261 MB,
         compose 185/0, console 70/0                       (/tmp/c25_host_all.log,
                                                            /tmp/c25_host_console.log)
  linux  source gates PASS, compose 185/0, console 70/0,
         enforcement lag 20 ms, 0 containers left behind    (/tmp/c25_rehearsal.log)
  act    5 jobs succeeded, 0 failed - lint, source, image
         (261 MB, compose 185/0), console (70, 685,222-byte zip), freshness
                                                            (/tmp/c25_act.log)

The assertion history gained its two links: 165 before the image refused a
country code that is not a code, 184 before the ban scene stopped reading the
pillar at one instant.

Two paragraphs say which layer proves what, because that is the question this
cycle kept asking:
 - the country rule was proven in-process while the shipped image carried four
   country assertions, all about a rule already written correctly. Both halves
   of the teeth were measured on the image: length-only validation answers
   179/6, moving the DELETE route answers 179/6, against 5 and 2 in-process.
 - OPEN-42's read side is closed (the scene polls the pillar, prints the
   trajectory, and asserts its own wait budget; breaking it answers 178/7 with
   that assertion first). The ticket stays open for the product half: the
   pillar is only updated on the request path, so a quiet edge reports a stale
   failure count for as long as it stays quiet.
2026-10-03 01:38:03 +02:00
Pavlo Ratushnyi dc88f36d53 The ban scene now waits for the ban pillar instead of sampling one instant
The scene "a ban that cannot be written is not enforced, and says so" read
/admin-api/state and /readyz once, immediately after the fifth refusal. The
ban pillar is not updated on the request path: the write attempt and the
failure to record it land a few seconds later. So the read raced the thing it
was asserting, and the same run's log already carried the sentence the
assertions denied.

Measured on 75ee822, runs of the same tree:
  /tmp/c25_compose2.log  180 passed, 4 failed  - all four are this scene
  /tmp/c25_compose3.log  179 passed, 5 failed  - four here, plus "readiness
                                                stops saying ready" at 000
  /tmp/c24_mutA_compose.log 161 passed, 4 failed - two of them are this scene
In each case the log line "could not persist a ban for" was present while
banWriteFailures read 0 and /readyz read 200. A gate that picks a moment and
calls it a contract is not a gate: it passes or fails depending on scheduling,
and the flake hides the one regression it exists to catch.

The scene now polls the pillar for up to 20 s and prints the trajectory
("failures/notWritten: 0/0 1/1 ...") plus the reason string it quoted, so
"the counter is 0" and "the field is not in the answer" are no longer the same
word in the log. One assertion was added: the pillar reached its failure state
within the wait budget, which is what fails if the wait itself is what saved
the scene.

Teeth, measured by breaking the scene on purpose (streakThreshold 3 -> 99, so
no ban is ever attempted while the writes are blocked):
  /tmp/c25_mutD_banteeth.log  178 passed, 7 failed
  FAIL the ban pillar reached its failure state within the wait budget  expected 1, got 0
  info ban pillar after 20 s of waiting - failures/notWritten: 0/0 (ten times)
  info readyz at that moment: 200; the reason quoted: (none)

Green on this tree, three runs in a row: 185 passed, 0 failed
(/tmp/c25_fix1.log, /tmp/c25_fix2.log, /tmp/c25_fix3.log).

This is AC1 and AC2 of OPEN-42, done here because OPEN-25's definition of done
requires the compose gate to be green with numbers that hold; OPEN-42 stays
open for its remaining criteria.
2026-10-03 01:05:57 +02:00
Pavlo Ratushnyi 6422021a20 The image now refuses a country code that is not a code
The country rule had been fixed in the source and proven in-process: a
two-character non-code refused with the rule quoted, lower case normalised,
DELETE removing the rule and invalidating the snapshot, and a delete of a rule
that was never written naming the code. On the shipped image the only country
assertion in the gate was still "PUT a real country, get 451" — so every one of
those sentences was a claim about a handler, not a measurement of the process
listening on 8080. The defect this ticket describes (a rule made of any two
characters, shown to the operator as a denial and enforced by nothing, with no
way back) was only ever caught by tests that never ran against the image.

The new scene measures it over a socket: four refused codes and the sentence
each one answers with, none of them leaving a row behind, a refused write not
disturbing the rule that is already there, lower case on the wire becoming the
upper-case rule rather than a second row, that rule being the one the engine
enforces (451), DELETE answering 204 and the next request being decided without
it (404), and a delete of a rule that was never written naming the code.

The scene caught its own bug on the first run: two of its reads of the refusal
message were issued without -X PUT, so they were GETs against a route that does
not exist and printed an empty body — while the status assertion on the same URL
would have passed, because it did carry the verb. A gate that checks a status in
one request and the reason in another is not checking the reason.

Gate numbers, stated as measured rather than as hoped. This scene is 19/19 in
both runs that carried it: /tmp/c25_compose2.log answered 180 passed / 4 failed
and /tmp/c25_compose3.log 179/5, and every failure in both is in the ban-write
scene, not here. So the tree as committed has not been measured with a green
compose gate, and this commit does not claim it has. The cause of those failures
is now identified (OPEN-42): the scene reads the ban pillar immediately after the
last refusal, while the ban write attempt and its failure are recorded a few
seconds later — so the counters read 0 and /readyz reads 200 while the log for the
same run says the ban was not persisted. A run that inserted an 18 s wait before
those checks answered 184/0 (/tmp/c25_diag1.log); that wait was a diagnostic and is
not in this commit. The gate goes green for this ticket only once OPEN-42 is fixed
in the scene itself.
2026-10-03 00:08:36 +02:00
Pavlo Ratushnyi 75ee8221de 165 compose assertions now, and the numbers describe the tree that has them
Every gate was re-run on this tree and the README and the ci.yml header were
rewritten from what those runs printed, not from the last time someone wrote a
number down: host all (unit 132/132, integration 173/173, smoke 28/0, image
261 MB, compose 165/0), host console (70/0), Linux rehearsal (source PASS,
compose 165/0 with 44 ms enforcement lag, console 70/0), and act (5 jobs
succeeded, 0 failed, console-evidence.zip 685,878 bytes).

Two numbers were stale in ways a reader could not see. The console paragraph
said the gate "asserts 58 things" while the gate itself printed 70; and the
paging paragraph described behaviour that had only recently become an
image-level measurement, so it now says which layer proves it and how the
scene proves it.

The failures found on the way are written down rather than dropped. Two act
runs failed before the green one: lint refused three SC2086 findings that a
local `shellcheck -S warning` had passed over — the workflow pins 0.11.0 with
no severity filter and no local gate runs lint at all, filed as OPEN-44 — and
in the run after the fix, image died on a TLS timeout to auth.docker.io while
console read an empty observation listing in a run where the same table had
shown 11 rows a minute earlier, filed as OPEN-43. A host console run at the
previous commit answered 68/2 for the same reason OPEN-41 already describes,
and one compose run read banWriteFailures as 0 while the same scene's log and
readyz said otherwise, filed as OPEN-42.
2026-10-02 23:04:24 +02:00
Pavlo Ratushnyi 0f17d32578 The image now says which part of a listing it is sending
The paging contract had been proven in-process and, on the shipped image,
only for /allow. Everything else this ticket fixed — X-Truncated on
observations, alerts and blocks, offset reaching the rows a ceiling used to
hide, the limit and offset bounds answering 400 instead of one row, and the
streak flag counted from the standing streaks rather than from the map —
existed as a sentence about the source, not as a measurement of the process
listening on 8080.

The new scene measures all of it over a socket. It seeds five sources one
second apart so the listing's own newest-first ordering is reproducible,
then reads them back one row at a time and requires the five pages to be
five different sources and to be exactly the first five rows of the whole
listing. The total has to be the same on every page. Bounds are checked at
both ends on the image, quoting the range and the value. The streak part
deliberately leaves the map holding more sources than it has streaks to
list, because with those two numbers equal, counting the map instead of the
listing answers correctly by accident.

Three of the assertions failed on the first run and are the reason the
scene is worth having: the helper that reconciles X-Truncated with
X-Total-Count and the row count compared against "1"/"0" instead of
"true"/"false", so it said no to every honest response. It is now held to
the same check as the product: a header claiming a cut that never happened,
a header hiding a cut that did, and a missing header each fail
differently.

The unique-key counts split their accumulated string with tr rather than
with an unquoted expansion: the workflow's shellcheck job pins 0.11.0 and
runs with no severity filter, and it refused SC2086 here while a local run
at -S warning said nothing.

compose smoke: 165 assertions, 0 failed.
2026-10-02 22:21:32 +02:00
Pavlo Ratushnyi bb9ac0d927 132 compose assertions now, and the numbers describe the tree that has them
Re-measured at 9383362 rather than carried forward from 5c44b7c:

  host ci-gates.sh all      unit 132/132, integration 173/173, smoke 28/0,
                            image 261 MB, compose 132/0
  host console              70 ok, 0 failed
  Linux rehearsal           source PASS, compose 132/0 at 15 ms,
                            console PASS 70/0 on the second run
  act                       5 jobs succeeded, 0 failed; compose smoke 132/0;
                            console 70; console-evidence.zip 682,072 bytes

The Linux console stage failed once at this head — the markup-path row was not in
the observation table when the driver looked, and the driver looks once. That is
filed as OPEN-41 with both logs named; the stage was re-run and passed, and the
pass is quoted together with the failure, not instead of it.
2026-10-02 20:59:48 +02:00
Pavlo Ratushnyi 9383362468 The provenance nobody means and the bounds an entry has are now refused by the image
OPEN-23's behaviour was implemented and its integration tests were green, and not
one gate had ever sent any of it to the container an operator deploys: grep over
scripts/compose-smoke.sh for enigne, expiresInMinutes and 512 returned nothing.
The item's own steps-to-reproduce are a curl against a container, and no gate ran
one.

New scene, 19 assertions, compose gate 113 -> 132, measured 132 passed / 0 failed
on the host:

  GET  ?source=enigne            400, naming the set and echoing the value
  DELETE ?source=enigne          400, with the two operator rows still there by
                                 name and by count
  GET  ?source= OPERATOR         200 and exactly the two rows it means
  expiresInMinutes 0 and -5      400 naming 1..5256000, and nothing written
  expiresInMinutes left out      expiresAt null - still the only way to say never
  reason / note of 513           400 naming the length, and neither row written
  note of 512                    204, so the bound is not off by one

The scene writes the operator list it then proves it protected, because the scenes
before it clear the tables: an assertion that the refused delete changed nothing
would otherwise have compared 0 with 0 and passed for nothing. It removes what it
wrote and prints the block counts again.

Teeth re-measured at this head rather than carried forward, against the 11 cases of
ProvenanceAndLimitsTests: unknown provenance accepted as all -> 5 failed; the
expiresInMinutes gate disabled -> 3 failed; the note/reason length gate disabled ->
1 failed. Those are exactly the three numbers AC7 states. All three reverted; the
tree carries no mutation.
2026-10-02 20:37:02 +02:00
Pavlo Ratushnyi 7faf37a246 70 console assertions now, and each number says where it was measured
Re-measured at 5c44b7c rather than carried forward from d871d57:

  host ci-gates.sh all      unit 132/132, integration 173/173, smoke 28/0,
                            image 261 MB, compose 113/0
  host console              70 ok, 0 failed
  Linux rehearsal (all)     source PASS, compose 113/0 at 18 ms, console 70/0
  act                       5 jobs succeeded, 0 failed; console 70;
                            console-evidence.zip 692,364 bytes

The console count moved 69 -> 70 by one check: the driver now fails when the
markup seed never reached it instead of stepping around four assertions and
printing "all assertions passed".

The flake sentence is attributed to the commit it happened at, not to whichever
head this file happens to describe: it was one Linux run at d871d57, and the
three Linux compose runs since — including this one — were 113/0.
2026-10-02 19:50:48 +02:00
Pavlo Ratushnyi 5c44b7c742 A console gate that skipped its own escaping invariant used to report success
The markup-seed assertions are guarded by the seed values, and the seed values
default to empty. Measured on this head, same seeded stack, driver only:

  with the seeds:               69 ok, 0 failed, exit 0
  with SEED_MARKUP_* unset:     65 ok, 0 failed, exit 0
                                and the line "console check: all assertions passed"

Four assertions were not there and the summary line is identical either way. The
seeding script sets both today, so nothing is broken right now — what is broken is
that nothing required them to be present, in the driver or in the Linux rehearsal,
which already refuses a missing SEED_ERROR or SEED_EXPIRED_CIDR and says nothing
about these two.

The driver now names an absent seed instead of stepping around it, and the
rehearsal refuses one the same way it refuses the other two. Teeth of the new
guard, measured: the same unset run now gives 65 ok, 1 failed, exit 1, and the
failure line carries the two empty values by name.

Teeth of the invariant itself, re-measured rather than carried forward: reducing
esc() to identity in the shipped page gives 7 failures, not the 6 this item
originally counted — the filter-echo case was added after that number was taken —
and the page title becomes XSS. Reverted; the tree carries no mutation.
2026-10-02 19:32:38 +02:00
Pavlo Ratushnyi 5add3be06b 113 compose assertions now, and the measured numbers describe the tree that has them
Every gate was re-run at d871d57 rather than carried forward from 24e329d: the
host gives unit 132/132, integration 173/173, smoke 28/0, image 261 MB, compose
113/0 and console 69/0; the Linux rehearsal gives the same source counts, compose
113/0 and console 69/0; the local Actions runner gives 5 jobs succeeded, 0 failed
with compose smoke 113/0 and a 691,696-byte console artifact.

One Linux run of this same head answered 112 passed, 1 failed: the geo-restore
assertion got 000. The run after it was 113/0. That is recorded here instead of
quietly re-run until green, because the gate prints 000 for a stalled request, an
exited container and every other curl error as the same three characters, so a
reader cannot tell which of the three happened. Filed as OPEN-39.
2026-10-02 19:06:16 +02:00
Pavlo Ratushnyi d871d5791b The redirect target an edge cannot send is now refused by the shipped image, not only by the test host
OPEN-21's validator had never been driven from the image: the compose
gate wrote a valid redirectTo and asserted the 301, and never once sent
a CRLF, a javascript: or a relative target. Six assertions close that —
400 for each shape, the refusal naming the field, zero rows written for
either address, and both addresses still reaching the upstream
afterwards, which is what "no half-blocked visitor" means when the
block list is read by the next request rather than this one.

Two harness traps found on the way and written into the script: under
set -o pipefail, curl | grep -q reports failure because grep exits on
the first match and curl dies of SIGPIPE — the assertion went red about
a body that said exactly the right sentence; and a case pattern ending
in *) closes an enclosing command substitution, so the first rewrite
printed the rest of the line as the value under test.
2026-10-02 18:37:34 +02:00
Pavlo Ratushnyi e5f4ff041d 107 compose assertions now, and the rehearsal numbers describe the tree that has them 2026-10-02 18:09:49 +02:00
Pavlo Ratushnyi 24e329d2e1 The policy bounds and the status a ban answers with are now proven against the shipped image, not only the source tree
OPEN-20's guard had never been driven from the image: the compose gate
wrote policy values but never an out-of-range one, and no gate had ever
asked whether a VALID engineBlockStatus reaches the visitor. Seven
assertions close that: 400 for engineBlockStatus=1000 naming the range
400..599, the policy unchanged after the refusal, the same for
ipv4KeyPrefixLength=0 against 8..32, a banned visitor answering 451
while the operator asked for 451, and the original status back in force
afterwards.

Teeth measured, then reverted: with PolicyProblem's answer discarded,
PolicyValidationTests answer 16 failed / 2 passed and the compose gate
answers 104 passed / 3 failed on a rebuilt image. The 451 assertion
stays green under that mutation, which is the right split — it tests the
valid half, not the guard.
2026-10-02 17:29:39 +02:00
Pavlo Ratushnyi fe9b09f683 The numbers follow the tree: 173 integration tests, 100 compose assertions, 69 console assertions, and a contract line for the streak-map filter 2026-10-02 17:07:24 +02:00
Pavlo Ratushnyi b75888fa83 Every source key the console prints is now a question the operator can ask back, and the counts answer it filtered
/streaks learned the ?source= filter the observation and alert listings
learned in OPEN-33, and standingStreaks narrows with the rows while
trackedSources stays the map size. The console narrows observations and
streaks to one key from a box or from a click on any key in any table,
prints the filtered total under each, and says the words 'no recorded
observations for <key>' instead of drawing an empty box.

The first version appended '&source=' to a bare path, which is a
different route: the edge answered 404 and the streak line printed
'unknown scope'. The console gate caught it; the API tests did not,
because they call the API. Hence withSrc, which decides the separator
per path.
2026-10-02 16:21:35 +02:00
openwaf-agent bce6657150 The unit count moved because a criterion gained a test, and the numbers follow the tree
cfe47d1 added DurabilityHealthTests (4), so unit is 132/132 wherever the
README and ci.yml said 128/128, and the rehearsal/act sentences name the
commit they were measured at. Re-measured at cfe47d1 rather than carried
forward:

  host      ci-gates all: unit 132/132, integration 170/170, smoke 28/0,
            image 261 MB, compose 94/0, exit 0; console 58/0
  linux     rehearsal all: source PASS (132/132, 170/170, 28/28), compose
            PASS 94/0 with enforcement lag 12 ms, console PASS
  act       5 jobs succeeded, 0 failed; console-evidence.zip 547,433 bytes
2026-10-02 13:36:42 +02:00
openwaf-agent cfe47d10b5 The cumulative-loss criterion had no test that could fail it
OPEN-31 criterion 2 — "EntriesLost is cumulative, not a gauge: a later
successful write does not erase what was already lost" — is carried by one
character in DurabilityHealth.RecordFailure. The integration suite reads
the count after one failed flush and again after a later success, and both
of those read the same under `EntriesLost = entriesLost` as under `+=`:
the difference only appears across two failed writes carrying different
row counts, which nothing in the suite was doing.

DurabilityHealthTests (4) covers the invariant directly, plus per-pillar
isolation of recovery (a happy retention prune says nothing about the
alert writer) and the root-cause rule (EF's wrapper message is not the
reason an operator can act on).

The mutation was run, not assumed: with `+=` changed to `=`, unit answers
Failed 1 / Passed 131 and integration answers 170/170 — i.e. before this
file the whole suite was green on a build that forgot lost rows. Reverted;
132/132 and 170/170.
2026-10-02 13:16:19 +02:00
openwaf-agent 5280e24a94 The rehearsal and act numbers describe the tree that carries the renamed tests
17b764e renamed two tests without touching an assertion, so the counts did
not move — but the README and ci.yml tie their Linux and act numbers to a
commit, and after a commit those sentences point one commit behind the
head. Re-measured rather than carried forward:

  host      ci-gates all: unit 128/128, integration 170/170, smoke 28/0,
            image 261 MB, compose 94/0, exit 0; console 58/0
  linux     rehearsal all: source PASS, compose PASS 94/0 (enforcement lag
            17 ms), console PASS
  act       5 jobs succeeded, 0 failed; console-evidence.zip 543,009 bytes
2026-10-02 13:03:57 +02:00
openwaf-agent 17b764ec29 Two test names claimed a readiness verdict their bodies no longer assert
A_flush_that_cannot_write_is_counted_and_readiness_names_the_pillar and
An_alert_that_never_reached_the_table_is_counted_and_readiness_names_it
both end with Assert.Equal(HttpStatusCode.OK, readyz). They were written
when a failed reporting write did make the edge unready, and the boundary
moved — the enforcement path gates, the reporting path is stated in
numbers — but the names stayed where the old rule was. A reader picking
one of these up to check "does a lost alert take an edge out of service?"
would have got the answer from the name and the opposite answer from the
body.

Names only; no assertion changed. Re-measured at this commit: unit
128/128, integration 170/170.
2026-10-02 12:50:16 +02:00
openwaf-agent 5430ed0b6f The README carries the write-side query contract, and the numbers describe that tree
The contract section said the unknown-parameter guard refuses on the list
endpoints. It now refuses on every endpoint under /admin-api, and the
interesting part is not the coverage: it is that the guard itself had the
bug. It assumed limit/offset were legal everywhere, so GET
/admin-api/countries?limit=2 was answered with the whole table by the
image that already carried the guard.

Numbers re-measured on ac672d9, not carried forward:
  host      unit 128/128, integration 170/170, smoke 28/0,
            compose 94/0, console 58/0, image 261 MB, 0 containers
  linux     source PASS (128/128, 170/170, 28/28), compose 94/0 with
            enforcement lag 11 ms, console 58/0
  act       5 jobs succeeded, 0 failed; console-evidence.zip 534,721 bytes
  compose assertion history: ... 81 before the retry loop, 86 before the
            write-endpoint guard, 94 now
2026-10-02 12:10:09 +02:00
openwaf-agent ac672d9908 A write endpoint dropped a parameter it never implemented and changed state anyway
OPEN-33 put a guard on the read listings. The image that carried it then
answered the same request two different ways depending on the verb:

  GET    /admin-api/blocks?zzz=1                    -> 400, names 'zzz'
  POST   /admin-api/blocks?zzz=1                    -> 204, ban written
  PUT    /admin-api/policy?zzz=1                    -> 200, policy changed
  PUT    /admin-api/countries/DE?allowed=true&zzz=1 -> 204
  DELETE /admin-api/blocks?key=...&zzz=1            -> 200 {"deleted":1}
  GET    /admin-api/countries?limit=2               -> 200, every row

The silent half was the half that changes state. A misspelled scoping
parameter on a write acts with a wider scope than the caller meant, and
answers as if the scope had applied.

The guard now covers every endpoint under /admin-api, and it runs before
any state change, so a rejected write cannot half-happen. The last line
above changed the design: the guard used to assume limit/offset were
always legal, which is the same bug one level down -- /countries has no
paging to honour, so ?limit=2 was accepted, dropped, and answered with
the whole table. Each endpoint now declares its own parameter surface
and the base set is only `token`, the one parameter real for every
endpoint because the auth layer reads it (OPEN-16).

Teeth: WriteQueryGuardTests (29) asserts the 400 per endpoint, that the
refusal names the parameter that was actually sent, that a refused write
changes nothing (block, policy, country rule), that the same request
without the unknown parameter is still served, and that ?token= still
works on a write. The compose gate grew a scene (8 assertions) that runs
the same measurements against the shipped image.

Measured on this tree: unit 128/128, integration 170/170, smoke 28/0,
compose 94/0 (enforcement lag 11 ms on Linux), console 58/0, image 261
MB. Linux rehearsal: all three stages PASS. act: 5 jobs succeeded, 0
failed, console-evidence.zip 534721 bytes.
2026-10-02 12:08:02 +02:00
Pavlo Ratushnyi b90b647474 The README carries the pending-ban contract, and the numbers describe that tree
Numbers re-measured at dcf8a73: macOS host unit 128/128, integration 141/141,
smoke 28/0, compose 86/0, console 58/0, image 261 MB, 0 containers left behind.
Linux rehearsal, all three stages in one run: PASS — source (128/128, 141/141,
28/0), compose 86/0 with enforcement lag 13 ms, console 58/0, 0 containers left
behind. act at dcf8a73: 5 jobs succeeded, 0 failed — source (128/128, 141/141,
28/0), image (261 MB, compose 86/0), console (58 assertions, 524,624-byte
screenshot artifact), lint, freshness.

Prose: the cost of "readiness returns on a write, not on a timer" when the only
thing that produces that write is the attacker coming back — the t+30/60/90/120
measurement, the retry loop, and the statement that the readiness gate was not
loosened to get this.
2026-10-02 11:39:31 +02:00
Pavlo Ratushnyi dcf8a733a9 A healed storage failure returned the edge to ready without waiting for traffic
OPEN-34, measured on the shipped image before this change. With writes to
block_entries aborted, five refusals produced counted write failures and
/readyz 503. The triggers were then REMOVED — write path healthy, zero triggers
left — and no further request was sent from that source:

  t+30 s  /readyz 503   /state: banWriteFailures 3, bansNotWritten 3
  t+60 s  /readyz 503   unchanged
  t+90 s  /readyz 503   unchanged
  t+120 s /readyz 503   unchanged

The ban pillar clears only on a successful ban write, and the only thing that
produced one was the source crossing the threshold again. Readiness — the
signal an orchestrator uses to keep an edge in rotation — was therefore coupled
to attack traffic: the quieter the site, the longer a repaired edge sat out of
service, enforcing everything except one ban nobody had written.

The fix is on the write side, not on the gate. A ban the engine decided and
could not write is kept as a PendingBan and re-attempted by a hosted loop on the
same 15 s cadence the other writers use; the sentence still runs from the moment
the ban was decided, so a retry that lands late cannot quietly lengthen it, and a
pending ban whose sentence expired before it could be written is counted
(bansNeverEnforced) and reported rather than rewritten as a fresh, longer ban.
/state gained bansPendingRetry and bansNeverEnforced, because without the first
a healed storage failure is indistinguishable from a quiet site.

Teeth: PendingBanRetryTests (3) — the retry landing with no further request, the
hosted loop doing it on its own (nobody calls it in that test), and an expired
pending ban reported rather than written late. Compose gate gained a 5-assertion
scene against the shipped image: the failed ban is queued, readiness returns
after the repair with no traffic from that source, the ban reaches storage, the
queue empties, and the source that was never banned during the break answers 403
afterwards.

Gates at this commit — macOS host: unit 128/128, integration 141/141, smoke
28/0, compose 86/0, console 58/0, 0 containers left behind. Linux rehearsal,
all three stages: PASS — source (128/128, 141/141, 28/0), compose 86/0 with
enforcement lag 13 ms, console 58/0, 0 containers left behind.
2026-10-02 11:34:44 +02:00
Pavlo Ratushnyi db146271c8 The README carries the query-surface contract, and the numbers describe that tree
Numbers re-measured at 336c2f7 rather than carried from the previous sweep:
macOS host unit 128/128, integration 138/138, smoke 28/0, compose 81/0, console
58/0, image 261 MB. Linux rehearsal source PASS (128/128, 138/138, 28/0),
compose 81/0 with enforcement lag 12 ms, console 58/0 with 0 containers left
behind. act at 336c2f7: 5 jobs succeeded, 0 failed — source (128/128, 138/138,
28/0), image (261 MB, compose 81/0), console (58 assertions, 498,801-byte
screenshot artifact), lint, freshness.

Prose: a paragraph on the query surface — a parameter the endpoint never
implemented used to be dropped without a trace, the answer kept its shape, and
the guard's first run broke three tests that were right to send ?token=.
2026-10-02 10:52:34 +02:00
Pavlo Ratushnyi 336c2f74a4 A query parameter the endpoint never implemented was dropped without a trace
Measured on the shipped image (openwaf:ci, 2026-10-02) with 16 recorded
sources:

  GET /admin-api/observations?source=203.0.113.11
      -> 200, 16 rows over 16 different addresses, X-Total-Count: 16
  GET /admin-api/observations?src=203.0.113.11
      -> 200, the same 16 rows

The filter was neither applied nor refused. It was absent: minimal APIs bind
the parameters a handler declares and discard the rest, so an operator
investigating one address was handed fifteen other addresses and a total that
matched those fifteen. Every list endpoint behaved this way. This is the same
shape as the bug OPEN-23 found one level up, where an unknown ?source= VALUE
meant "operator" and a typo in a DELETE wiped the manual list.

Two changes, because a refusal alone would have hidden a fair question:

- TryKnownQuery refuses any query parameter the endpoint has not heard of,
  naming the parameter and listing what that endpoint accepts. `token` is in
  the known set on purpose: the admin auth layer reads it from the query
  string and OPEN-16 ruled that curl-friendly form stays supported. Three
  existing integration tests call /admin-api/blocks?token=… and were right to
  — a guard that does not know the whole surface refuses requests that work,
  which is a worse bug than the one it prevents.
- /observations and /alerts gained ?source=, and X-Total-Count counts the
  filtered set rather than the table, so the header answers the question that
  was asked instead of putting a 16 next to a single row. An empty ?source= is
  refused rather than read as "every source".

Teeth: QueryHonestyTests (13) — integration 125 -> 138, and the three tests
the guard broke on the first run are the proof it bites. Compose gate gained a
scene with 7 assertions (74 -> 81): the filter returns one source and no
other, the total is the filtered total, ?zzz=1 and ?src= are refused by name
on two endpoints, and the parameters the endpoint really does honour still
answer 200.

Gates at this commit — macOS host: unit 128/128, integration 138/138, smoke
28/0, compose 81/0, console 58/0. Linux rehearsal: source PASS (128/128,
138/138, 28/0), compose 81/0, enforcement lag 12 ms.
2026-10-02 10:35:38 +02:00
Pavlo Ratushnyi 858fd0148c The README carries the ban-write contract, and the numbers describe that tree
Numbers re-measured at this head rather than carried forward from the commit
the last README sweep was written against:

macOS host — unit 128/128, integration 125/125, smoke 28 passed / 0 failed,
compose 74 passed / 0 failed, console 58 assertions / 0 failed, image 261 MB.
Linux rehearsal — compose 74 passed / 0 failed (enforcement lag 14 ms), console
58 assertions / 0 failed, 0 containers left behind. act (nektos/act 0.2.89,
catthehacker/ubuntu:act-latest) — 5 jobs succeeded, 0 failed: lint, source
(128/128, 125/125, 28/0), image (261 MB, compose 74/0), console (58 assertions,
480,636-byte screenshot artifact), freshness.

Prose changes, not just digits:

- The compose write scene no longer asserts `/readyz` 503 for a reporting-path
  failure, and the README said it did. The sentence is rewritten to the boundary
  that is actually asserted now, with the measurement that moved it: one lost
  alert held `/readyz` at 503 for 120 s of idle time over a healthy write path,
  because an alert pillar writes only when an alert is raised.
- Both broken-pillar scenes are now eleven assertions, not ten: each proves the
  sources it claims were seen are really in the live streak map, so the scene
  cannot pass by counting one docker bridge address three times.
- The honest log line is described as polled and counted (3 lines), because the
  grep run immediately after the burst answers 0 and the same grep two seconds
  later answers 3.
- The compose history line now says where 74 came from: 63 before the ban-write
  scene, 72 before the scenes were made non-vacuous.
2026-10-02 10:11:50 +02:00
Pavlo Ratushnyi 1bcc086195 The log assertion sampled one instant, and the log line had not landed yet
The compose gate passed 74/0 on the macOS host and failed "and the log says
what actually happened" on the first Linux rehearsal of the same tree. The
wording was not the problem and neither was the platform: the grep over
`docker compose logs edge` was run immediately after the burst that produced
the line. Measured on the shipped image with the stack still up — the grep
right after the five refusals answered 0, the same grep two seconds later
answered 3. The /state field is updated synchronously on the request path;
the line reaches the daemon's log store a moment later, so the state
assertions passed and the log assertion failed on timing.

Both log assertions now poll, and both print the count they saw, so a passing
log assertion shows the number rather than an absence. The race-line count is
taken after the wait, so the before/after pair describes one moment: this
scene demonstrably produced 3 lines saying the ban was not persisted, and 0
lines calling it a concurrency race.

Linux rehearsal at this tree: 74 passed, 0 failed (was 73/1).
2026-10-02 09:52:47 +02:00
Pavlo Ratushnyi 12ccb55423 The compose scenes now name the policy they stand on, and prove their sources
The ban scene failed on the first Linux rehearsal and passed on the macOS
host, and the difference was not the platform: the read scene above it drops
policy_settings and recreates it empty, so once the reload succeeds against
the empty table the operator's overrides are gone and the policy is back to
the configured defaults — streakThreshold 10, trustProxyHeaders false. With
proxy headers untrusted, every "new source" in the write and ban scenes is
the same docker bridge address, the ban is never attempted, and the log line
the scene waits for never appears. Which policy is in force after that
restore is a timing question, so the scene passed on one machine and failed
on the other for a reason that had nothing to do with what it asserts.

Both scenes now PUT the policy they depend on before they generate traffic,
and both prove the sources they claim were seen are really in the live
streak map — three distinct keys in the write scene, the scanner's own key in
the ban scene — so the scene cannot pass by counting one address three times.

The streaks fetch is polled rather than sampled once: the first attempt right
after a burst answered a completely empty body while the next answered
complete, and an assertion on one instant is not a contract.

Gate on the host at this commit: 74 passed, 0 failed (was 72 + the 2 new).
2026-10-02 09:46:05 +02:00
Pavlo Ratushnyi 3f24c5d31c A ban that could not be written was logged as a concurrency race, and nothing was in force
Measured on the shipped image with writes to block_entries aborted by SQLite
triggers while reads kept working: five refusals from one source at a threshold
of 3 answered 404 five times, no ban reached storage or /state, /readyz answered
200, and the log said "BlockStore: concurrent ban on 203.0.113.12; keeping the
winner" four times over an inner "SQLite Error 19: 'gate: ban write blocked'".
Enforcement reads the snapshot and the snapshot is built from storage, so a ban
that cannot be written is a ban that exists nowhere - and the only sentence the
log offered said the opposite.

BlockStore now asks storage which case it is: re-read the row. A live engine ban
for that source means somebody won the unique-index race and nothing is wrong;
no row, or a read that cannot run either, means the write never happened. The
second case is counted (DurabilityHealth.Bans), logged with its real reason and
its consequence, and gates /readyz - the enforcement path is the path that
gates.

That also moved the boundary drawn last cycle. Observations, alerts and retention
are reporting pillars: counted, shown on /state and on the console, and no longer
gating readiness. The measurement that forced it: with the gate in place, one
lost alert left alertWriteFailures at 3 and /readyz at 503; the triggers were
removed and the stand left idle for 120 s, and it answered 503 the whole time
with the write path healthy. An alert pillar writes only when an alert happens to
be raised, so "not yet proven healthy" had become "unready forever".

ObservationWriter now retries every tracked source while it has an outstanding
failure: the write-amplification bound protects against load, not against
retries, and without this the lost rows waited for each source to be due again a
full interval later.

Teeth: BanWriteFailureTests (3) - 3 failed / 0 passed before the fix; two
WriteFailureVisibilityTests assertions re-drawn for the new boundary. Gates:
compose-smoke 63 -> 72 (the ban scene asserts 404x5, no row in storage, 503
naming bans, race lines 0/0 and the honest line present, then the ban landing on
a later refusal), smoke.sh counters now include bans, console-check 57 -> 58.
2026-10-02 09:24:43 +02:00
Pavlo Ratushnyi 68bec5b6be The README carries the write-health contract, and the numbers describe the tree that has it
Re-measured at 7b57c56, every stage on its own: macOS host unit 128/128,
integration 122/122, smoke 28/0, compose 63/0, console 57/0, image 261 MB;
Linux rehearsal source (Ubuntu 24.04.5, SDK 10.0.401) 128/128 + 122/122 + 28/0,
compose 63/0 with a 12 ms enforcement lag, console 57/0 leaving 0 containers;
act 5 jobs succeeded, 0 failed, console-evidence.zip 452,153 bytes.
shellcheck 0.11.0 clean over scripts/*.sh.
2026-10-02 08:49:05 +02:00
Pavlo Ratushnyi 7b57c56def The compose gate asserted the policy header at one instant, and one instant is not a contract
The first Linux rehearsal of this tree failed on the read-side scene: /state had
just reported a reload failure, and the very next GET /admin-api/policy answered
with X-Policy-Reload-Failures: 0. A reload succeeded in between — a pooled sqlite
connection can keep serving the schema it already prepared, which is the same
reason chmod 000 on the database file never breaks the edge. The product said
what the last read did; the gate was asserting on a sample. The header is now
polled while the table is gone and the observed value is printed either way, so
a red here names what was seen instead of naming the clock.
2026-10-02 08:38:55 +02:00
Pavlo Ratushnyi 2b0163aa80 A pillar that could not write kept answering with the count it had before the break
The read side got its counters last cycle; the write side was still catching
everything, logging one line and keeping the process alive. A failed write is
worse than a failed read - the row never existed and no later request brings it
back - and the surface hid it better. Measured on the shipped image with SQLite
triggers aborting every INSERT/UPDATE on source_observations and edge_alerts
while reads kept working: three new sources refused and a six-request 5xx storm
later, GET /admin-api/observations answered 200 with the same X-Total-Count it
had before the break (46), GET /admin-api/alerts still showed its one row,
/healthz and /readyz were 200, /admin-api/state had no write-side field at all,
and the log carried "flush failed, 4 entries dropped" plus two "could not
persist".

DurabilityHealth counts each writer separately; /state reports
observationWriteFailures/observationsLost/observationLastWriteError,
alertWriteFailures/alertsLost and retentionPruneFailures; /readyz answers 503
naming the pillar, the rows lost and the innermost error rather than EF's
wrapper. A counter clears only on a successful write of its own pillar, and
retention is reported without being a readiness failure - stated in code, with
the reason.

Teeth: WriteFailureVisibilityTests (5) - 5 failed / 0 passed before the fix.
Gates: compose-smoke 53 -> 63 (blocks writes with triggers, asserts the
unchanged X-Total-Count as the lie, and heals per pillar), smoke.sh 25 -> 28,
console-check 53 -> 57.
2026-10-02 08:26:45 +02:00
Pavlo Ratushnyi 058e68be7e The README carries the pillar-health contract, and the numbers describe the tree that has it
Re-measured at 7e081da, every stage on its own: macOS host unit 128/128,
integration 117/117, smoke 25/0, compose 53/0, console 53/0, image 261 MB;
Linux rehearsal source (Ubuntu 24.04.5, SDK 10.0.401) 128/128 + 117/117 + 25/0,
compose 53/0 with a 12 ms enforcement lag, console 53/0; act 5 jobs succeeded, 0
failed, console-evidence.zip 429,592 bytes. shellcheck 0.11.0 clean over
scripts/*.sh.
2026-10-02 07:46:16 +02:00
Pavlo Ratushnyi 7e081da6fe The rehearsal tore down a stack it did not start and left the one it did running
The console stage starts the stack through the host daemon with whatever
COMPOSE_PROJECT_NAME the caller passed, so the CI-named project is what is
running. Its cleanup container passed no such name, so it removed the stack
named after this directory - nothing - and printed PASS while two containers
held the CI port. Re-running the stage with the CI console job's own
environment is what showed it: 53 assertions, 0 failed, and 2 containers still
up. With the name passed through, the same stage leaves 0.
2026-10-02 07:35:26 +02:00
Pavlo Ratushnyi ea68b550e2 Two CI jobs sharing one compose project: one job's teardown was the other's connection refused
The full local runner pass (act 0.2.89, catthehacker/ubuntu:act-latest) on this
tree went 4 jobs succeeded, 1 failed: the console job died 33 s in, at the
seeding curl of scripts/console-smoke.sh, with curl exit 7 — nothing listening on
127.0.0.1:8080 any more.

Not a product failure and not flakiness. The image job and the console job each
run `docker compose up -d` and each tear the stack down on exit, and both take the
project name from the repository directory and the host port from a literal 8080
in docker-compose.yml. On any machine where two jobs share one docker daemon — a
self-hosted runner, or act — they are the same stack, so the image job's
`compose down` removes the containers the console job is seeding into. Run alone,
the same console job passes (act -j console: 1 job succeeded, 53 assertions). On
GitHub's hosted runners each job gets its own machine, which is exactly why this
has never been seen there and why "the workflow has never run on GitHub" is still
a gap this repository carries rather than a solved problem.

Fix: the published port is ${EDGE_PORT:-8080}, and each job names its own compose
project (openwafci-image on 8080, openwafci-console on 8090). Separate projects
means separate containers, separate volumes and separate ports, so neither job can
see the other's stack. scripts/ci-linux-rehearsal.sh passes COMPOSE_PROJECT_NAME
and EDGE_PORT through to the seeding container so an operator can isolate a
rehearsal the same way.

Measured after: the same full act pass is 5 jobs succeeded, 0 failed — lint,
source (128/128, 117/117, smoke 25/0), image (261 MB, compose smoke 53/0),
console (53 assertions / 0 failed, screenshot artifact), freshness. Locally:
compose gate 53/0 with the default project and port unchanged, and the console
gate 53/0 driven through the CI configuration (COMPOSE_PROJECT_NAME=openwafci-console,
EDGE_PORT=8090).
2026-10-02 07:21:13 +02:00
Pavlo Ratushnyi 39d08eca51 A pillar that stopped reading its table kept answering, and nothing on the surface said so
Measured on the shipped image (openwaf:ci, the head tree), one stand with a real
upstream:

  PUT /admin-api/policy {"streakThreshold":2,"trustProxyHeaders":true} -> 200
  404 404 from 203.0.113.79, third request -> 403   (the threshold is in force)
  04:44:43  DROP TABLE policy_settings, from outside the process
  04:45:2x  GET /admin-api/policy -> still "streakThreshold": 2, answered plainly
            GET /admin-api/state  -> "snapshotAgeSeconds":0 — the refresh "succeeded",
                                     because the tables it also reads were still there
            /healthz 200, /readyz 200, and exactly 1 line in the log
  docker restart -> GET /admin-api/policy -> "streakThreshold": 10,
                                          "trustProxyHeaders": false
  four 404s from 203.0.113.81, fifth -> 404: nothing banned

Both pillars — the policy provider and the guard's snapshot store — catch
everything their read throws, keep the last value they had, and log one line.
Keeping the last good value is the right failure posture: a database restart must
not open the gate. Keeping it unmentioned is not: for a minute the operator's page
showed a threshold that no longer existed anywhere in storage, readiness said
ready, and after a restart the defence silently came back at the default N=10.

Now: EdgePolicyProvider and EdgeStateStore count consecutive failed reads and keep
the last error; /admin-api/state answers snapshotStale (age against the TTL the
process refuses to start without), snapshotRefreshFailures,
snapshotLastRefreshError, policyReloadFailures and policyLastReadAt;
/admin-api/policy carries X-Policy-Reload-Failures and X-Policy-Last-Read
alongside the policy it is enforcing, the same way a capped listing carries its
completeness in headers; /readyz answers 503 while either counter is non-zero,
naming the pillar and the age of the snapshot it is running on; and the console's
summary line goes warn and says "older than the ttl", "snapshot refresh failing
xN", "policy not re-read from storage xN".

Teeth first: PillarFailureVisibilityTests (4) run against the unfixed tree — 4
failed, 0 passed, all four on a missing field (KeyNotFoundException), which is the
point: the numbers did not exist. The refresh test drops country_rules rather than
block_entries on purpose — only one of them is what /readyz probes, so before the
fix that test saw the refresh failing and readiness still answering 200.

Gates: compose-smoke now drops policy_settings from the running stand through a
--volumes-from sidecar, waits for the failure to be counted, asserts the counters,
the 503 and the header, puts the table back and asserts the recovery (+6
assertions; the counters are consecutive, not cumulative, so recovery is part of
the claim). smoke.sh asserts the healthy case with numbers rather than silence
(+3). console-check drives the page against that state answer and requires the
summary line to be marked and to name both pillars (+3); the state body is served
through a route because the guard refreshes the snapshot on every request — a live
stand cannot be left to age — while the contract being rendered is the one
compose-smoke measures end to end against the shipped image.

Numbers on this tree. Host: build 0 warnings, unit 128/128, integration 117/117,
smoke 25 passed / 0 failed, compose 53 passed / 0 failed, console 53 assertions /
0 failed, image 261 MB. Linux rehearsal, each stage on its own — source in
mcr.microsoft.com/dotnet/sdk:10.0 (Ubuntu 24.04.5, SDK 10.0.401): 128/128,
117/117, 25/0; compose in docker:cli: 53/0, enforcement lag 12 ms; console in
mcr.microsoft.com/playwright:v1.63.0-noble: 53/0.
2026-10-02 07:07:25 +02:00
Pavlo Ratushnyi 73872ceda1 The README carries the exemption contract, and the numbers describe the tree that has it
The Admin API section now says what GET /admin-api/allow answers — live by
default, live=false meaning "do not filter", limit 1..2000 and offset,
X-Total-Count and X-Truncated, and a live flag on each row computed from the same
AllowEntry.IsLive the engine applies — and records the measurement that made it
so: the entry written at 03:58:16 for one minute, the address through at 03:58:20
(502) and blocked again at 03:59:38 (301), the row still listed unmarked at
03:59:39 with /state still saying allowEntries:1, and 1,101 rows in 130,386 bytes
with every paging parameter ignored.

Numbers moved to the tree that has the fix (c97c7a1), host and Linux: unit
128/128, integration 113/113 (was 109), smoke 22/0 (was 19), compose 47/0 (was
43), console 50/0 (was 47), image 261 MB; Linux enforcement lag 11 ms. act 0.2.89
on catthehacker/ubuntu:act-latest at c97c7a1: 5 jobs succeeded, 0 failed, console
screenshot artifact 606,514 bytes. The workflow's own header comment carries the
same numbers, since it is the file a reader trusts when the README is one commit
ahead of the run it describes.
2026-10-02 06:24:51 +02:00
Pavlo Ratushnyi c97c7a1866 An exemption the edge had stopped honouring was still listed as an exemption, and the listing had no ceiling at all
Measured on the shipped image (openwaf:c28, the head tree), one allow entry
written for one minute against an operator block on the same address:

  03:58:16  POST /admin-api/allow {"match":"192.168.65.1","expiresInMinutes":1} -> 204
  03:58:20  GET /whatever -> 502   (passed to the upstream: the exemption is in force)
  03:59:38  GET /whatever -> 301   (the minute has passed; the block is back)
  03:59:39  GET /admin-api/allow -> 200, the row still listed, no liveness field
            GET /admin-api/state -> "allowEntries":1

The engine was right and the surface was wrong: the operator's table said
"exempted" a minute after the edge stopped honouring it, and the pill's number
was a count of rows rather than a count of exemptions in force. Nothing prunes
those rows either — retention ages out observations, engine bans and alerts, and
an operator's own writes are not the machine's to delete — so the dead ones
accumulate exactly where they cannot be told apart from the live ones.

The same endpoint was also the last listing with no ceiling: 1,101 rows came back
in 130,386 bytes with no X-Total-Count and no X-Truncated, and every paging
parameter was ignored — ?limit=10, ?offset=1000, ?limit=0 and ?limit=100000 each
answered all 1,101.

Now: GET /admin-api/allow takes live (default true, live=false means "do not
filter", the same shape as /blocks), limit 1..2000 and offset, refuses a limit
nobody meant by name, and carries X-Total-Count and X-Truncated computed from the
same predicate as the rows. Each row carries live, computed from the same rule
the engine applies (AllowEntry.IsLive), and /state answers allowEntries as the
live count with allowEntriesExpired beside it. The page fetches live=false, marks
a dead row "EXPIRED, the edge no longer honours it", counts them under the table,
and its pill says "0 live - 1 expired".

Teeth, in this order: AllowListingHonestyTests (4) written first and run against
the unfixed tree — 4 failed, 0 passed, including "allowEntries expected 1, got 2"
and "X-Total-Count expected 5, got null". The wire assertions in the second test
passed before the fix and after it: the engine already knew. The console gate
seeds an allow entry with a one-minute TTL ahead of the waits it already pays, so
the expired state arrives for free, and asserts the dead row is listed and marked,
the live one is not, and the line under the table counts them; the two existing
row deletes are now aimed at a match instead of clicking the first remove button,
which with a second row in the table would have deleted whatever sorted first.

Numbers on this tree: host — build 0 warnings, unit 128/128, integration 113/113,
smoke 22 passed / 0 failed, compose 47 passed / 0 failed, console 50 assertions /
0 failed, image 261 MB. Linux rehearsal, each stage on its own — source in
mcr.microsoft.com/dotnet/sdk:10.0 (Ubuntu 24.04.5, SDK 10.0.401): unit 128/128,
integration 113/113, smoke 22/0; compose in docker:cli: 47/0, enforcement lag
11 ms; console in mcr.microsoft.com/playwright:v1.63.0-noble: 50/0.
2026-10-02 06:16:59 +02:00
Pavlo Ratushnyi 378775ce83 The README carries the 404 contract, and the numbers describe the tree that has it
Run of 6e6461a:

* macOS host gates: build 0 warnings / 0 errors, unit 128/128, integration
  109/109, smoke passed 19 / failed 0, compose 43 passed / 0 failed, console
  47 assertions / 0 failed, image 261 MB.
* Linux rehearsal, each stage on its own: source in mcr.microsoft.com/dotnet/sdk:10.0
  (Ubuntu 24.04.5, SDK 10.0.401) 128/128, 109/109, 19/0; compose in docker:cli
  against the host daemon 43/0, enforcement lag 13 ms; console in
  mcr.microsoft.com/playwright:v1.63.0-noble (chromium-1243) 47/0.
* act 0.2.89 on catthehacker/ubuntu:act-latest: 5 jobs succeeded, 0 failed —
  lint, source, image, console (screenshot artifact, 590,488-byte zip),
  freshness (pin 2026-10 = newest 2026-10).

The new section states the 404 contract with both columns measured on shipped
images (08bebf43 before, 4823e9ae after), and names the console's copy of the
bug: every 404 read as "the admin API is switched off", and the destructive
"clear the automatic bans" button reading nothing back at all.
2026-10-02 05:26:49 +02:00
Pavlo Ratushnyi 6e6461a760 A 404 explained one missing row and said nothing about another, and the page answered the silent one with "the admin API is off"
Measured on the shipped image (openwaf:ci 08bebf43, the tree with the
storage-failure fix):

  DELETE /admin-api/countries/ZZ   -> 404 {"error":"no country rule for \"ZZ\""}
  DELETE /admin-api/allow/999999   -> 404, Content-Length: 0

Same status, two qualities of answer. The silent half is what the console then
had to invent an explanation for: apiRaw read EVERY 404 as
"admin api disabled — set OpenWaf__Admin__Token" and threw, so removing a row
that another tab had already removed told the operator to go configure a token
that is already configured. And because the throw landed in a catch that says
nothing, the status line ended up reading "refreshed" in the success colour —
measured in the console gate before the fix:

  FAIL a missing row is reported as a missing row… — ok: refreshed 4:50:18 AM

After the fix, on the image built from this tree (4823e9ae):

  DELETE /admin-api/allow/999999   -> 404 {"error":"no allow entry with id 999999"}

The page now shows that sentence instead of guessing:

  ok  a missing row is reported as a missing row, not as the admin API being switched off
      — warn: no allow entry with id 999999

Whether the admin surface is switched off at all is no longer inferred from a
status code: the core read (/admin-api/state) is checked for a non-200 and the
edge's own body is shown — "admin api disabled: set OpenWaf__Admin__Token",
which the API already says and which a new test pins.

While in this handler, the most destructive button on the page was found doing
worse than lying: "clear the automatic bans" fired the DELETE and read nothing
back, so cleared 7, cleared 0 and a refused write looked identical after the
reload. It now reports the count the edge gave ("engine bans cleared: 0"), and
the note for the action just taken survives the refresh that action itself
triggered — load() used to overwrite it with "refreshed" inside a second, which
is shorter than the time it takes to read.

Gates on this tree (macOS): build 0 warnings / 0 errors, unit 128/128,
integration 109/109 (3 new in NotFoundExplanationTests), smoke 19/0,
compose 43/0, image 261 MB, console 47/47 (2 new assertions).
Dents: allow 404 silent again -> 2 tests fail; apiRaw reading every 404 as
"disabled" -> 2 console assertions fail; clearEngine reading nothing back -> 1;
the action note not held across its own refresh -> 1.
2026-10-02 05:21:44 +02:00
Pavlo Ratushnyi 73906cc9de The README describes the tree with the storage-failure fix, with both images side by side
Numbers from a run of a77ab53, not of a commit several fixes behind it:

* macOS host gates: build 0 warnings / 0 errors, unit 128/128, integration
  106/106, smoke passed 19 / failed 0, compose 43 passed / 0 failed, console
  45 assertions / 0 failed, image 261 MB.
* Linux rehearsal, each stage on its own: source in mcr.microsoft.com/dotnet/sdk:10.0
  (Ubuntu 24.04.5, SDK 10.0.401 from the pinned global.json) 128/128, 106/106,
  19/0; compose in docker:cli against the host daemon 43/0, enforcement lag
  12 ms; console in mcr.microsoft.com/playwright:v1.63.0-noble (chromium-1243)
  45/0.
* act 0.2.89 on catthehacker/ubuntu:act-latest: 5 jobs succeeded, 0 failed —
  lint, source, image, console (screenshot artifact, 552,268-byte zip),
  freshness (pin 2026-10 = newest 2026-10).

The new section states the contract the fix establishes, with the before column
measured on the image built from 72d37ad and the after column on the image built
from a77ab53, and keeps the boundary in the same breath as the numbers: no
remote exists, so no GitHub-hosted runner has ever executed this workflow.
2026-10-02 04:37:42 +02:00
Pavlo Ratushnyi 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
72d37ad and openwaf:ci built from this tree — with the block table and the
policy table dropped out from under a running edge that held 3 blocks and 1
policy row:

  DELETE /admin-api/blocks?source=operator   200 {"deleted":0}      -> 503 "NOTHING was deleted"
  DELETE /admin-api/blocks?key=203.0.113.201 200 {"deleted":0}      -> 503 "NOTHING was deleted"
  POST   /admin-api/blocks                   400 database error     -> 503 "the block is NOT in effect"
  PUT    /admin-api/policy {"mode":"Enforce"} 200, body mode=Observe -> 503 "the change is NOT in effect"
  GET    /admin-api/blocks                   500                    -> 500 (unchanged)
  GET    /readyz                             200 ready              -> 503
  GET    /healthz                            200                    -> 200 (unchanged: the recovery hatch)

Four separate lies, one class:

* BlockStore.DeleteAsync caught everything, logged a warning and returned 0, so
  the endpoint answered {"deleted":0} — the same bytes an empty list produces.
  A destructive command that could not run told the operator there was nothing
  to remove.
* BlockStore.AddOperatorAsync returned the string "database error" and the
  endpoint mapped it to 400, next to the real validation errors. A storage
  failure arrived as "your request is wrong", which invites a retry of the
  request while no block is in effect.
* PUT /admin-api/policy threw away SaveAsync's false and answered 200 with the
  policy body — showing the mode that had NOT been saved.
* /readyz used CanConnectAsync, which only proves the file opens. It kept
  answering 200 through all of the above.

The same stand, six concurrent POSTs for one address (no broken storage):
4x 204 and 2x 400 {"error":"database error"} before; 6x 204 after. The unique
index on (source key, provenance) made the loser of a race the API itself
started look like a caller who sent a bad request — which is what a double-click
on "block" in the console is. The write now retries against the winner's row.

The console had its own copy of the bug: every destructive row button wrote its
green note whatever came back, so a refused delete read as "deleted ? block(s)",
and load() — which runs after every action and on a 5 s interval — replaced the
error line with "refreshed" inside a second. The note now waits for an answer
that did not carry an error, and the refresh that follows a failed action holds
it. An empty 5xx body is now reported as an empty 5xx body instead of throwing
inside apiRaw and being swallowed.

Gates on this tree (macOS): build 0 warnings / 0 errors, unit 128/128,
integration 106/106 (7 new in StorageFailureHonestyTests), smoke 19/0,
compose 43/0, image 261 MB, console 45/45 (1 new assertion).
Dents: delete answers deleted:0 -> 2 fail; POST answers 400 -> 1; readyz trusts
CanConnectAsync -> 1; no retry after the unique-index loser -> 1; delete
swallows into a bare 0 -> 2; PUT /policy discards the save answer -> 1; console
writes the note whatever came back -> the console gate fails that assertion.
2026-10-02 04:22:07 +02:00
Pavlo Ratushnyi 72d37ad3f1 The Linux numbers describe the head tree again
The rehearsal had been quoted from 8fba844 while the tree had moved three fixes
past it. All three stages were re-run separately at fc90f50, in containers:
source gates 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
passed 19 failed 0, build 0 warnings 0 errors; compose gate in docker:cli
against the host daemon - 43 passed, 0 failed; console gate in
mcr.microsoft.com/playwright:v1.63.0-noble with chromium-1243 - 44 assertions, 0
failed. The same suite on the macOS host at fc90f50 gives the same counts.

The workflow was also executed by the local Actions-compatible runner at this
commit: nektos/act 0.2.89 on catthehacker/ubuntu:act-latest, 5 jobs succeeded, 0
failed (lint, source, image, console with the screenshot artifact, freshness).
That is still not a GitHub-hosted runner - the repository has no remote - and
the README says so in the same sentence.

The admin API section gains the country-rule paragraph: PUT
/admin-api/countries/{code} checked only the length, so "12" and "U." were
stored, listed to the operator as denied, and obeyed by nobody, with no DELETE
to undo them.

Shape block: 89 -> 99 integration tests, 39 -> 44 console assertions.

actionlint exit 0; shellcheck 0.11.0 exit 0; node --check ok.
2026-10-02 03:25:17 +02:00
Pavlo Ratushnyi 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.
2026-10-02 03:11:57 +02:00
Pavlo Ratushnyi 53947516b2 The README says which run it describes, and which commit that run was on
The listing-completeness fix (0e2aee6) is documented in the admin API section:
?limit= clamped instead of refusing (1000 rows of 1103 recorded sources with no
total and no flag; limit=0 and limit=-1 each returning one row), X-Total-Count
and X-Truncated now on /observations and /alerts as well as /blocks, an offset
that reaches the rest, and /streaks measuring truncation against standing
streaks instead of the size of the map.

The rehearsal paragraph is the part that was at risk of becoming a lie. The
Linux rehearsal has not been re-run past 8fba844 - the approval step for
scripts/ci-linux-rehearsal.sh failed three times this cycle and the run was not
attempted any other way - so the paragraph now says so in the open and names the
commit its numbers belong to. What was measured at 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. The
same sentence was added to the header comment of .github/workflows/ci.yml, which
quoted 126/73/39 as if it described the current tree.

Shape block: 126 -> 128 unit tests, 73 -> 89 integration tests.

actionlint exit 0; shellcheck 0.11.0 exit 0.
2026-10-02 02:25:52 +02:00
Pavlo Ratushnyi 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.
2026-10-02 02:19:27 +02:00
Pavlo Ratushnyi 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 00f6dd9,
before the source filter was made strict. Both now say 8fba844 and carry the
counts from a run of this tree: unit 126/126, integration 73/73, smoke 19/19,
compose 43 passed / 0 failed, console 39 assertions / 0 failed.

The Shape block was stale in a way the prose was not: it still said 54 unit
tests, 30 integration tests and 41 compose assertions. Those three lines are
the first place a reader goes to size the test suite, and they were 72, 43 and
2 assertions short of what actually runs.

The README also gains the provenance section: ?source= used to map any
unrecognised value to operator, so GET ?source=enigne hid the engine bans and
DELETE ?source=enigne answered {"deleted":1} and left operator=0 engine=3 on a
stack holding 2 operator blocks and 3 engine bans. It now answers 400 naming
what was sent. The same family is documented: expiresInMinutes must be
1-5,256,000 when present, and reason/note are bounded at 512 characters after
both accepted a 1 MB payload and made the listings return ~1 MB each.
2026-10-02 01:33:55 +02:00
Pavlo Ratushnyi 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.
2026-10-02 01:21:20 +02:00
Pavlo Ratushnyi 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 00f6dd9:

  scripts/ci-linux-rehearsal.sh: exit 0 — unit 126/126, integration 62/62,
    smoke 19/19, compose 43/0, console 37/0
  act push: exit 0 — all five jobs succeeded (lint, source, image, console
    in ci.yml, plus freshness in geo-freshness.yml), source job unit 126/126 +
    integration 62/62 + smoke 19/19, image job compose 43/0, console 37/0
  actionlint exit 0; shellcheck 0.11.0 exit 0

So every place that quotes a number was moved: unit 105 -> 126, integration
55 -> 62, console 33 -> 37. The header of ci.yml also stops claiming four jobs
are five: ci.yml has four, geo-freshness.yml has the fifth, and the act run
reported all five. The console paragraph now names the escaping assertions and
what it costs to break them — esc() reduced to the identity function turns the
gate red with 6 failures and the page title into "XSS".
2026-10-02 00:44:24 +02:00
Pavlo Ratushnyi 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.
2026-10-02 00:34:35 +02:00