Multi-tenant applications
Isolate your own customers' data inside one ReQlo environment and prevent cross-account access.
If your product serves many customer organizations, ReQlo's organization is you; your customers are tenants inside your environment. Keep them apart in policy, not by convention.
Carry the tenant on every request
Send your tenant ID as a server-provenance attribute on both the subject's context and the resource:
await reqlo.enforce({
agent: { id: "agt_assistant" },
subject: { id: session.userId, kind: "user" },
action: "invoices.read",
resource: { type: "invoice", id: inv.id, attributes: { tenant_id: inv.tenantId } },
context: { subject_tenant_id: session.tenantId },
});Deny cross-tenant access globally
- id: deny-cross-tenant
effect: deny
actions: ["*"]
condition: >
!has(resource.attributes.tenant_id) || !has(context.subject_tenant_id)
|| resource.attributes.tenant_id != context.subject_tenant_idBecause deny always wins, no later allow rule can accidentally open a cross-tenant path.
Prevent IDOR
Insecure direct object references happen when an ID from the model or user is used without checking ownership. Always load the resource by ID and read its tenant from your database; never trust a tenant ID that arrived with the request.
Separate ReQlo projects?
Use separate projects only when tenants need separate policies or keys (for example, enterprise customers who require it). For most SaaS products, one environment with tenant attributes is simpler and safer.
Something wrong or unclear? Report an issue with this page.