From c851718782ec8c26d8fd32372ec50a9f7e9efd23 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Wed, 2 Dec 2026 10:39:57 -0700 Subject: Revert "names: /migrate-grant only hands over a name whose coinos.io account has migrated." The legacy `migrated` flag is set on nearly every coinos.io account (295 of a 299-account sample), so the check stopped almost nothing and only made grants depend on a second call to coinos.io. The hole itself is closed in coinos-ui (374afce1: the name comes from the session, not the form). A real second check would have the grant carry the old account's session for the registrar to verify against coinos.io/api/me. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01VMan6WoqaQDYdpWkatPCar --- names/migrate-check.js | 19 ------------------- 1 file changed, 19 deletions(-) delete mode 100644 names/migrate-check.js (limited to 'names/migrate-check.js') diff --git a/names/migrate-check.js b/names/migrate-check.js deleted file mode 100644 index d0248a6..0000000 --- a/names/migrate-check.js +++ /dev/null @@ -1,19 +0,0 @@ -// /migrate-grant's second check. The bearer token proves the caller is -// coinos.io, not that the name's own account asked, so the old account must -// already be flagged migrated (its own session flags itself just before the -// grant). A bug upstream then can't hand someone else's name to a stranger. -// Returns null when the grant may go ahead, else [status, error]. -export async function migrateGrantRefusal(name, fetchFn = fetch) { - let u; - try { - const r = await fetchFn(`https://coinos.io/api/users/${encodeURIComponent(name)}`, { signal: AbortSignal.timeout(8000) }); - if (r.status === 404) return [404, 'no such coinos.io account']; - if (r.status !== 200) throw new Error(`coinos.io said ${r.status}`); - u = await r.json(); - } catch { - return [502, "couldn't check the coinos.io account, try again"]; - } - if (!u || String(u.username || '').toLowerCase() !== String(name).toLowerCase()) return [404, 'no such coinos.io account']; - if (u.migrated !== true) return [409, 'that coinos.io account has not migrated']; - return null; -} -- cgit v1.2.3