From b2e87ddc2cb04078bf51a2cfebb65f09b39dad40 Mon Sep 17 00:00:00 2001 From: Muse Sweep Date: Sat, 31 Oct 2026 20:55:54 +0000 Subject: [PATCH] =?UTF-8?q?github-backup:=20deployed=20Worker=20wiring=20?= =?UTF-8?q?=E2=80=94=20KV=20namespace=20id=20+=20drainer=20UA=20fix?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Worker hatch-repo-backup-webhook is deployed (workers.dev) with the GHB_EVENTS KV namespace created; record its id. The laptop drainer polls with python-urllib, whose default UA Cloudflare's edge answers 403 (verified live); send a plain browser UA. Queue flow proven: signed push -> 202 queued -> /queue returns event -> ack deletes. --- infra/github-backup/bin/drain_queue.py | 3 +++ infra/github-backup/worker/wrangler.toml | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/infra/github-backup/bin/drain_queue.py b/infra/github-backup/bin/drain_queue.py index 64e0bf889e..26d74cb4c6 100644 --- a/infra/github-backup/bin/drain_queue.py +++ b/infra/github-backup/bin/drain_queue.py @@ -28,6 +28,9 @@ def worker_req(path, payload=None): data = json.dumps(payload).encode() if payload is not None else None req = urllib.request.Request(url, data=data, method="POST" if data else "GET") req.add_header("Authorization", "Bearer " + os.environ["GHB_WORKER_BEARER"]) + # Cloudflare's edge bot-filters the default Python-urllib UA (403); + # a plain browser UA is required for this poller to reach the Worker. + req.add_header("User-Agent", "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36") if data: req.add_header("Content-Type", "application/json") with urllib.request.urlopen(req, timeout=60) as r: diff --git a/infra/github-backup/worker/wrangler.toml b/infra/github-backup/worker/wrangler.toml index d2a389079a..ed0b58f3f0 100644 --- a/infra/github-backup/worker/wrangler.toml +++ b/infra/github-backup/worker/wrangler.toml @@ -7,7 +7,7 @@ compatibility_date = "2024-11-01" # then paste the id here (ids are not secrets; they name the namespace). [[kv_namespaces]] binding = "GHB_EVENTS" -id = "REPLACE_WITH_KV_NAMESPACE_ID" +id = "46b1fe46e6434c5fa509556ed3a53ea2" # Secrets (never in this file): # wrangler secret put GITHUB_WEBHOOK_SECRET # same value as on the App