153 Commits
Author SHA1 Message Date
Pavlo Ratushnyi 3cede3c302 Dockerfile: fetch the geoip database in its own stage
Downloading inside the SDK stage put apt-get update on every cache miss;
observed as a >12-minute stall on the first build. A static curl image
removes apt entirely from this step and the download itself takes ~2s.

Also pins DBIP_VERSION to 2026-09: the 2026-04 file is gone from the
DB-IP CDN (404), which failed the build.
2026-10-01 09:49:32 +02:00
Pavlo Ratushnyi 565da4fab5 Add EF Core migrations; make schema strategy explicit
- dotnet-ef 10.0.0 as a local tool manifest, InitialCreate generated against
  PostgreSQL (the provider a real deployment runs) via a design-time factory,
  so migrations never need to boot the edge
- EdgeStateWarmer picks the strategy: migrate for postgres, ensurecreated for
  the sqlite default, none when the operator owns the schema. A migration set
  is provider-shaped SQL and is not applied across providers
- README documents the schema story

Regressions checked: 36 unit + 14 integration tests, scripts/smoke.sh 19/19.
2026-10-01 02:32:12 +02:00
Pavlo Ratushnyi a3d0777492 openwaf: edge WAF with one decision point and a streak ban
Initial implementation of the OPEN-2 epic: a .NET 10 YARP edge that
decides from what the upstream answered.

Design (docs/ARCHITECTURE.md, tracker authority 4c9de3f6):
- one short-circuit point, ordered: always-pass prefixes -> allowlist ->
  operator block (301) -> engine ban (403 + Retry-After) -> geo (451)
- a post-response observer feeds a consecutive-refusal streak; N refusals
  in M minutes ban for BanDuration; 5xx alerts and never bans
- provenance on the block row, so clearing engine bans cannot touch an
  operator's entries; the toggle is Off/Observe/Enforce and changes no rows
- inherited protections from the reference deployment: one durable write
  per source per 30s, LRU-bounded streak map, no DB on the request path

Verification: 36 unit + 14 integration tests, plus scripts/smoke.sh (19
assertions against a running edge and a real upstream, including the
distroless --healthcheck mode).

Findings worth keeping (documented in docs/ARCHITECTURE.md):
- ctx.RequestAborted silently cancelled the ban write, because the
  observer runs after the response is written
- SQLite cannot translate DateTimeOffset comparisons; timestamps are
  stored as integers there and stay timestamptz on PostgreSQL
- CIDR masking order silently widened prefixes (198.51.100.24/19 -> /16)
- an empty string in appsettings.json defeats the env fallback (?? on "")
- concurrent ban writes raced into the unique index and lost evidence

Also moves the unrelated 2026-09-30 inference benchmarks out of the
project root into research/.
2026-10-01 02:13:01 +02:00