fix: better bad-rep detector

This commit is contained in:
fufsob committed 2026-09-14 19:40:38 +00:00
1 parent 7de094078c
commit 5c6b2b4163
2 files changed
+8 -5

No files matched your search

+4 -3
View File
@@ -2,12 +2,13 @@
# refused $tags at $now, or crawled on them. $why is "wall:<page>" (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)"))})
+4 -2
View File
@@ -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"
'';