Skip to content

Identity linking: isolate organization authorization to the authenticated credential #6827

Closed

Description

@bokelley

Split from #3590 after security, product, and data-model review of the person-identity contract.

Problem

Authentication currently resolves a linked non-primary WorkOS credential through the identity's primary WorkOS user. Organization membership and capability reads can therefore use the canonical user rather than the credential that actually authenticated. The existing merge path also rewrites and deduplicates organization-membership rows onto that canonical user.

That can turn identity linkage into an unintended union of organization access. Unlinking later creates an empty singleton identity and does not restore the original membership provenance.

Required behavior

  • Resolve organization authorization from (authenticated credential, explicitly selected organization).
  • Require an active, unrevoked organization membership or credential-use grant for that exact authenticated credential and organization.
  • Treat identity_id, the primary credential, other linked credentials, affiliations, and personal subscriptions as non-inputs to organization authorization.
  • Return 403 for an unauthorized selected organization; never fall back to a primary, first, or arbitrary organization.
  • Keep membership IDs, roles, seats, grantors, effective dates, and provider membership provenance unchanged during identity attachment, merge, promotion, unlink, or split.
  • Recheck the same resolved organization context in queries and mutation tools.
  • Bump a persisted authorization/session epoch transactionally when identity bindings change; cache eviction alone is not the revocation mechanism.
  • Separate credential binding from state consolidation. Disable destructive consolidate/promote/automatic-alias paths, or keep them legacy operator-only, until they preserve authority and provenance.
  • Roll back upstream WorkOS membership changes if local identity mutation fails.

Acceptance criteria

  • Signing in with linked credential A cannot reach an organization granted only to credential B.
  • An explicit organization-approved grant can authorize credential A without copying or rewriting B's membership.
  • No-organization and unauthorized-organization requests fail closed and never choose an implicit organization.
  • Link, attach, primary promotion, unlink, and split leave organization membership rows and provenance unchanged.
  • Stale sessions/context caches lose pre-change authority through a persisted epoch check.
  • Partial-failure tests prove upstream WorkOS changes are compensated.
  • Cross-organization abuse, concurrent binding changes, replay, and stale-cache tests pass.

Dependencies

This must land before #6817 exposes self-service recovery credentials or any identity-owned read model assumes linked credentials are authorization-safe.

Activity

  1. added
    claude-triagingTriage routine is actively working on this issue (1-3 min)
    on Aug 24, 2026
  2. bokelley commented on Aug 24, 2026

    @bokelley
    ContributorAuthor

    Triage

    Status: ready-for-human
    Class: Normative — reverses a shipped precedent; requires a decision memo and WG ratification
    Milestone: Evergreen

    Two independent security advisors reviewed the threat model and acceptance criteria for this issue. Both confirm:

    1. The gap is real. The authentication architecture currently allows a linked non-primary credential, in certain conditions, to resolve organization authorization through the identity's primary credential rather than its own direct membership. This is precisely the scenario described: identity linkage can produce an unintended union of organization access. The threat model is not speculative.

    2. The proposed invariant is sound. Scoping organization authorization strictly to (authenticated credential, explicitly selected organization) is the right fix. The necessary preservation primitive is already present on the request object — the enforcement layer just does not use it consistently across all resolution paths today.

    3. The acceptance criteria are directionally correct but need elaboration before this is implementer-ready:

    • The session layer needs a typed context shape that carries the authenticated credential identity separately from the canonical person identity, so downstream authorization uses the right one without per-call threading.
    • Audit-log actor definition should require that every write records both the authenticated credential AND the resolved identity_id at time of action — not either-or.
    • "Credential-use grant" appears in the ACs without definition. Either link it to an existing mechanism (e.g., the invite-token path in account-linking) or open a separate issue to define the schema.
    • "No implicit org" must explicitly cover the sealed-session fallback path, not only the JWT and API-key auth shapes.
    • MemberContext re-authorization against a persisted epoch needs a per-turn check, not just an invalidation on known mutation events — in-memory cache eviction alone is not a revocation mechanism for long-lived connections (WebSocket, Slack bolt, MCP sessions).
    • The "roll back upstream WorkOS membership changes if local identity mutation fails" clause implies a two-phase commitment pattern that the current webhook and identity-mutation paths do not implement. Spell out the ordering and compensation rule before handing to an implementer.

    4. Ordering: this must land with or before #6490 (which states the invariant that #6827 enforces at the server) and before #6817 (self-service recovery via linked credentials is only safe once org authorization is scoped to the recovering credential).

    Governance: Normative. The proposal narrows behavior established by a prior shipped decision on identity linkage. A Normative-class decision memo per governance/decisions/README.md is the right vehicle. @bokelley — because this narrows a decision of record, ratification from you is recommended over standard Secretariat routing.

    My take: Real gap, right invariant, enforcement primitive already exists on the request — the authorization layer just doesn't consistently use it; write the decision memo against the prior shipped decision, ship with #6490, land before #6817.


    Generated by Claude Code

  3. added
    enhancementNew feature or request
    claude-triagedIssue has been triaged by the Claude Code triage routine. Remove to re-triage.
    needs-wg-reviewBlocked on a working-group decision — surface in WG meeting agendas
    governanceIssue concerns the governance protocol domain
    bugSomething isn't working
    priority:P0Immediate priority: user/revenue/security/reliability bug to work now
    and removed
    claude-triagingTriage routine is actively working on this issue (1-3 min)
    needs-wg-reviewBlocked on a working-group decision — surface in WG meeting agendas
    governanceIssue concerns the governance protocol domain
    on Aug 24, 2026
  4. bokelley commented on Aug 25, 2026

    @bokelley
    ContributorAuthor

    Reclassifying this as an application authorization/security bug rather than a protocol change.

    The required invariant is already the expected security boundary: organization access is authorized from the exact authenticated credential plus an explicitly selected organization. The change does not alter AdCP schemas, wire behavior, or implementer obligations; it corrects how this server applies authentication and organization membership internally.

    Rollout is deliberately staged to minimize compatibility risk:

    1. Observe current decisions without changing responses.
    2. Ship enforcement code behind both a deployment-time ceiling and an audited runtime kill switch, default off.
    3. Hold a 24-hour clean observation window while monitoring production health, authorization telemetry, and support channels.
    4. Enable one read-only boundary first, with rollback available within the runtime cache interval.
    5. Expand only after the canary remains clean; fix or roll back on any access regression.

    The identity-model dependencies remain useful context, but they do not require working-group ratification for this application-layer authorization repair.

  5. added this to the P0 Bugs milestone on Sep 21, 2026
  6. bokelley commented on Sep 21, 2026

    @bokelley
    ContributorAuthor

    Triage execution update: routed to P0 Bugs. Keep this as the exact-credential authorization security umbrella. The immediate sequencing gate is #7514; after that lands, refresh and human-review the staged containment PRs against current main before enabling any rollout.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingclaude-triagedIssue has been triaged by the Claude Code triage routine. Remove to re-triage.enhancementNew feature or requestpriority:P0Immediate priority: user/revenue/security/reliability bug to work now

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions