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

The foundry nav door trusts an owner by id from configuration, not by the name 'trevato' #14927

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

The Foundry nav door no longer opens for an account just because it is named trevato. Before this change, anyone who signed up as trevato on a forge where no admin holds that name could make the link point at their own app.

Notes

shipped production is serving it deploy 9504585

opened this

The Foundry nav door no longer opens for an account just because it is named trevato. Before this change, anyone who signed up as trevato on a forge where no admin holds that name could make the link point at their own app. Now the door only opens for an app owned by a site admin, or by an org with a site admin on its Owners team.

What changed

  • src/actions/foundry_door.ts: removed FOUNDRY_ORG and the name check. A new trustedOwner(db, ownerId) does the owner check: an admin who is a person, or an org whose active owners include an admin. Agents, suspended accounts and removed accounts don't count. The read access and app access checks after it are unchanged.
  • test/api-forge-view.test.ts: a new test with two cases.
    • An org named trevato whose owners include no admin opens no door.
    • A non-admin person named trevato opens no door.

    This test fails with main's version of the door and passes with this change. I reworded the titles of the two existing Foundry tests to match. One of those tests already gives the trevato org an admin owner, so it still covers this forge's own door opening.

Left out The issue also allows "one id pinned in configuration". I didn't add it, because it would mean a new config setting wired through src/engine/crossing.ts and boot, and the admin and admin-owned-org rule covers this forge.

Look at The door now depends on production's trevato org having a site admin on its Owners team. I couldn't confirm that from here: the API answered not_found for /api/v1/users/trevato and has no org-members route. If the org has no admin owner, the door closes after this merges. The fix is to add the admin to that team, or to add the pinned-id setting.

Checks run bun scripts/gate.ts --fix and bun x tsc --noEmit are clean. scripts/fast.ts couldn't narrow the tests, because the door is imported by the layout and it named 2,248 files. So I ran the five test files that mention Foundry: api-forge-view, app-turn, flow-cache, follow-sources and palette-roster. All 78 tests pass.

How to try it

  1. As an admin, put the app with slug foundry on a repo owned by a non-admin account named trevato.
  2. Open /: there is no Foundry button and no palette row.
  3. Move the app to an admin's repo, or to an org an admin owns, and the button appears within five seconds.

🤖 Generated with Claude Code

Closes #14911

commented

The Foundry nav door no longer opens for an account just because it is named trevato. Before this change, anyone who signed up as trevato on a forge where no admin holds that name could make the link point at their own app. Now the door only opens for an app owned by a site admin, or by an org with a site admin on its Owners team.

What changed

  • src/actions/foundry_door.ts: removed FOUNDRY_ORG and the name check. A new trustedOwner(db, ownerId) does the owner check: an admin who is a person, or an org whose active owners include an admin. Agents, suspended accounts and removed accounts don't count. The read access and app access checks after it are unchanged.
  • test/api-forge-view.test.ts: a new test with two cases.
    • An org named trevato whose owners include no admin opens no door.
    • A non-admin person named trevato opens no door.

    This test fails with main's version of the door and passes with this change. I reworded the titles of the two existing Foundry tests to match. One of those tests already gives the trevato org an admin owner, so it still covers this forge's own door opening.

Left out The issue also allows "one id pinned in configuration". I didn't add it, because it would mean a new config setting wired through src/engine/crossing.ts and boot, and the admin and admin-owned-org rule covers this forge.

Look at The door now depends on production's trevato org having a site admin on its Owners team. I couldn't confirm that from here: the API answered not_found for /api/v1/users/trevato and has no org-members route. If the org has no admin owner, the door closes after this merges. The fix is to add the admin to that team, or to add the pinned-id setting.

Checks run bun scripts/gate.ts --fix and bun x tsc --noEmit are clean. scripts/fast.ts couldn't narrow the tests, because the door is imported by the layout and it named 2,248 files. So I ran the five test files that mention Foundry: api-forge-view, app-turn, flow-cache, follow-sources and palette-roster. All 78 tests pass.

How to try it

  1. As an admin, put the app with slug foundry on a repo owned by a non-admin account named trevato.
  2. Open /: there is no Foundry button and no palette row.
  3. Move the app to an admin's repo, or to an org an admin owns, and the button appears within five seconds.

🤖 Generated with Claude Code

commented

The Foundry nav door no longer opens for an account just because it is named trevato. Before this change, anyone who signed up as trevato on a forge where no admin holds that name could make the link point at their own app. Now the door only opens for an app owned by a site admin, or by an org with a site admin on its Owners team.

What changed

  • src/actions/foundry_door.ts: removed FOUNDRY_ORG and the name check. A new trustedOwner(db, ownerId) does the owner check: an admin who is a person, or an org whose active owners include an admin. Agents, suspended accounts and removed accounts don't count. The read access and app access checks after it are unchanged.
  • test/api-forge-view.test.ts: a new test with two cases.
    • An org named trevato whose owners include no admin opens no door.
    • A non-admin person named trevato opens no door.

    This test fails with main's version of the door and passes with this change. It checks that an admin exists rather than casting with as never, which was what the gate refused on the first push. I reworded the titles of the two existing Foundry tests to match. One of those tests already gives the trevato org an admin owner, so it still covers this forge's own door opening.

  • No terminal change: the terminal screen (src/tui/screens/forgeview.ts) already gets the door through foundryHref. A commit message carries the "No door" line the gate asks for.

Left out The issue also allows "one id pinned in configuration". I didn't add it, because it would mean a new config setting wired through src/engine/crossing.ts and boot, and the admin and admin-owned-org rule covers this forge.

Look at The door now depends on production's trevato org having a site admin on its Owners team. I couldn't confirm that from here: the API answered not_found for /api/v1/users/trevato and has no org-members route. If the org has no admin owner, the door closes after this merges. The fix is to add the admin to that team, or to add the pinned-id setting.

Checks run bun scripts/gate.ts and bun x tsc --noEmit pass. scripts/fast.ts couldn't narrow the tests, because the door is imported by the layout and it named 2,248 files. So I picked the tests that mention Foundry:

  • Before the first push, all five passed: api-forge-view, app-turn, flow-cache, follow-sources and palette-roster (78 tests).
  • After this fix, which only touched api-forge-view, I reran that one file: 8 of 8 pass.

How to try it

  1. As an admin, put the app with slug foundry on a repo owned by a non-admin account named trevato.
  2. Open /: there is no Foundry button and no palette row.
  3. Move the app to an admin's repo, or to an org an admin owns, and the button appears within five seconds.

🤖 Generated with Claude Code

Approved

Clean, small, single-purpose. The name check is gone; trust now comes from an admin person owner or an org with an admin owner, and the terminal reaches the door through foundryHref so both doors match. The new test would fail on main. Operational note: production door depends on the trevato org having an admin owner; confirm after merge.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs