From 8227be0dcd3109c6f25a87717186f7ff39a548d0 Mon Sep 17 00:00:00 2001 From: Bryan Brooks Date: Thu, 19 Feb 2026 13:45:04 -0600 Subject: [PATCH] fix: sanitize colons in handles, improve error message Add colon-to-dot conversion in handle sanitization to fix typos like "bkb:arcnode.xyz" (: is adjacent to . on keyboards). Also update error message to mention custom domains, not just Bluesky. --- gateway/src/routes/oidc/authorize.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/gateway/src/routes/oidc/authorize.ts b/gateway/src/routes/oidc/authorize.ts index 75d81ba..472e266 100644 --- a/gateway/src/routes/oidc/authorize.ts +++ b/gateway/src/routes/oidc/authorize.ts @@ -283,8 +283,10 @@ export function createAuthorizeRouter( return res.status(400).send('Missing required parameters'); } - // Sanitize handle: strip @, add .bsky.social if no domain + // Sanitize handle: strip @, fix common typos, add .bsky.social if no domain let sanitizedHandle = handle.trim().replace(/^@/, ''); + // Replace colons with dots (common keyboard typo: "user:bsky.social") + sanitizedHandle = sanitizedHandle.replace(/:/g, '.'); // Strip email-style @domain (e.g. "user@bsky.social" → "user.bsky.social") sanitizedHandle = sanitizedHandle.replace(/@/, '.'); // If no dots, assume .bsky.social @@ -335,7 +337,7 @@ export function createAuthorizeRouter( let userMessage = 'Authentication failed. Please try again.'; const errMsg = error instanceof Error ? error.message : ''; if (errMsg.includes('resolve identity') || errMsg.includes('Invalid handle')) { - userMessage = 'Could not find that Bluesky handle. Enter your full handle (e.g. yourname.bsky.social).'; + userMessage = 'Could not find that handle. Enter your full handle (e.g. yourname.bsky.social or your.custom.domain).'; } const isJsonRequest = req.is('json'); if (isJsonRequest) { -- knotmirror 0.0.1