From 5c6b2b4163558b143c1ab452447ec30714cdee86 Mon Sep 17 00:00:00 2001 From: fufsob Date: Mon, 14 Sep 2026 19:40:38 +0000 Subject: [PATCH] fix: better bad-rep detector --- modules/proxy-suite/autoproxy-strike.jq | 7 ++++--- nix/checks/repo.nix | 6 ++++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/modules/proxy-suite/autoproxy-strike.jq b/modules/proxy-suite/autoproxy-strike.jq index c7e8c2d..0f98cca 100644 --- a/modules/proxy-suite/autoproxy-strike.jq +++ b/modules/proxy-suite/autoproxy-strike.jq @@ -2,12 +2,13 @@ # refused $tags at $now, or crawled on them. $why is "wall:" (a block page: # the site's security layer refused the address while another egress got past), # "refused" (the origin refused it while another egress got content) or "slow". -# A domain counts once per exit, for $ttl seconds. One wall makes an exit bad - -# it is the site's own verdict on the address; the guesses need two domains. +# A domain counts once per exit, for $ttl seconds; two domains make an exit bad. +# Walls too: a security layer scores requests as much as addresses, so one wall +# may be a passing challenge rather than a verdict on the exit. # Empty $tags only expires. reduce $tags[] as $t (.; .exits[$t].strikes[$d] = {why: $why, at: $now}) | .exits |= map_values( ((.strikes // {}) | with_entries(select(.value.at + $ttl > $now))) as $s | . + {strikes: $s, - bad: (($s | length) >= 2 or any($s[]; .why | startswith("wall:"))), + bad: (($s | length) >= 2), badBy: ($s | to_entries | sort_by(.value.at) | map("\(.key) \(.value.why)"))}) diff --git a/nix/checks/repo.nix b/nix/checks/repo.nix index 24d9f2a..d4eba66 100644 --- a/nix/checks/repo.nix +++ b/nix/checks/repo.nix @@ -540,9 +540,11 @@ # A TTL later the older strike has expired. s="$(k '[]' "" "" 1115 "$s")" jq -e '.exits.a | (.bad | not) and .badBy == ["pximg.net slow"]' <<<"$s" > /dev/null - # A block page is the site's own verdict on the address: one is enough. + # A block page may be a passing challenge: one is not enough either. s="$(k '["b"]' colorfulpalette.org wall:aws-waf 1120 "$s")" - jq -e '.exits.b | .bad and .badBy == ["colorfulpalette.org wall:aws-waf"]' <<<"$s" > /dev/null + jq -e '.exits.b | (.bad | not) and .badBy == ["colorfulpalette.org wall:aws-waf"]' <<<"$s" > /dev/null + s="$(k '["b"]' fandom.com wall:cloudflare 1130 "$s")" + jq -e '.exits.b | .bad and .badBy == ["colorfulpalette.org wall:aws-waf", "fandom.com wall:cloudflare"]' <<<"$s" > /dev/null touch "$out" '';