diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 3dd00ae..485c27b 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -16,12 +16,12 @@
# What has been done to narrow the darwin/linux gap without a runner:
# scripts/ci-linux-rehearsal.sh runs the gates in containers. Source gates
# (restore, build, unit, integration, smoke) in mcr.microsoft.com/dotnet/sdk:10.0
-# — Ubuntu 24.04.5, SDK 10.0.401 resolving the pinned global.json, 54/54 + 29/29
+# — Ubuntu 24.04.5, SDK 10.0.401 resolving the pinned global.json, 54/54 + 30/30
# + 19/19, first try, 1:02.81 wall cold: evidence that the 25-minute timeout
-# below is not near. Compose gate in docker:cli against the host daemon: 35/35 on
+# below is not near. Compose gate in docker:cli against the host daemon: 38/38 on
# Linux. Console gate in mcr.microsoft.com/playwright:v1.63.0-noble — the stack
# seeded by docker:cli, the same console-check.cjs driving it in a real Linux
-# Chromium: 30/30. So every gate this file runs now has a Linux number. What it
+# Chromium: 33/33. So every gate this file runs now has a Linux number. What it
# does not have is a runner: the repository has no remote, so this file has
# never executed on GitHub.
#
@@ -125,7 +125,7 @@ jobs:
#
# Honest status: this job has never run on a runner, like the rest of the
# file. What was verified is the gate it calls — scripts/ci-gates.sh console
- # passed locally (30 assertions, playwright-core 1.63.0 — the version pinned
+ # passed locally (33 assertions, playwright-core 1.63.0 — the version pinned
# right above, and rehearsed on Linux in the Playwright image), and its
# control (a wrong token) exits 1 rather than reporting success. The step
# calls the gate by name rather than retyping the script, so the CI definition
diff --git a/README.md b/README.md
index ea78117..4ef3dcf 100644
--- a/README.md
+++ b/README.md
@@ -224,6 +224,10 @@ outranks every ban). Each ban row has a delete that removes that row, each allow
row a remove, and each country row a rule toggle. There is no DELETE for a
country rule, so the toggle back is `PUT ?allowed=true`: the row stays behind
and means "not denied".
+The summary line states which geo database this edge is enforcing on, when it was
+built and how old it is (marked past the 90-day runtime alarm), and the snapshot
+age against the TTL it is measured against — because on a single edge the TTL is
+invisible, and behind a load balancer it *is* the delay a ban has.
It shows the alerts the edge raises — `server_error_streak` (your upstream is
failing, and the edge will not ban the visitor who saw it) and `candidate_ban`
(the rule would have banned, but the mode is Observe). That table is the whole
@@ -256,7 +260,7 @@ deployment.
The console gate starts the stack, seeds a source sitting at 2 of a threshold of
3 and an operator block with a reason, four 502s from an address chosen for this
run (`/boom`, see the alerting note above), drives `/admin` in a real Chromium,
-and asserts 30 things. The read side: it authenticated, listed the streak as
+and asserts 33 things. The read side: it authenticated, listed the streak as
current-over-threshold rather than as a historical maximum, listed the operator
block with its reason, listed observations and countries with bars that have
real pixel widths, listed the alert this run's seeding wrote (by source and
@@ -294,10 +298,10 @@ against the host daemon, so the image build and the stack are Linux.
Rehearsed 2026-10-01. Source gates: Ubuntu 24.04.5, SDK **10.0.401** resolving
`dotnet/global.json` (pinned `10.0.100`, `rollForward: latestFeature` — which is
also the answer to whether `setup-dotnet` with `10.0.x` satisfies the pin), unit
-**54/54**, integration **29/29**, smoke **19/19**, first try, nothing to fix;
+**54/54**, integration **30/30**, smoke **19/19**, first try, nothing to fix;
wall clock with a cold container and a cold NuGet cache **1:02.81**, so the
source job's 25-minute timeout is not close even on a slower CPU. Compose gate on
-Linux: **35 passed, 0 failed** (27 before the geo-pin and alerting assertions),
+Linux: **38 passed, 0 failed** (27 before the geo-pin and alerting assertions),
enforcement lag 12 ms and 36 ms in two runs. Console gate on Linux: **26
assertions, 0 failed** — described below. `scripts/geo-db-freshness.sh` was run
in `mcr.microsoft.com/dotnet/sdk:10.0` too: current pin answers 0, and a forced
@@ -320,7 +324,7 @@ and the stack is torn down afterwards. That image ships the browsers but not the
npm package, so the script installs `playwright-core` into `/tmp` and points
`PLAYWRIGHT_CORE` at it, mounting the repository read-only so the install never
lands in the working tree. Rehearsed the same day on Linux 7.0.12-linuxkit
-aarch64, node v24.20.0, `chromium-1243`: **30 assertions, 0 failed**, including
+aarch64, node v24.20.0, `chromium-1243`: **33 assertions, 0 failed**, including
the round-trip the page alone cannot fake — a ban drawn on the page answers 301
on the next request from that address. All three scenes in one cold run:
**2:14.33**.
@@ -363,10 +367,10 @@ dotnet/
OpenWaf.Infrastructure/ EF Core (sqlite/postgres), snapshot store, writers, MMDB geo
OpenWaf.Edge/ the deployable: guard, observer, admin API, healthcheck mode
OpenWaf.Tests.Unit/ 54 tests over the decision logic
- OpenWaf.Tests.Integration/ 29 tests driving the real pipeline against a fake upstream
+ OpenWaf.Tests.Integration/ 30 tests driving the real pipeline against a fake upstream
scripts/smoke.sh 19 assertions against a running edge + a real upstream
-scripts/compose-smoke.sh 35 assertions against the built image (compose + nginx)
-scripts/console-check.cjs 30 assertions against the page, in a real Chromium
+scripts/compose-smoke.sh 38 assertions against the built image (compose + nginx)
+scripts/console-check.cjs 33 assertions against the page, in a real Chromium
scripts/geo-db-freshness.sh the pinned geo database vs the vendor (0/1/2)
.github/workflows/ci.yml runs the gates on every push
.github/workflows/geo-freshness.yml the same check on a schedule
diff --git a/dotnet/OpenWaf.Edge/Admin/AdminConsole.cs b/dotnet/OpenWaf.Edge/Admin/AdminConsole.cs
index 37030ff..1e108fa 100644
--- a/dotnet/OpenWaf.Edge/Admin/AdminConsole.cs
+++ b/dotnet/OpenWaf.Edge/Admin/AdminConsole.cs
@@ -167,11 +167,12 @@ function row(cells) {
async function load() {
if (!token) { note('no token', true); return; }
try {
- const [state, blocksRes, obs, streaks, countries, rules, allow, alerts] = await Promise.all([
+ const [state, blocksRes, obs, streaks, countries, rules, allow, alerts, geo] = await Promise.all([
api('/admin-api/state'), apiRaw('/admin-api/blocks?live=false'),
api('/admin-api/observations?limit=25'), api('/admin-api/streaks'),
api('/admin-api/countries/summary'), api('/admin-api/countries'),
- api('/admin-api/allow'), api('/admin-api/alerts?limit=25')
+ api('/admin-api/allow'), api('/admin-api/alerts?limit=25'),
+ api('/admin-api/geo')
]);
const blocks = blocksRes.body;
// The listing is capped server-side. Saying so is the difference between a
@@ -182,11 +183,22 @@ async function load() {
const allowed = new Map((rules || []).map((r) => [r.code, r.isAllowed]));
el('summary').innerHTML =
'mode ' + esc(state.mode) + ' ' +
- 'snapshot ' + esc(state.snapshotAgeSeconds) + 's ' +
+ 'snapshot ' + esc(state.snapshotAgeSeconds) + 's / ttl '
+ + esc(state.snapshotTtlSeconds) + 's ' +
'tracked ' + esc(state.trackedSources) + ' ' +
'engine bans ' + esc(state.engineBans) + ' ' +
'operator blocks ' + esc(state.operatorBlocks) + ' ' +
- 'allow entries ' + esc(state.allowEntries) + '';
+ 'allow entries ' + esc(state.allowEntries) + '' +
+ // Which geo database this edge is actually enforcing on, and how old it is.
+ // The pin ages with the image and a named volume is seeded once, so "which
+ // one am I running" is a question an operator can only answer from here.
+ // Marked when it passes the 90-day runtime alarm, the same rule /healthz
+ // reports as geoStale.
+ ' ' + (geo && geo.loaded
+ ? 'geo '
+ + esc(geo.database || 'unknown') + ' \u00b7 built ' + esc((geo.builtAt || '').slice(0, 10))
+ + ' \u00b7 ' + esc(geo.ageDays) + 'd'
+ : 'geo database not loaded');
el('mode').value = state.mode;
el('blocks').tBodies[0].innerHTML = (blocks || []).map((b) => row([
{ v: b.sourceKey }, { v: b.source }, { v: b.reason },
diff --git a/dotnet/OpenWaf.Edge/Admin/AdminEndpoints.cs b/dotnet/OpenWaf.Edge/Admin/AdminEndpoints.cs
index e42131c..fbee9f4 100644
--- a/dotnet/OpenWaf.Edge/Admin/AdminEndpoints.cs
+++ b/dotnet/OpenWaf.Edge/Admin/AdminEndpoints.cs
@@ -219,6 +219,12 @@ internal static class AdminEndpoints
group.MapGet("/state", (EdgeStateStore state, StreakTracker tracker) => Results.Ok(new
{
snapshotAgeSeconds = Math.Round((DateTimeOffset.UtcNow - state.Current.GeneratedAt).TotalSeconds, 1),
+ // The age without the TTL it is measured against is half a number. On
+ // a single edge the TTL is invisible; behind a load balancer it *is*
+ // the propagation delay for a ban, so the page has to be able to say
+ // which value this process actually got (the key is validated at
+ // startup, 1-300 s, and /healthz reports it too).
+ snapshotTtlSeconds = Math.Round(state.RefreshTtl.TotalSeconds, 1),
trackedSources = tracker.TrackedCount,
operatorBlocks = state.Current.OperatorBlocks.Count,
engineBans = state.Current.EngineBans.Count,
diff --git a/dotnet/OpenWaf.Tests.Integration/SnapshotStalenessTests.cs b/dotnet/OpenWaf.Tests.Integration/SnapshotStalenessTests.cs
index 4668647..1b50a25 100644
--- a/dotnet/OpenWaf.Tests.Integration/SnapshotStalenessTests.cs
+++ b/dotnet/OpenWaf.Tests.Integration/SnapshotStalenessTests.cs
@@ -90,4 +90,25 @@ public sealed class SnapshotStalenessTests
await using var f = new EdgeFixture(refreshTtlSeconds: 7);
Assert.Contains("\"snapshotTtlSeconds\":7", await f.Client.GetStringAsync("/healthz"));
}
+
+ [Fact]
+ public async Task The_state_surface_carries_the_ttl_the_page_shows_it_against()
+ {
+ await using var f = new EdgeFixture(refreshTtlSeconds: 7);
+
+ // The console reads /admin-api/state, not /healthz, and a snapshot age
+ // without the TTL it is measured against is half a number { on a single
+ // edge the TTL is invisible, behind a load balancer it *is* the delay a
+ // ban has. So the endpoint the page reads has to carry it too, and the
+ // compose gate asserts the value on the deployed image.
+ // The admin surface is token-gated; /healthz is not, which is why the
+ // test above can read the same value with a bare client and this one
+ // cannot.
+ using var request = new HttpRequestMessage(HttpMethod.Get, "/admin-api/state");
+ request.Headers.TryAddWithoutValidation("X-Admin-Token", EdgeFixture.AdminToken);
+ using var response = await f.Client.SendAsync(request);
+ var json = await response.Content.ReadAsStringAsync();
+ Assert.Contains("\"snapshotTtlSeconds\":7", json);
+ Assert.Contains("\"snapshotAgeSeconds\"", json);
+ }
}
diff --git a/scripts/compose-smoke.sh b/scripts/compose-smoke.sh
index e742b3a..7364c4d 100755
--- a/scripts/compose-smoke.sh
+++ b/scripts/compose-smoke.sh
@@ -36,13 +36,17 @@ admin() { curl -s -m 10 -H "X-Admin-Token: $OPENWAF_ADMIN_TOKEN" "$@"; }
# per assertion — sed over JSON silently returns the first match of anything.
jcount() { python3 -c "import json,sys
d=json.load(sys.stdin); print(sum(1 for b in d if $1))"; }
-jget() { python3 -c "import json,sys
+jget() { python3 -c "import json,sys
d=json.load(sys.stdin)
for o in d:
if $1: print(o.get('$2') or ''); break"; }
-code() { curl -s -m 10 -o /dev/null -w '%{http_code}' "$@"; }
-hdr() { curl -s -m 10 -D - -o /dev/null "$@" | tr -d '\r'; }
-xff() { printf 'X-Forwarded-For: %s' "$1"; }
+code() { curl -s -m 10 -o /dev/null -w '%{http_code}' "$@"; }
+hdr() { curl -s -m 10 -D - -o /dev/null "$@" | tr -d '\r'; }
+xff() { printf 'X-Forwarded-For: %s' "$1"; }
+# One scalar field out of a JSON object, for the endpoints that answer with an
+# object rather than a list (jcount/jget read lists).
+jval() { python3 -c "import json,sys
+d=json.load(sys.stdin); v=d.get('$1'); print('' if v is None else v)"; }
# Alerts are counted as a delta (see the alert sections): the data volume
# survives `compose down`, so an absolute count would be history, not this run.
# jcount's loop variable is `b` (jget's is `o`) — the two helpers read the same
@@ -124,6 +128,13 @@ check 'a bystander is unaffected' '404' "$(code -H "$(xff "$BYSTANDER")"
check 'ban carries Retry-After' 'yes' "$(hdr -H "$(xff "$SCANNER")" "$EDGE/xmlrpc.php" | grep -qi '^retry-after:' && echo yes || echo no)"
check 'ban names its reason' 'yes' "$(curl -s -H "$(xff "$SCANNER")" "$EDGE/xmlrpc.php" | grep -q 'consecutive refusals' && echo yes || echo no)"
check 'engine ban is listed for the scanner' '1' "$(admin "$EDGE/admin-api/blocks" | jcount "b['sourceKey']=='$SCANNER'")"
+# /admin-api/state is what the console's summary line reads, and until now no
+# gate called it at all: the page could have been reporting a mode the edge is
+# not in, or a TTL nobody configured. Asserted at the moment the ban above
+# exists, so the numbers have a known value rather than "some number".
+check 'state names the mode in force' 'Enforce' "$(admin "$EDGE/admin-api/state" | jval mode)"
+check 'state reports the snapshot TTL as configured' '30' "$(admin "$EDGE/admin-api/state" | jval snapshotTtlSeconds)"
+check 'state counts the engine ban the streak wrote' '1' "$(admin "$EDGE/admin-api/state" | jval engineBans)"
check 'a banned source still reaches the console' '200' "$(code -H "$(xff "$SCANNER")" "$EDGE/admin")"
check 'the console markup carries no token' 'yes' "$(curl -s "$EDGE/admin" | grep -q "$OPENWAF_ADMIN_TOKEN" && echo no || echo yes)"
check 'the console is html, not a proxy miss' 'text/html' "$(curl -s -o /dev/null -w '%{content_type}' "$EDGE/admin" | cut -d';' -f1)"
diff --git a/scripts/console-check.cjs b/scripts/console-check.cjs
index 55751d5..2408efb 100644
--- a/scripts/console-check.cjs
+++ b/scripts/console-check.cjs
@@ -77,6 +77,11 @@ const rgb = (s) => s.match(/\d+/g).slice(0, 3).map(Number);
if (SCREENSHOT) await page.screenshot({ path: SCREENSHOT, fullPage: true });
check('the page authenticates and reads the state', /mode Enforce/.test(summary), summary);
+ // The age of the snapshot is meaningless without the TTL it is measured
+ // against, and on a single edge the TTL is otherwise invisible { yet it is the
+ // propagation delay for a ban behind a load balancer (OPEN-12/13).
+ check('the summary states the snapshot age against the configured TTL',
+ /snapshot [\d.]+s \/ ttl 30s/.test(summary), summary);
check('a standing streak is listed as current/threshold, not as a historical maximum',
streakRows.some((r) => r[0] === SEED_SOURCE && /2 \/ 3/.test(r[1] || '')),
JSON.stringify(streakRows.map((r) => [r[0], r[1]])));
@@ -103,6 +108,15 @@ const rgb = (s) => s.match(/\d+/g).slice(0, 3).map(Number);
// and every assertion would have stayed green. The seed hit /boom four times
// from an address chosen for this run, so a residue alert from an older run
// cannot satisfy this.
+ // Which geo database the edge is enforcing on is a question the operator can
+ // only answer from the running process { the pin ages with the image and a named
+ // volume is seeded once. /admin-api/geo had no gate at all before this.
+ check('the summary names the geo database, its build date and its age',
+ /geo DBIP-Country-Lite \u00b7 built \d{4}-\d{2}-\d{2} \u00b7 \d+(\.\d+)?d/.test(summary), summary);
+ const warnPills = await page.$$eval('#summary .pill.warn', (els) => els.map((e) => e.textContent.trim()));
+ check('a database inside the 90-day alarm is not marked stale',
+ !warnPills.some((x) => /geo/.test(x)), JSON.stringify(warnPills));
+
const alertRows = await cells('#alerts tbody tr');
const errAlerts = alertRows.filter((r) => r[0] === 'server_error_streak' && r[1] === SEED_ERROR);
check('the alerts table lists the server-error streak this run wrote',