4db36f86d0374a92526cbfc50dd026100dbdd24e
62
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
4db36f86d0 |
the operator's console shows what changed on this edge
OPEN-64 gave the edge a record of every deliberate config change and an
endpoint that reads it; the record was invisible to the person it is for.
`/admin` now draws it: when, section, action, target, the note somebody
typed, and the surface it came through, newest 25 of the total.
Rulings this copy holds to:
* The surface column says `operator` or `import`, never a person. The
edge has one admin token; a column implying a per-person attribution
it cannot provide would be a false record, not a thinner one.
* Engine bans are absent, and the line under the table says so in the
same breath as the counts: "engine bans are not here, they are not
decisions". A table that mixed them in would read as "the operator
chose to ban this address", which is a different claim.
* The log's two bounds are printed under the table they govern -
"pruned after 30d or 5000 rows, whichever comes first" - the way the
retention windows sit on the observations and alerts tables. They come
from `/state` (`changeRetentionDays`, `changeLogMaxRows`), so the
numbers are the ones this process was actually started with.
* A change record that did not land is named in the durable-writes pill
with its count: "change records not written x1 (1 changes
unrecorded)". It is the one write failure that changes nothing the
edge enforces, which is exactly why it would otherwise go unseen - the
config did change, only its record is missing.
What the run measured rather than assumed: the gate's seed writes a block
whose reason carries markup (`<svg onload=document.title='XSS2'> probe`),
and that reason is now the detail of a change row - so the change table
is a place where a stored operator string reaches the one browser in this
system that holds the admin token. The markup-seed assertion now covers
`#changes tbody`, and a companion assertion proves the string really
arrived as text, because without it an injection count of zero would only
prove that nothing was looked at.
Gates on this head: build 0 warnings / 0 errors, unit 313/313,
integration 298/298 in 34 s, console 98 assertions / 0 failed, smoke
passed 127 failed 0, image 262 MB, compose-smoke 278 passed 0 failed.
Refs OPEN-65.
|
||
|
|
3959f1fe6b |
a change to the operator's config leaves a record of itself
Every operator write already changes a row; what was missing is the answer an operator actually asks at 03:00 - when did this rule get here, who cleared that ban, did a document bring this edge's config. Since the transfer landed, an edge can be different from yesterday with nothing on it saying how.
config_changes carries one row per deliberate change: the instant, the section (block, allow, rule, country, policy, config), the action (added, removed, changed, imported), the target the operator typed, their own sentence where one was given, and the surface the change came through. GET /admin-api/changes answers it newest first, capped and paged like every other listing, filterable by section and since, readable by the read-only token because it is a read. A policy record says what moved ("mode Enforce->Off, streakThreshold 3->4") rather than only that something did. /admin-api/state counts the rows and the write failures.
The rulings, because each is a decision and not a detail:
* Engine bans are not in the log. A ban the engine earned is not a decision somebody made, and the block row already carries its evidence - consecutive refusals, status code, path, user agent, country, city. Logging bans would answer a different question and grow the table at the rate of traffic.
* An import is one record per section, not one per row: "3 added, 1 already there, 0 past expiry, 0 rejected". A 2 000-row document would otherwise bury a table whose whole use is being readable.
* The record names the surface, never a person. The edge has one admin token; a log that implied per-person attribution it cannot provide would be a false record, which is worse than no record.
* A record that cannot be written never undoes the change it describes. Enforcement is the product, so the change stands and the failure is counted - changeWriteFailures, changesNotWritten, changeLastError - because "the config changed and the record of it did not land" has to be a sentence an operator can read rather than one that silently never happened.
* Bounded twice, both keys the operator's: ChangeRetentionDays (30) and ChangeLogMaxRows (5000, oldest dropped first). The age window alone would let a scripted churn grow the table without limit; the cap alone would drop last month's incident record the week someone did a lot of editing.
What the run caught, in order: (1) Two gate assertions were wrong rather than the product - a policy record was asserted in a scene where no policy write had happened yet, and "one imported record per section" was asserted against a stack that had already imported twice, so the assertion now reads the newest imported record instead of counting them. (2) DELETE /admin-api/countries/{code} answers 204, and the new assertion expected 200. (3) A shell trap in the new scene: a $VAR inside a single-quoted python -c is not interpolated, so the first version would have handed python a literal "$CHANGES_BEFORE" instead of a number.
Gates on this tree: build 0 warnings / 0 errors, unit 313/313, integration 298/298 in 23s, smoke 127 passed / 0 failed (14 new), image 262 MB, compose-smoke 278 passed / 0 failed with 0 containers left behind (11 new, against the shipped image), console 90 assertions / 0 failed.
Refs OPEN-64.
|
||
|
|
a8f2b05340 |
an edge that refuses to start says so and then leaves
Every bound this build refuses to run with - the refresh TTL, the two retention windows, the push-attempt and retry intervals, the webhook timeout, the token pair - was already refused with a sentence naming the key and the value. The sentence was right and the form was not. Measured on the shipped image: an unhandled exception during startup printed the reason and then the process sat at 100% CPU inside the runtime's crash path. The container stayed "Up (unhealthy)" forever with no exit code, so compose reported nothing, k8s restarted nothing, and the only symptom of a mistyped number was a spinning core. OPEN-62 caught this for one refusal; this is the convention for all of them. One way out: RefuseStartup writes the reason to stderr and returns 1, and every refusal goes through it, so the exit code is the same for all of them and a supervisor can tell "refused to start" from "an edge that died while serving". Most refusals are not raised in the entry point at all - the TTL and the retention windows surface during host start, when a hosted service resolves the service whose factory parsed the value - so app.Run is wrapped in a catch guarded by whether ApplicationStarted ever fired. Before that point an exception leaving app.Run is a configuration the operator can fix; after it, it is not, and it must not be reported as one. What the run caught, in order: (1) The app.Run guard does not reach the three alert bounds, which are parsed in the entry point before the host exists, so MaxPushAttempts=0 still took the crash path - they are now wrapped where they are parsed. (2) The refusal messages name the key in the appsettings spelling (OpenWaf:State:RefreshTtlSeconds), not the environment spelling the gate overrode it with, so the first version of the new assertions failed four times for a reason that was the gate's, not the product's. (3) The shape of the assertion matters as much as the code: a gate that waits on the process cannot tell a refusal from a hang, which is exactly why OPEN-62's original assertion passed on a container that never exited. Both suites now start the edge detached and poll for an exit, and "still running after the bound" is a failure. Gates on this tree: build 0 warnings / 0 errors, unit 307/307, integration 286/286 in 37s, smoke 113 passed / 0 failed (8 new: four bounds, each asserting the exit code and that the reason names the key), image 262 MB, compose-smoke 267 passed / 0 failed with 0 containers left behind (6 new, against the shipped image), console 90 assertions / 0 failed. Refs OPEN-63. |
||
|
|
718dcaaba3 |
a second token can read the operator's surfaces and change none of them
One admin secret meant one thing: whatever could read /admin-api/state could also delete every block and rewrite the policy. A Prometheus scrape therefore held a key that can lift a ban, a second operator checking why a visitor was refused held a key that can change what the edge enforces, and OPEN-61's export put a whole edge's config behind the same single GET. The operator's question was never "does this thing know the secret" but "what is it allowed to do", and the shipped answer could only be all or nothing. OpenWaf:Admin:ReadOnlyToken (env OPENWAF_READ_ONLY_TOKEN) is the second level. Unset is the default and the whole of the previous behaviour. The rulings: * A known token without the right is answered 403, not 401, and the body names the key that would grant the write. Collapsing the two sentences sends someone debugging a failing script to check the secret when what is wrong is the endpoint it was sent to. * The line is drawn by the request method, not by a flag per endpoint: GET/HEAD/OPTIONS read, everything else writes. A write endpoint added tomorrow is behind the rule the moment it is written; a per-endpoint flag would fail the other way, and one forgotten flag would open the write. * GET /admin-api/export is the one read held to the admin token. It is a read and it is still the whole config, so it is the surface where "can read" and "can take" are the same act - and the dashboard token is exactly the one that must not be able to lift a fleet's config. * A read-only token sees byte-identical answers to the admin token. Read-only is about what a token may do, not about a weaker view: two people comparing answers must not get different answers because of who asked. * A read-only token equal to the admin token (compared after trimming, because env files add newlines) aborts startup naming both keys and never the secret. /admin-api/state answers readOnlyTokenConfigured, so the operator can check the key took effect instead of guessing from a 401. What the run caught, in order: (1) A real defect, and the interesting one. On the shipped image the startup refusal printed its reason and then the process sat at 100% CPU inside the runtime's crash path - the container stayed "Up (unhealthy)" forever, no exit code, nothing for a supervisor to react to. Refusing to start is only useful if the process leaves, so the refusal now writes the reason to stderr and returns 1; measured again on the image, it exits in 2 s with code 1 and the same sentence. (2) The gate's own assertion for that case had the same blind spot as the bug: waiting on a foreground docker compose run cannot tell "refused" from "hung", so the container is now started detached and polled for an exit within 30 s, and the assertion is that it left. (3) Two smoke asserts were wrong rather than the product: the blocks listing field is sourceKey, not ip, so the first version read an empty answer, and a two-code assertion compared a newline-separated pair against a space-separated literal. (4) An integration assert compared JsonElement.ToString() against "true" - a bool element prints True, so it now reads GetBoolean(). Gates on this tree: build 0 warnings / 0 errors, unit 307/307, integration 286/286 in 26s, smoke 105 passed / 0 failed (23 new), image 262 MB, compose-smoke 261 passed / 0 failed with 0 containers left behind (18 new, against the shipped image), console 90 assertions / 0 failed. Refs OPEN-62. |
||
|
|
6664f94b22 |
an operator's decisions move to another edge in one call
An operator running several edges types every rule several times: blocks, allowlist, request rules, country rules and the policy overrides have their own endpoints one row at a time, and nothing moved them as a set. A new deployment starts empty, and a change that turns out wrong has nothing to be restored from. This is the multi-instance finding one level up from the shared streak store: SharedStreaks shares the counters, nothing shared the decisions.
GET /admin-api/export answers one document — version, exportedAt, edgeId, per-section counts, the policy section, and blocks / allowlist / rules / country rules. Only live rows; rules keep their evaluation order; and the document names how many engine bans it left behind, because "0 blocks" and "0 operator blocks, 7 engine bans left behind" are different sentences. A ban the engine earned is a claim about this edge's own traffic, so enforcing it where that traffic was never seen is a decision nobody made.
POST /admin-api/import is additive and idempotent: it never deletes a row the document does not mention — a transfer that silently clears a fleet's exemptions is worse than one that duplicates a block — a live row for the same source is reported as already there rather than rewritten, and expiry travels as an instant, so a block that expires in ten minutes where it came from expires in ten minutes here. Per-section counts (added / alreadyThere / skippedExpired / rejected) and a rejected[] list named by section and index; an unknown version, an oversize body or a malformed document writes nothing at all; a storage failure answers 503 with the report, because "it failed" and "it added 41 of 60" must not collapse into one sentence.
What the run caught, in order: (1) a unit assert used "203.0.113" as the invalid address and passed for the wrong reason — IPAddress.TryParse accepts it as 203.0.113.0, so the assert now names 203.0.113.999. (2) Two smoke asserts were wrong rather than the product: a helper printed a Python boolean where the gate compares text, and a blocks delete was asserted as 204 when the endpoint answers 200 with {"deleted":n}. (3) The metrics-as-a-number test could pass its wait on a cache refreshed between an enqueue and its first attempt — pending > 0 was true a moment before attempts > 0 could be — so the wait now requires both numbers. (4) A real defect, not a test one: the alert notifier left the rows it had claimed claimed when the process stopped, so the next process waited out the five-minute reclaim window to deliver an alert that was already owed. It now releases what it holds on the way out, and the reclaim window is back to being what it is for — a process that was killed and cannot say anything.
Gates on this tree: build 0 warnings / 0 errors, unit 285/285, integration 257/257 in 23s, smoke 82 passed / 0 failed (14 new), image 262 MB, compose-smoke 243 passed / 0 failed with 0 containers left behind (11 new, against the shipped image).
Refs OPEN-61.
|
||
|
|
78e20b1859 |
the push queue says how hard it tried, not only what it still owes
The ticket named openwaf_alert_push_attempts_total and the queue published delivered instead. The two answer different questions: pending and given-up say what the queue holds now, attempts says what it cost to get there — attempts per delivery is what separates an endpoint that refuses everything from one that refuses occasionally, and it is the number that makes the give-up bound checkable from outside. PushQueueCounts carries the sum, /metrics publishes it, /admin-api/state answers alertPushAttempts, and the smoke and compose gauge assertions now name all four. Re-run of every gate on this commit: build 0/0, unit 277/277, integration 251/251 in 34s, smoke 68/0, image 261 MB, compose-smoke 232/0 with 0 containers left behind, console 90/0. Refs OPEN-60. |
||
|
|
d635a00078 |
an alert that could not be pushed is pushed later, and says so while it waits
The push queue was a channel in one process: three attempts inside one request of work, then the row was simply no longer owed to anybody. An endpoint down for ten minutes swallowed every alert raised in that window, and a restart swallowed everything still waiting. The alert table stayed correct the whole time, which is exactly what made the hole invisible from the surface. What is owed is now a row in alert_pushes: denormalised payload (retention prunes edge_alerts, and a delivery still owed must not go with the row it was copied from), attempts, next-attempt time, last error, and a claim so two edges over one database send each row once. Attempts are configuration (OpenWaf:Alerts:MaxPushAttempts, PushRetrySeconds), validated at startup like the other bounds; when they run out the row records that and the surface says how many were given up, because a counter that cannot tell 'still retrying' from 'stopped retrying' is the blindness this item removes. Surfaces: /admin-api/state answers alertPushPending/Delivered/GivenUp/OldestPendingAt/LastError from the table, /metrics publishes the same as gauges from a cache no older than 5s (the metrics endpoint's rule is that it never leans on the database per scrape). Retention prunes only rows that are finished. What the run caught, in order: (1) SchemaUpgradeTests hardcoded the migration count as a literal, so the new migration turned a working upgrade into a red test - the count is now read from the migrations assembly. (2) Two of the new queue tests asserted 'pending == 0' after waiting only for 'delivered >= 1'; one scene raises more than one alert, so the read landed between two rows and failed on a correct product - the wait now requires the queue to have emptied. (3) The whole integration suite answered 9 failures of 251, every one 'Timed out waiting for the entry point to build the IHost after 00:05:00', while the identical build minutes later answered 251/251 in 34s: a test host that cannot bind a loopback socket fails as a timeout, and the README now says so next to the scheduling note that used to be the only explanation on file. Gates on this tree: build 0 warnings / 0 errors, unit 277/277, integration 251/251 in 34s, smoke 68 passed / 0 failed (3 new), image 261 MB, compose-smoke 232 passed / 0 failed with 0 containers left behind (2 new, including the push-queue table being added by the edge to a volume that predates it), console 90 assertions / 0 failed. Refs OPEN-60. |
||
|
|
575ef88afe |
an operator can ask what the edge would answer, before it answers anyone
OPEN-59. Every other admin surface answers what the edge already did, so the only test for a path rule, an exemption or a country rule is a real visitor getting the real refusal. GET /admin-api/decide?ip=&path=&country= runs the same DecisionEngine over the same snapshot the wire reads — there is no second decision to drift — and narrates the order. The trace is the product: a verdict says what would happen, the pillar list says which pillar to change, and it keeps four silences apart (did_not_match, not_reached, not_enforced_in_this_mode, not_evaluated). In Observe mode the engine line says whether a live ban for that source exists, because 'nothing was known about this address' and 'something was known and the mode chose not to act' are the two answers operators read as one. What a preview cannot honestly answer — the live rate counter and a streak that depends on responses the upstream has not produced — is named in the body rather than left out. Three things the run caught. IPAddress.TryParse accepts abbreviated IPv4, so '203.0.113' parses as 203.0.113.0 and a missing octet was answered 'pass' for an address the operator did not mean; the guard now requires a full dotted quad. The preview read state.Current while the guard calls GetOrRefresh(), so it could answer from a snapshot the wire had already replaced — the whole claim of the feature is that the two agree. And a Pass carries no source key, so the Observe note claimed 'no live ban' for a source that had one; the key is now computed for the question rather than read off the answer. Gates on this tree: build 0 warnings / 0 errors, unit 256/256, integration 245/245, smoke 65/0, compose 229/0 against the built image (261 MB), console 90/0. |
||
|
|
892cec172f |
the edge answers /metrics in the format the operator's alerting already reads
OPEN-58. The edge had one push surface — the alert webhook, at-most-once, for the four things it can alert about — and every other number it keeps was readable by a human on /admin-api/state and by nothing else. 'The ban writes have been failing for forty minutes' is a pull question with a threshold on it, so it belongs in Prometheus, where the operator already keeps their alerting. The exposition is a pure type in the domain project (PrometheusText) rather than a metrics library: the numbers already exist in one place, and the parts that break a scrape — label escaping, HELP on one line, the name alphabet, NaN, sample ordering — are testable as a string without a running edge. EdgeCounterLedger adds the one piece of new state, counted at the single place that may refuse a request, so the verdict totals add up to the requests answered. Three rules, each a decision: aggregate only (no source key, address, path, user agent or operator note anywhere in the body, and the only labels are bounded sets written in the code — a label per source is a cardinality explosion and an IP leak); no query per scrape (every number is already in memory, so a scrape cannot be what makes an unhealthy database unhealthy for the request path); and behind the same token as the admin API, on an always-pass prefix, so an edge that has blocked the operator's own address is still watchable. The token check moved out of the admin group into AdminAuth rather than being copied. Three things the run caught. The 'closed surface' assertion passed alone and failed under the gate: Program falls back to OPENWAF_ADMIN_TOKEN when the configured token is blank and the gate scripts export a throwaway value into the test process, so a blank token there is an OPEN surface — 401, not 404. The smoke and compose sample helpers grepped for the metric name and matched the '# HELP' line first, answering with the help text's last word; they now match the line prefix. And EndpointFilterDelegate is not what AddEndpointFilter accepts — the two have different arities, which only shows when the filter is a method rather than a lambda at the call site. Gates on this tree: build 0 warnings / 0 errors, unit 250/250, integration 236/236, smoke 60/0, compose 223/0 against the built image (261 MB), console 90/0. |
||
|
|
871eac48a5 |
an upgrade adds the tables a database predates, and says what it added
The default schema step is EnsureCreated: it creates a missing database and changes nothing about an existing one. The migrate path could not rescue that database either, because a database EnsureCreated once made has no __EFMigrationsHistory, so the migration set would begin by creating tables that are already there. Same bug with two faces. An operator who upgraded kept a schema with every table except the new ones, and the pillar behind them answered as if there were nothing to see — the compose data volume outliving 'compose down' is exactly that state, which is where it was noticed. At startup the edge now lists the tables the model describes and the database lacks and creates exactly those, from the model through the provider in use, indexes included. A table that exists is never touched, so an upgrade cannot lose an operator's block list — proven on the wire, not asserted: a block written before the upgrade still refuses the same request after it, with the note the operator typed still in the listing. On the migrate path a database with no history table is baselined first: a migration is claimed as applied only when every table its target model describes is already present, and the claim stops at the first migration it cannot confirm, so a later one is never applied over an unclaimed earlier one. SchemaBaseline is that decision as a pure function; SchemaDdl is the statement filter over EF's own generated script, and an unrecognised statement is left out rather than run, because the safe failure is a table that stays missing and is reported. What happened is on /admin-api/state: schemaStrategy, schemaTablesAdded, schemaMigrationsBaselined, schemaMigrationsApplied, schemaMissingTables. The last is the invariant — non-empty names a pillar this build can run with no storage behind it, and OPENWAF_SCHEMA=none now changes nothing and reports all of it the same way. The limit is stated rather than hidden: the baseline recognises a table by its name, so a migration that alters an existing table still needs a human decision and the edge refuses to guess one. OPENWAF_SCHEMA is read through configuration instead of the environment directly. An environment variable still sets it; the change is that a test can now ask for a strategy without mutating process-wide state that parallel xUnit collections share. Gates on this tree: build 0 warnings / 0 errors, unit 240/240 (+13: the baseline claim, the statement filter), integration 230/230 in 22 s (+5: an edge started against a database with two tables dropped, the indexes arriving with the table, the operator block surviving, the baseline on the migrate path, and the operator-managed schema reporting rather than fixing), smoke passed 52 failed 0 unchanged, compose 216 passed 0 failed (+7: the same upgrade against the shipped image, where the volume really does outlive the stack), console 90 assertions 0 failed unchanged. Two things the new compose scene caught about the gate itself. The rule-write assertion used code(), which discards the body, so the first run answered 400 and the gate could not say why — the assertion now prints the body it got. And the delete looked its rule up with jget while writing jcount's loop variable, a NameError inside the helper that surfaced as a 405 on the assertion: the trap the script's own comment names, walked into anyway. |
||
|
|
f1715e4b7c |
a refused visitor gets the answer in sentences, and the status never moves
Every refusal this edge makes was written for the operator and read by a person. The audience that can actually act on a refusal — the office whose address tripped a streak, the visitor who followed a link into a path a rule refuses, the customer a geo policy misattributed — cannot do anything with {"error":"blocked_by_policy","reason":"3 consecutive refusals…"}. The guard now negotiates the body by Accept: a client that names text/html or application/xhtml+xml with q>0 gets a page, everything else gets the JSON it has always got. Accept: */* is deliberately not HTML: it means "I did not think about it", and it is what curl, monitors and SDKs send, which are exactly the clients that parse the body.
BlockPage is a pure function in the domain (no HttpContext, no I/O) so the wording is testable without a pipeline; it landed there rather than in Edge/Pipeline because the unit project references Domain and Infrastructure only. Three rules it exists to keep: the status never changes (a 429 that became 200 because a browser looked at it would be a defence that switches itself off when observed); nothing is fetched (inline CSS, no script/font/image/link, robots=noindex — the page goes to anonymous visitors and the runtime image is distroless); and the operator's own note is never rendered, because an operator block's reason is free text typed during an incident about a source, not a message to this visitor, so that branch shows the fact and no reference. What the page does carry is the machine reference the JSON already carried — rule_12, country_denied_DE, rate_3_of_2 — plus Retry-After and the expiry in UTC: the string the visitor quotes and the string the operator searches the listings for.
EdgeVerdict gained BlockRate so the rate branch logs the same verdict line the other four do instead of being the one refusal with no log, and the same helper now writes all five.
Gates on this tree: build 0 warnings / 0 errors, unit 227/227 (+20 BlockPage cases), integration 225/225 in 20 s (+6 wire cases asking what a browser and what curl get for the same refusal), smoke passed 52 failed 0 (+4), compose 209 passed 0 failed against the image at 261 MB, console 90 assertions 0 failed — unchanged, because this feature changes what a visitor sees and nothing the console shows.
The smoke count also had to be re-derived rather than trusted: a python replace whose replacement omitted its anchor deleted the line check 'the path is refused rather than proxied' 403 and left its command dangling as a continuation of the rule-add check above it, so the gate reported 51 and one assertion had silently vanished while still looking green. Same failure mode as the PolicyBounds edit earlier in this session — replace(a, b) where b does not contain a is a delete, not an insert.
|
||
|
|
5cf93ef0fd |
a source that asks too often is stopped, even when the origin keeps answering
Every defence this edge had reads something that already happened: the status the application answered, the country the address sits in, a list a human wrote. A source asking for a cheap path two hundred times a minute produces no refusal, so no streak matures, no path rule names it, and the origin serves all two hundred. The only signal is the count, and a count has to be kept while the requests are arriving — which is why this pillar is the one piece of live state on the request path, and why it runs after the ordered decision instead of inside it. `rateMode` off|observe|enforce, `rateLimitPerWindow`, `rateWindowSeconds` (policy_settings, so no schema change). Off is the default: a limit nobody wrote is a defence nobody asked for, and a false positive here locks out a whole office behind one address. `observe` counts and raises one `rate_breach` alert per source per window. `enforce` answers the request that crosses with 429 + Retry-After — the surplus never reaches the origin — and writes an engine ban, so the stop outlives the window, is shared with the other edges and survives a restart; from then on the answer is the ban's own 403. One breach, one alert, one ban write per source per window: a flood is exactly the traffic that turns a per-request durable write into the thing that takes the database down. Exempt by construction rather than by a second copy of the precedence rules: the counter runs only on a plain Pass, so an always-pass prefix, an allowlisted address, a matched rule, a block or a geo refusal never reaches it. The budget counts exactly the requests that would have cost the origin. Costs, stated rather than hidden: the counter is per process, so N edges allow N times the budget (the same trade `SharedStreaks` made for the streak, at a round trip per request instead of per observed response); the window is fixed, not sliding, so the worst sustained rate is twice the limit across one boundary — a sliding counter needs one entry per request, which is a map that grows at attack rate. Two things the run caught rather than the design assumed: * The guard wrote the 429 and then called next() anyway, so YARP answered "the request cannot be forwarded, the response has already started". The pillar now says whether the request may go through. * `StreakTracker.Configure` was called by nobody outside its own tests, so `maxTrackedSources` bounded nothing in a running edge — the map grew to the built-in 10000 whatever the operator had asked for. Both maps are configured at warm-up and on a policy write now. And the smoke gate was not testing what its first line says. The edge was started from the repository root, where there is no appsettings.json, so it loaded no ReverseProxy section at all, logged "Request reached the end of the middleware pipeline without being handled by application code" for every request, and answered 404 for a path the upstream was serving with 200. Every assertion in the file expects a 404 or a refusal, so the gate kept passing on an edge that never proxied anything. Naming the content root fixes it; the streak scene also waits for the ban row to exist before asking the wire whether it is enforced, because the ban is written out of band after the response that proved it. Gates on this tree: build 0 warnings 0 errors, unit 207/207, integration 219/219 in 20 s, smoke passed 48 failed 0, console 90 assertions 0 failed, compose 209 passed 0 failed, image 261 MB. OPEN-56 |
||
|
|
5e6a840731 |
a path rule refuses the request itself, before the upstream ever sees it
Every pillar this edge had until now judged the response or the source: a streak of refusals the upstream produced, a country, an operator's list of addresses. The request itself was never looked at. A known-bad request therefore always reached the origin and cost it something, and became a defence only if the origin's answer happened to fall in the refusal range three times in a row. A request rule is a path pattern an operator writes: `GET/POST/DELETE /admin-api/rules`, listed in the order they are enforced, with an action. `observe` counts matches (one alert per rule per 15 minutes, the tally on the listing) and lets the request through, which is how an operator learns what a rule would have blocked before it blocks anything; `block` answers 403 naming the rule id — the id, not the pattern, because a 403 body that quotes the pattern tells the visitor which payload to change. It fires in Observe mode too: the mode switches off what the edge decides by itself, not what a human wrote down. It sits below the allowlist and above the two source-level lists, because "this path is refused" is the more specific claim about this request. The pattern language is a glob — `*` and `?`, anchored, case-insensitive, `*` crossing `/` — and deliberately not a regex: the operator writes the pattern and an anonymous visitor writes the path, and `(a+)+$` against 400 a's is a ReDoS with the edge's CPU. A pattern that can only silently do nothing (no leading `/`, `/*`, a control character, over 256 characters) is refused with the reason, and at most 500 live rules exist because every request is checked against each. Two things the run caught rather than the design assumed: * The rules read shared one statement block with the rest of the snapshot. `request_rules` is the newest table in the schema, and the default schema step is EnsureCreated, which creates a missing database and changes nothing about an existing one — so every database created before this feature has every table except that one, and the first refresh after startup would have thrown, frozen the operator's block list at its old contents, and looked healthy. The rules read is a statement of its own now: a missing table costs the rules pillar and says so (`requestRulesAvailable`, `requestRulesError`, a NOT READ line over the rules table) while every other pillar keeps enforcing. The migration set was stale in the same direction — it never had `source_streaks` either, so the `migrate` path could not create the table OPEN-52 added; `AddRequestRules` adds both. * The console gate banned its own probe address. The seed sets the streak threshold to 3 and the gate probes 404 paths, so the last assertion in the new scene read a `blocked_by_policy` as "the rule is still in force" — and the ban, unlike the rule, outlives `compose down` in the data volume. The scene probes its own address now and the cleanup clears engine bans. Measured on this tree: build 0 warnings / 0 errors, unit 195/195 (44 new: the glob's semantics and rejections, and where the new pillar sits in the order), integration 208/208 in 25 s (14 new, including a fixture that drops the rules table and asserts the operator block is still enforced), smoke 36/0 (7 new against a running edge), console 85 assertions 0 failed (6 new, driving the rule form in a real browser), compose 209/0 against the built image at 261 MB. |
||
|
|
5c7b0bef3b |
an alert can be pushed to an endpoint, so a 03:00 outage reaches something that acts
The alerting pillar ended at a table. The rows are right — the server-error
streak fires, the dry-run candidate is recorded — and then they wait for an
operator to open a page. That is the posture this project already removed for
blocking ("blocking is usually manual: a human notices abuse and adds an IP.
That never fires at 3am"), applied one level up: an alert nobody is told about
never fires at 3am either.
OpenWaf:Alerts:WebhookUrl (env fallback OPENWAF_ALERT_WEBHOOK_URL) POSTs each
raised alert as JSON — kind, sourceKey, count, lastStatusCode, lastPath,
createdAt, detail — off the request path, from a bounded queue of 1000, and only
after the row is durably written. Three attempts with a short backoff;
OpenWaf:Alerts:WebhookTimeoutSeconds (1-60, default 5) refuses startup outside
that range rather than falling back, as the other startup-parsed bounds do. The
default is empty, which is no push at all: the shipped stack behaves exactly as
it did before.
The endpoint is counted like every other write side pillar, because a webhook
that has been down for a week is otherwise indistinguishable from a quiet night:
alertWebhookFailures, alertWebhookLost, alertWebhookDelivered,
alertWebhookLastError, alertWebhookLastSuccessAt, plus alertWebhookConfigured and
alertWebhookHost — host, never the URL, since a webhook URL carries its secret
in the path and this is rendered on the operator page. The console's alert line
now ends in "pushed to <host>, N delivered" or "not pushed anywhere: each row
waits for someone to open this page", so "no alerts" and "alerts go nowhere" stay
two different sentences.
Two things the tests caught instead of the design assuming:
* the queue was BoundedChannelFullMode.DropWrite, where TryWrite returns true
and the overflow vanishes with no trace — the counter it was written to feed
stayed at zero. The mode is Wait now, chosen for what TryWrite reports when
the queue is full; nothing here awaits a write, so the response path still
cannot block.
* a refused push counted as an entry lost, which conflated a lost delivery with
a lost record. The alert row is in the table either way, so EntriesLost on
this pillar is reserved for the one case where the push is gone for good.
Measured on this tree: build 0 warnings / 0 errors, unit 151/151 (19 new),
integration 194/194 in 28 s (3 new: the push arrives with the alert in it, an
unconfigured edge sends nothing and keeps every row, an endpoint answering 500 is
counted and does not undo the alert), smoke 29/0, console 79 assertions 0 failed,
compose 209/0 against the built image at 261 MB.
|
||
|
|
dbf3c725e6 |
an operator block can now be time-boxed, on the wire and on the page
The model always had it: BlockEntry.ExpiresAt, DecisionEngine asking IsLive before honouring a row, and the listing printing the column since OPEN-28. What did not exist was a way to set it — AddOperatorAsync wrote ExpiresAt = null for every operator block, and NewBlockRequest had no field for it. So "block this for the night" meant "block this, and remember to delete it in the morning", while the exemption form beside it already had a minutes box. POST /admin-api/blocks now takes expiresInMinutes with the same 1..5,256,000 bound and the same rule as the exemption's field: present sets the expiry, absent means the block stands until someone takes it off. Re-blocking an address that already carries an expiry moves it, because the second call means its own duration from now. 0 and 5,256,001 are a 400 naming the field rather than a permanent block bought by a zero in a box. The console gets the minutes input and refuses a zero before the round trip. Measured on this tree: build 0 warnings / 0 errors, unit 132/132, integration 185/185 in 19 s (4 new: the expiry lands and the listing says so; 0, -10 and 5,256,001 refused by name with nothing written and the address still itself; a block past its expiry stops being enforced while a second blocked address stays blocked and the dead row shows as expired rather than vanishing; a second POST moves the expiry), smoke 28/0, console 78 assertions 0 failed. The console gate run also printed the row it wrote: expiry cell "2026-10-04 15:05:37" against a permanent block's empty one. |
||
|
|
39dece60e4 |
the retention window is a config key now, and both tables say what it is
Retention was a constant on the policy record: 7 days for observations, 7 for bans and alerts, read from nothing and shown nowhere (OPEN-19). Two keys now, OpenWaf:Policy:ObservationRetentionDays and OpenWaf:Policy:BanRetentionDays, 1..365 whole days, and an out-of-range value aborts startup naming the key rather than falling back to 7 — the same shape OPEN-13 chose for the refresh TTL, because a silently widened window keeps rows longer than the deployment asked for and nothing on any surface would say so. Split into two keys: the two windows answer different questions and their sharing 7 days was coincidence. The window is printed where the rows it governs are printed: /admin-api/state and /admin-api/policy answer observationRetentionDays and banRetentionDays, the observation table appends "rows are pruned after Nd" and the alert table "alerts are pruned after Nd". Measured on this tree: build 0 warnings / 0 errors, unit 132/132, integration 181/181 in 20 s (8 new: 5 startup-refusal and bound cases, a 1-day window pruning a 3-day-old observation, a 30-day window keeping a ban ten days past expiry, both surfaces reporting 30 and 2, and the two defaults), smoke 28/0, console 76 assertions 0 failed. The console gate needed two of its own assertions rewritten, not relaxed: they compared the note text for equality and the sentence grew. Run against the real binary: ObservationRetentionDays=30 BanRetentionDays=2 reports 30 and 2 on both surfaces; ObservationRetentionDays=0 exits with "OpenWaf:Policy:ObservationRetentionDays must be a whole number of days between 1 and 365; got 0". |
||
|
|
3db8fdb76f |
An operator command that could not run is now asked of the shipped image
The storage-failure honesty fix (
|
||
|
|
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
|
||
|
|
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. |
||
|
|
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. |
||
|
|
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.
|
||
|
|
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.
|
||
|
|
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. |
||
|
|
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. |
||
|
|
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. |
||
|
|
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.
|
||
|
|
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. |
||
|
|
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.
|
||
|
|
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). |
||
|
|
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). |
||
|
|
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. |
||
|
|
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. |
||
|
|
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. |
||
|
|
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. |
||
|
|
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).
|
||
|
|
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.
|
||
|
|
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.
|
||
|
|
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.
|
||
|
|
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
|
||
|
|
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.
|
||
|
|
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.
|
||
|
|
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.
|
||
|
|
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. |
||
|
|
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.
|
||
|
|
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. |
||
|
|
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.
|