waf: one Cookie line, and a 500 ms GeoJS wait (closes #401)
check / check (push) Failing after 14m7s

A browser sends all its cookies on one Cookie line (RFC 6265), and Go's
server joins HTTP/2 Cookie lines into one, so waf now refuses a second
line with 431. Further lines only gave a visitor more bytes for the Core
Rule Set to read. The refusal logs cookie_lines and cookie_lines_limit.

The default of SWW_WAF_ASN_AND_COUNTRY_LOOKUP_TIMEOUT_MS drops from 800
to 500 milliseconds, so the Core Rule Set's share of rproxy's 2 seconds
grows from 1 to 1.3 seconds. The slowest worst-case request takes about
0.84 seconds of processor time with every core busy.

Model: opus-5-5
This commit is contained in:
clawbot authored and sneak committed 2026-11-16 22:15:13 +00:00
1 parent 988f117ef3
commit 01a8a7aa08
9 files changed
+68 -47

No files matched your search

+1 -1
View File
@@ -548,7 +548,7 @@ func WAFFromEnvironment(v *viper.Viper) (*WAF, error) {
LookupDBPath: env.value("SWW_WAF_LOOKUP_DB_PATH", ""),
ASNAndCountryLookupTimeout: env.milliseconds(
"SWW_WAF_ASN_AND_COUNTRY_LOOKUP_TIMEOUT_MS",
"800",
"500",
),
ExclusivelyAllowedCountries: env.countries(
"SWW_WAF_EXCLUSIVELY_ALLOWED_COUNTRIES", ""),
+3 -3
View File
@@ -286,7 +286,7 @@ func TestDefaults(t *testing.T) {
RuleFilesEnabled: true,
})
wantLookupSettings(t, cfg, config.WAF{
LookupSource: defaultLookupSource, ASNAndCountryLookupTimeout: 800 * time.Millisecond,
LookupSource: defaultLookupSource, ASNAndCountryLookupTimeout: 500 * time.Millisecond,
AddLookupHeaders: true,
})
wantByteLimitSettings(t, cfg, config.WAF{
@@ -1407,7 +1407,7 @@ func TestLookupSettingsAsSet(t *testing.T) {
// With no client looked up, the headers are off unless set.
cfg = wafFromEnvironment(t, environment{lookupSource: off})
wantLookupSettings(t, cfg, config.WAF{
LookupSource: off, ASNAndCountryLookupTimeout: 800 * time.Millisecond,
LookupSource: off, ASNAndCountryLookupTimeout: 500 * time.Millisecond,
})
}
@@ -2933,7 +2933,7 @@ func TestLogsEachSettingWithItsValue(t *testing.T) {
bytesCounted: "both",
lookupSource: defaultLookupSource,
lookupDBPath: "",
asnAndCountryLookupTimeout: "800",
asnAndCountryLookupTimeout: "500",
addLookupHeaders: enabled,
allowedCountries: "",
tagLists: "",