Skip to content

[finding] sys_user.manager_id now carries two independent organization screens, in two packages, with no shared code #11286

Description

@os-sam

Recorded while implementing #10231. Not fixed there — that card is fenced to plugin-sharing, and collapsing the two would be a cross-package dependency decision rather than a mechanical repair.

What was measured

After #10231 lands, the manager-chain column sys_user.manager_id has two organization screens, implemented separately:

package entry point screen
plugin-approvals ApprovalService.lookupManager managerIsProvablyOutsideOrg (private method)
plugin-sharing TeamGraphService.managerOf, BusinessUnitGraphService.managerOf managerIsProvablyOutsideOrg (module function)

Both landed deliberately and both are correct today — the plugin-sharing one was written to mirror the plugin-approvals one (13f533a43a, #10153) precisely because a screen that differed between them would route an approval one way and share a record the other.

The observation is that nothing enforces that mirroring. They are byte-similar, share no code, and have no cross-referencing test. The two share:

  • the same fail-open posture on an absent tenancy fact (no sys_member rows, or the membership read threw);
  • the same "provably outside" shape, rather than "must prove membership";
  • the same reason for reading sys_member at all — sys_user is the global better-auth identity table and carries no organization_id, so a membership row is the only tenancy fact that exists for a user.

Each of those three is a posture decision that a future edit could change on one side alone, silently.

Why this is a finding and not a patch

The obvious repair — one shared helper — is not obviously right:

A shared conformance fixture is probably the cheapest option that catches divergence without deciding #7497, but that is a judgement call, not a mechanical one.

Related

Filed unassigned, no pm:queue.


Generated by Claude Code

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions