Repository navigation
Open
Description
Problem
Per-project isolation is the product's core promise — every client, brand or app in its own sending identity with no data bleed. Today that promise is upheld by discipline: every query scopes by project_id, and every handler resolves the project from the session or the API key. Nothing proves it, and nothing catches a regression when a new endpoint forgets the scope.
Proposal
A dedicated test suite that tries to cross project boundaries through every surface and asserts it cannot:
- Fixture: two workspaces, two projects each, users with every role, one API key per project, a full set of resources (subscribers, templates, segments, campaigns, webhooks, suppressions, logs, API keys) in each.
- For every project-scoped endpoint: call it with project A's credentials against project B's resource ids, and assert
403/404and that nothing in B changed. Cover list endpoints (no rows from B), detail endpoints (not found), mutations (rejected), and the public surfaces (unsubscribe, tracking, bounce ingest) with B's tokens. - Cross-workspace variants for workspace-level endpoints and for Team roles (
viewercannot write,developercannot manage members, etc.). - Generate the endpoint list from the router at test time so a new route without a test fails the suite, instead of relying on someone remembering to add one.
- Run against a real Postgres in CI (testcontainers or a service container) — these are integration tests by nature.
Acceptance
- Test harness with the two-workspace fixture and helpers for "as project A" / "as project B"
- Coverage of every project-scoped route, including public token-based endpoints, with the route list derived from the router
- Role matrix tests for Team capabilities
- CI job running the suite against Postgres on every PR
- A short docs note under security explaining that isolation is continuously tested
Activity