Permit.io
Use Permit.io for managed MainSDK access with roles, attributes and relations - setup, main.yaml, testing and swapping.
Permit.io is a hosted permissions service with a dashboard where non-developers can manage roles and rules. Behind access, your app keeps one way to check permissions while policies are managed in Permit.io. Pick it when product or support teams need to change who can do what without a code change.
Interfaces it serves
Pick Permit.io in main.yaml for any of these. Your calls stay the same, and you can swap later.
accessBuilding for 0.3Driver permit Permit.io
access:
driver: permitSwap to another provider
Before you start
- Create a Permit.io account and project, with an environment per stage of your app.
- Copy the environment's API key into your secrets manager.
- Set up the decision point Permit.io's docs recommend for your deployment, reachable from your app.
Configure
access:
driver: permit
models: [rbac, abac, rebac] # mainsdk check compares this with the driver's capability profile
unreachable: { deny: true, cache: 30s }
# [to be decided] connection keys; suggested secret: PERMIT_API_KEYUse it
import { access } from "mainsdk";
export const canInvite = (user: { id: string }, org: { type: string; id: string }) =>
access.can(user, "members.invite", org);Local development and testing
Build on in-process Cedar with mainsdk dev. createTestApp() from @mainsdk/testing puts access on its fake, and chaos.on("access", { outage: true }) shows checks denying with MAIN-ACCESS-0007.
What MainSDK adds on top
- Deny by default, with no bypass path.
- Denies when Permit.io is unreachable, with only a short cache you set.
- Lists filtered at the database, not after fetching rows.
- Every decision written to the audit log with the policy version.
See Permissions.
Limits and notes
- The
accessspec lists Permit.io as a driver that comes later in phases 1-2 through the driver kit, beyond its capability profile. - Which models the driver supports is declared in its capability profile;
mainsdk checknames any gap withMAIN-ACCESS-0004. access.raw()returns the Permit.io client;mainsdk checklists every use.
Swap to or from it
access:
driver: cedar # was permitFAQ
Who can change permissions? Whoever has access to your Permit.io project. Every decision is still audited with its policy version in your app.
Next
Was this page helpful?