Public: anyone can read this; the crew can change it.

open-platform.sh sign-in is a linked method, not a back door: it never creates an account outside the signup rules #2581

Parked opened this in answer to
Closed without merging

The open-platform.sh (edge) sign-in is now a method a person links to an account they already have. An unlinked edge login is nobody and creates nothing. I did not finish a full bun test run (it ran past what I could wait for).

Notes

stopped parked by the crew deploy 72e8796

opened this

The open-platform.sh (edge) sign-in is now a method a person links to an account they already have. An unlinked edge login is nobody and creates nothing. I did not finish a full bun test run (it ran past what I could wait for). I ran tsc and the suites covering this change, and all pass; the forge's check runs the rest on this push.

What changed

  • Auth: the edge's login reaches an account only through a new linked_login table (core/linked_login.ts). ensureEdgeUser and the edge account origin are gone, so the edge can't create an account. It also no longer matches an account by username, so a platform name can't take over a forge account of the same name.
  • Where an unlinked person goes: they see the forge's own /signin and /signup, with a note to link the platform in Settings afterwards. The existing signup mode, human check, email verification, quotas and zero budget apply there unchanged.
  • Link and unlink: Settings → Linked sign-in (/settings/linked, web/pages/linked.ts) takes a signed-in browser that the edge also vouches for on the same request. These POSTs are same-origin checked.
    • A login can belong to one account only.
    • Unlinking is refused when it would be the account's only way in (no password and no passkey).
  • Existing edge accounts: a migration links every account the edge made before this (found from its user.created event with via: edge) to the login it was made for. The owner's Accounts list now shows linked: open-platform.sh on each.
  • Turning it off: FORGE_LINKED_METHODS (unset means all on, none means off) drops the edge token at boot, so the headers are ignored and no edge UI is shown. The README says so. The forge works with it off, and a test covers that.
  • Tests: test/linked-signin.test.ts covers
    • an unknown edge sign-in creating nothing;
    • the same sign-in refused while signup is closed;
    • link, then sign in reaching the same account;
    • a cross-site link attempt;
    • a login already linked elsewhere;
    • unlink;
    • the last-way-in guard;
    • the backfill and listing;
    • the edge turned off.
  • Tests I changed or removed: the tests that asserted the edge makes an account on sight were wrong under the new rule. I removed or rewrote them in signup, signup-closed, no-signup-admin, reserved-names, verify-email, accounts and edge-auth.

Left out

  • Linking through the full authorization server, which follows #666.
  • An audit event for link and unlink.
  • A per-method setting. There is one method today, so FORGE_LINKED_METHODS is a list of one.
  • Existing edge accounts with no password and no passkey can't unlink. That is deliberate.

Try it Set FORGE_EDGE_TOKEN, sign in with a password or passkey, and open /settings/linked while the edge is vouching for you. Then bun test test/linked-signin.test.ts test/edge-auth.test.ts.

🤖 Generated with Claude Code

Closes #668

2 earlier comments
commented

The open-platform.sh (edge) sign-in is now a method a person links to an account they already have. An unlinked edge login is nobody and creates nothing. I did not finish a full bun test run (it ran past what I could wait for). I ran tsc and the suites covering this change, and all pass; the forge's check runs the rest on this push.

What changed

  • Auth: the edge's login reaches an account only through a new linked_login table (core/linked_login.ts). ensureEdgeUser and the edge account origin are gone, so the edge can't create an account. It also no longer matches an account by username, so a platform name can't take over a forge account of the same name.
  • Where an unlinked person goes: they see the forge's own /signin and /signup, with a note to link the platform in Settings afterwards. The existing signup mode, human check, email verification, quotas and zero budget apply there unchanged.
  • Link and unlink: Settings → Linked sign-in (/settings/linked, web/pages/linked.ts) takes a signed-in browser that the edge also vouches for on the same request. These POSTs are same-origin checked.
    • A login can belong to one account only.
    • Unlinking is refused when it would be the account's only way in (no password and no passkey).
  • Existing edge accounts: a migration links every account the edge made before this (found from its user.created event with via: edge) to the login it was made for. The owner's Accounts list now shows linked: open-platform.sh on each.
  • Turning it off: FORGE_LINKED_METHODS (unset means all on, none means off) drops the edge token at boot, so the headers are ignored and no edge UI is shown. The README says so. The forge works with it off, and a test covers that.
  • Tests: test/linked-signin.test.ts covers
    • an unknown edge sign-in creating nothing;
    • the same sign-in refused while signup is closed;
    • link, then sign in reaching the same account;
    • a cross-site link attempt;
    • a login already linked elsewhere;
    • unlink;
    • the last-way-in guard;
    • the backfill and listing;
    • the edge turned off.
  • Tests I changed or removed: the tests that asserted the edge makes an account on sight were wrong under the new rule. I removed or rewrote them in signup, signup-closed, no-signup-admin, reserved-names, verify-email, accounts and edge-auth.

Left out

  • Linking through the full authorization server, which follows #666.
  • An audit event for link and unlink.
  • A per-method setting. There is one method today, so FORGE_LINKED_METHODS is a list of one.
  • Existing edge accounts with no password and no passkey can't unlink. That is deliberate.

Try it Set FORGE_EDGE_TOKEN, sign in with a password or passkey, and open /settings/linked while the edge is vouching for you. Then bun test test/linked-signin.test.ts test/edge-auth.test.ts.

🤖 Generated with Claude Code

commented

I merged main into the branch and pushed it. The merge had one conflict, in src/web/chrome.ts, and it was only the imports. I kept both sides: main's audienceFacts/audienceOf import and this branch's edgeDoor.

tsc is clean. The suites that cover this change pass: linked-signin, edge-auth, signup-closed and accounts. I did not run the full suite, so the forge's check on this push is the full run.

The pull is otherwise unchanged:

  • Edge sign-in: it reaches only an account a person has linked, and it never creates one.
  • Linking: people link and unlink at Settings → Linked sign-in.
  • Existing edge accounts: a migration links them, so they keep working.
  • Turning it off: FORGE_LINKED_METHODS=none turns the edge method off.
commented

Parked by the crew: the check stayed red through 2 automatic tries

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs