Files
openwaf/dotnet/OpenWaf.Edge/appsettings.json
T
Pavlo Ratushnyi 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".
2026-10-04 15:37:27 +02:00

63 lines
1.3 KiB
JSON

{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning",
"Microsoft.EntityFrameworkCore": "Warning"
}
},
"AllowedHosts": "*",
"ConnectionStrings": {
"OpenWaf": "Data Source=openwaf.db"
},
"Database": {
"Provider": "sqlite"
},
"GeoIp": {
"DatabasePath": ""
},
"OpenWaf": {
"Admin": {
"Token": ""
},
"State": {
"RefreshTtlSeconds": 30
},
"Policy": {
"Mode": "Observe",
"StreakThreshold": 10,
"StreakWindow": "00:05:00",
"BanDuration": "01:00:00",
"RefusalRange": "400-499",
"ServerErrorRange": "500-599",
"Geo": "Off",
"TrustProxyHeaders": false,
"MaxTrackedSources": 10000,
"Ipv4KeyPrefixLength": 32,
"Ipv6KeyPrefixLength": 64,
"EngineBlockStatus": 403,
"OperatorBlockStatus": 301,
"ObservationRetentionDays": 7,
"BanRetentionDays": 7,
"DefaultRedirectTargets": [ "https://www.iana.org/help/example-domains" ]
}
},
"ReverseProxy": {
"Routes": {
"all": {
"ClusterId": "upstream",
"Match": { "Path": "{**catch-all}" }
}
},
"Clusters": {
"upstream": {
"Destinations": {
"upstream1": {
"Address": "http://127.0.0.1:9000/"
}
}
}
}
}
}