fix(connectors): stop granting act-as-artist authority off the flat account_artist_ids roster edge (P0b)
Merged
SW
3mo ago+239+239+012345678901234567890123456789-47-47-01234567890123456789
Summary
P0b interim cut per the decision callout in https://github.com/recoupable/chat/issues/1860 (sweetman, 2026-07-08): connector paths no longer treat a bare account_artist_ids roster row as act-as-artist authority. Two accounts that both roster canonical artist A can no longer use each other's OAuth connectors for A.
What changed
- New
lib/composio/checkConnectorAuthority.ts— connector-scoped authority check. Grants on: self, RECOUP_ORG staff (admin bypass, kept), org co-membership with the target artist, workspace ownership, or membership in a target organization. It never reads theaccount_artist_idsroster edge. Fails closed on DB errors. - Narrowed call sites to the new check (was
checkAccountAccess/checkAccountArtistAccess):lib/composio/toolRouter/getComposioTools.ts(artist tool branch)lib/composio/connectors/validateAuthorizeConnectorRequest.tslib/composio/connectors/validateExecuteConnectorActionRequest.ts(theaccount_idoverride on POST /api/connectors/actions)lib/composio/connectors/validateDisconnectConnectorRequest.ts
- Unchanged by design (scope constraint from the issue):
checkAccountArtistAccessstill honors the roster edge — read/analytics paths (posts, fans, socials, artist update/delete, YouTube revenue MCP tool) keep working. Connector read paths (GET /api/connectors,GET /api/connectors/actionslisting) also keep the flat check per the issue's authorize/execute/disconnect scope.
Verification
- TDD: new + updated tests written first and confirmed RED (module missing / old mocks), then implemented to GREEN.
pnpm exec vitest run lib/composio lib/artists: 51 files, 272 tests, all passing (includes 8 new tests inlib/composio/__tests__/checkConnectorAuthority.test.tscovering self, roster-only denial, org co-membership, RECOUP_ORG bypass, workspace, org target, and both fail-closed paths).pnpm exec tsc --noEmit: 200 pre-existing errors on this branch and onmainbaseline (all in unrelated__tests__files); zero errors introduced by this change.
Preview verification pending — tracked in chat#1860.
🤖 Generated with Claude Code
Summary by cubic
Connector actions and artist tool exposure no longer treat a bare account_artist_ids roster row as act-as-artist authority. Managers who only share a rostered artist can’t use each other’s OAuth connectors for that artist.
- Bug Fixes
- Added
lib/composio/checkConnectorAuthority.tsto enforce connector authority; fails closed on DB errors. - Authority grants only for: self,
RECOUP_ORGstaff, shared org with the target artist, caller’s workspace, or caller’s organization. - Updated call sites to use the new check:
validateAuthorizeConnectorRequest,validateExecuteConnectorActionRequest,validateDisconnectConnectorRequest, andgetComposioTools(artist branch). - Kept
checkAccountArtistAccessfor read/analytics and connector listings; roster-based access still applies there.
- Added