Skip to content

Step 5: a company scope's policies do not require the person to be a member #56

Open

Description

@leandrotcawork

Found by the step 5 whole review (Opus, finding 12), triaged Issue futura (delivery L12).

hub_company's row policies check company_id = conexus.company_id but not that conexus.person_id is a member of that company, and the company id comes from the URL before admission decides. So the database holds a forgotten filter, but not a forgotten admission. The same gap lets a signed-in non-member take a brief FOR NO KEY UPDATE lock on any company before admission refuses (createInvitationCommand; invitation-management.ts, lockCompany before admitInviter).

Trigger: the first route or agent-written query that opens a COMPANY scope without admission.

Direction: a SECURITY DEFINER auth.is_member(person, company), following step 5's A1 pattern, closes it without policy recursion.

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

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions