aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2026-05-17 23:48:59 -0700
committerAdam Soltys <[email protected]>2026-05-17 23:48:59 -0700
commit7f4bf4d886bd43f3b15f18e3c4f7c040892e9f73 (patch)
tree3641911141036f7309ca9615140726adddad727b
parentdfd31ad83d24e780523f4e76d04a76aba1fa8be1 (diff)
downloadcoinos-server-7f4bf4d886bd43f3b15f18e3c4f7c040892e9f73.tar.gz
coinos-server-7f4bf4d886bd43f3b15f18e3c4f7c040892e9f73.zip
verifyRecaptcha: check x-forwarded-host before host header
Tor users access via .onion through a forwarding layer that puts the real hostname in x-forwarded-host while the literal host header is the internal target. Without checking the forwarded header first, captcha prompted for .onion visitors who should have been exempt. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
-rw-r--r--routes/users.ts2
1 files changed, 1 insertions, 1 deletions
diff --git a/routes/users.ts b/routes/users.ts
index 00083e38..05572b12 100644
--- a/routes/users.ts
+++ b/routes/users.ts
@@ -39,7 +39,7 @@ const verifyRecaptcha = async (response, c?, body?) => {
const { recaptcha: secret } = config;
if (!secret) return true;
- const reqHost = c?.req?.header("host") || "";
+ const reqHost = c?.req?.header("x-forwarded-host") || c?.req?.header("host") || "";
if (reqHost.endsWith(".onion")) return true;
const uaRaw = c?.req?.header("user-agent");