diff options
| author | Adam Soltys <[email protected]> | 2026-12-02 10:39:57 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2026-12-02 10:39:57 -0700 |
| commit | c851718782ec8c26d8fd32372ec50a9f7e9efd23 (patch) | |
| tree | 94a027344d44591b5cf2623cff2690dd61dba925 /names/migrate-check.test.js | |
| parent | 957599974b453b9b13653b821658fd0a76d01809 (diff) | |
| download | coinosv3-server-c851718782ec8c26d8fd32372ec50a9f7e9efd23.tar.gz coinosv3-server-c851718782ec8c26d8fd32372ec50a9f7e9efd23.zip | |
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 <[email protected]>
Claude-Session: https://claude.ai/code/session_01VMan6WoqaQDYdpWkatPCar
Diffstat (limited to 'names/migrate-check.test.js')
| -rw-r--r-- | names/migrate-check.test.js | 26 |
1 files changed, 0 insertions, 26 deletions
diff --git a/names/migrate-check.test.js b/names/migrate-check.test.js deleted file mode 100644 index ba90d1d..0000000 --- a/names/migrate-check.test.js +++ /dev/null @@ -1,26 +0,0 @@ -// bun test names/migrate-check.test.js -import { test, expect } from 'bun:test'; -import { migrateGrantRefusal } from './migrate-check.js'; - -const coinos = (users, status) => async (url) => { - const name = decodeURIComponent(url.split('/').pop()); - if (status) return new Response('', { status }); - const u = users[name.toLowerCase()]; - return u ? Response.json(u) : new Response('{}', { status: 404 }); -}; -const users = { alice: { username: 'Alice', migrated: true }, victim: { username: 'victim', migrated: false }, bob: { username: 'bob' } }; - -test('a migrated account may hand its name over', async () => { - expect(await migrateGrantRefusal('alice', coinos(users))).toBeNull(); -}); -test("someone else's name, not flagged migrated, is refused", async () => { - expect((await migrateGrantRefusal('victim', coinos(users)))[0]).toBe(409); - expect((await migrateGrantRefusal('bob', coinos(users)))[0]).toBe(409); -}); -test('a name with no coinos.io account is refused', async () => { - expect((await migrateGrantRefusal('nobody', coinos(users)))[0]).toBe(404); -}); -test("coinos.io down means no grant, and it says to try again", async () => { - expect((await migrateGrantRefusal('alice', coinos(users, 502)))[0]).toBe(502); - expect((await migrateGrantRefusal('alice', async () => { throw new Error('net'); }))[0]).toBe(502); -}); |
