← Writing5 min read

SYMPTOM

A user may be able to join another company's workspace

Can a user join another company's workspace in your Supabase app?

A user owning their membership row does not prove they may join that company. Questions and staging checks for a Supabase B2B app before inviting customers.

The membership row is part of the permission boundary

Your app may correctly show Company A's projects only to Company A's members. That still leaves another question: who is allowed to become a member?

If someone can add themselves to a different company's membership table, the project policies may treat that new membership as legitimate. The screens can look normal while the joining rule is wrong.

This is a pattern to inspect, not a claim that your app is vulnerable.

“You can only add yourself” is not the whole rule

Consider this illustrative INSERT policy on an org_members table:

with check (user_id = auth.uid())

That expression checks whether the new row names the signed-in user. It does not check whether that user was invited to the organization named by org_id.

Whether a request can actually create that row also depends on table grants, RLS being enabled, other applicable policies, constraints, triggers, and any server checks. Do not diagnose a real app from this snippet alone.[1][2]

The business question is: what authorizes this person to join this company?

For an invitation-only product, the answer might involve an invitation issued by someone allowed to invite, matched to the intended recipient and organization, with its expiry and acceptance state checked. The invitation must also constrain the role being assigned. Letting the browser submit role = 'owner' is not authorization to become an owner.

Some products intentionally allow self-service or open enrollment. Define that rule explicitly rather than treating every self-join as a defect.

Ask your developer these questions

  • Can a signed-in non-member create a membership for an invitation-only organization by submitting its ID?
  • Can a member change the organization or privilege level on an existing membership?
  • Who may send invitations, accept them, change roles, remove members, or transfer ownership?
  • Does a backend endpoint repeat those checks when it uses an administrative database client?
  • What should happen to access after an invitation is cancelled or a membership is revoked?

An administrative endpoint needs particular attention. A server-side database client may operate outside the user's RLS boundary, so the endpoint must enforce the intended authorization itself.

Check behavior with dummy organizations in staging

Agree on the rules and get permission before testing. Use accounts and records you control in a staging environment; do not try to join someone else's workspace.

For an invitation-only product, write down expected results for these cases:

  1. A non-member tries to add themselves to another test organization without an invitation. The membership should not be created.
  2. An ordinary member tries to change their membership to a different organization or promote themselves to owner. The protected fields should not change.
  3. The intended recipient accepts a valid invitation. The expected organization and permitted role should be created.
  4. An expired, cancelled, or already-used invitation is submitted again. It should follow your documented rule without granting unintended access or creating duplicate membership.

Use the actual user-facing API or backend flow, not an administrator session in the SQL editor. Verify both allowed and denied actions.

Record the identity, request, expected result, actual result, and the membership state afterward. A denied update can match zero rows without raising an error. “No exception” does not prove the update worked, and an empty response does not by itself prove the record stayed unchanged. Check the resulting state through an authorized test account.[2]

Avoid a one-line fix promise

There is no universal replacement policy for every invitation model. The right change depends on where invitations are validated, how memberships are stored, who manages roles, and which paths bypass RLS.

Read all applicable policies before adding another. PostgreSQL combines applicable permissive policies with OR, so a new strict-looking policy does not automatically cancel an older permissive one.[1]

Also, a missing WITH CHECK clause alone is not proof of an UPDATE vulnerability. For UPDATE and ALL policies, PostgreSQL uses the USING expression for the new-row check when no separate WITH CHECK is defined. Review what the effective expression allows.[1]

After changes, repeat both the permitted and forbidden cases. A suggested SQL change is not a confirmed fix.

If you want an independent review

You do not need to start by commissioning a rebuild. First define the decision: can you invite the next company, or does membership and role handling need attention first?

The vibeguard DEEP Launch Review includes a two-account access test, a hardening SQL patch, and a findings call for $799, with stated delivery in 48 hours. Discuss the organization and role scenarios you need checked before agreeing on scope. QUICK does not include cross-user access testing. Confirm working access and the delivery schedule before work starts.

Read the fictional FULL-format sample report to see how findings and evidence are explained, then compare review scopes. The sample is not a client engagement and does not imply that every tier includes the same work.

For an inquiry, describe your app, how people join a workspace, and the decision you need to make at help@vibeguard.run. Do not send passwords, keys, or real customer records. If we met on Upwork, keep communication and the contract there.

A bounded review is not a security certification, a penetration test, or a guarantee that the whole app is secure.

Sources

[1] https://www.postgresql.org/docs/current/sql-createpolicy.html

[2] https://supabase.com/docs/guides/database/postgres/row-level-security

[3] https://www.reddit.com/r/SaaS/comments/1xt4c34/multitenant_saas_on_supabase_check_the_insert

More writing

Written by Jaeil Lee — independent reviewer of AI-built apps. About