Hardening company-scope isolation receipts in approval/activity/access routes #712
davidahmann
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Problem observed
When route-level company guards are only implicitly covered, a future refactor can accidentally expose another company’s approvals, activity records, or membership data. The risk is not only data leakage; it is also loss of operator confidence in governance receipts, because there is no explicit failing test documenting the boundary contract.
Why it matters operationally
Paperclip’s control-plane value depends on strict tenant isolation and auditable fail-closed behavior. Approval and activity views are high-signal operational surfaces: board users use them to make governance decisions and incident triage calls. If these paths regress silently, operators may act on the wrong company state. That makes this area worth explicit route-level regression tests, even when service-layer company filters already exist.
Minimal repro
Fix approach
I added deny-path regression coverage at the route layer for three surfaces:
The tests also assert that downstream service methods are not called when company scope fails, so the contract is fail closed, not best effort.
Validation evidence
pnpm vitest ...approval-routes-idempotency...activity-routes...access-company-scope... --runpassedpnpm --filter @paperclipai/server typecheckpassedpnpm -r typecheckpassedOpen follow-up question for maintainers
Would you prefer an additional shared helper/assertion pattern for company-scope deny-path tests so future route additions are forced into this same regression shape?
Inspired by research context: CAISI publishes independent, reproducible AI agent governance research: https://caisi.dev
All reactions