From 18bc0801370625e1dbdd6dc94003dd660da2016a Mon Sep 17 00:00:00 2001 From: multipleof4 Date: Sat, 27 Sep 2025 18:02:26 -0700 Subject: [PATCH] Fix: Require UID, remove anon fallback --- index.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index 79582d5..d5d8d55 100644 --- a/index.js +++ b/index.js @@ -33,8 +33,9 @@ export default { const isWs = req.headers.get('Upgrade') === 'websocket'; if (!isGet && !isWs) return withCORS(new Response('method not allowed', { status: 405 })); - const rawUid = url.searchParams.get('uid') || 'anon'; - const uid = String(rawUid).slice(0, 64).replace(/[^a-zA-Z0-9_-]/g, '') || 'anon'; + const uid = (url.searchParams.get('uid') || '').slice(0, 64).replace(/[^a-zA-Z0-9_-]/g, ''); + if (!uid) return withCORS(new Response('uid is required', { status: 400 })); + const id = env.MY_DURABLE_OBJECT.idFromName(uid); const stub = env.MY_DURABLE_OBJECT.get(id);