Playground features

Roles, tenants and an audit log

Roles, per-tenant isolation and the audit trail an enterprise buyer asks for, with SAML and OpenID Connect sign-in, sessions, group-to-role mapping, JIT provisioning and SCIM de-provisioning

Decides what each signed-in person is allowed to do, keeps one company’s data apart from another’s, and writes down who changed what. It begins after sign-in. You bring the sign-in itself.

Three walled courtyards side by side with unbroken walls, a differently shaped key hanging on each inner door, and a long stamped ribbon unspooling beneath them

A feature of the Playground

This is a feature of the Vibe Coder Playground. It runs inside the Playground, with its audit record and its caveats beside it.

Download the Playground See pricing

The mistake it removes

Two failures, both silent. A role model with no identity behind it (looks complete, denies nothing), and tenant isolation enforced in application code rather than at the data layer, where one forgotten WHERE clause serves another customer's rows and nothing errors.

What the audit found

Named rather than summarized. The reasoning behind each one ships inside the block, so it travels with the code instead of living on a page you have to trust. A finding marked fixed was fixed after the audit ran; the verdict above is still the one the audit gave.

What you still have to do

The feature cannot own your secrets, your host or your legal obligations. This is the part it deliberately does not claim.

What lands in your project

node

  • node/enterprise-kit.js
  • node/oidc.js
  • node/identity.js
  • node/saml.js
  • node/provisioning.js
  • node/strict-json.js

can()/assertCan() over a ranked role table, withTenant() to scope every query, and auditLog() for the trail SOC 2 asks about. Roles come from the CALLER's identity: the block refuses to guess. node/saml.js: parseIdpMetadata() reads the identity provider's signing certificates, createSamlServiceProvider() sends the AuthnRequest (start) and verifies the POSTed response (finish), and verifySamlResponse() is the check itself. Only saml.js needs packages: `npm i xml-crypto @xmldom/xmldom` (xmldom 0.8.10 or later). node/oidc.js: createOidcClient() runs the OpenID Connect authorization-code sign-in with PKCE, and verifyIdToken() checks the ID token. node/provisioning.js: createProvisioning() maps groups to roles through YOUR table, creates the member on first sign-in, and serves SCIM 2.0 /Users so the identity provider can de-provision. It needs an `audit` recorder (pass auditLog(store)): every new member and every change of role, active or deleted is recorded with the actor, the before and after values and the time BEFORE it is saved, and a recorder that fails refuses the change. Give scim() the body UNPARSED where you can, as request.rawBody (a string or Buffer, e.g. captured by express.json({ verify })) or as a string or Buffer request.body (express.text or express.raw on the SCIM route): it then refuses a body that names a key twice, such as active, with a SCIM 400 invalidSyntax, where a body your framework already parsed has silently kept the last copy. An already parsed object body still works. node/strict-json.js holds that duplicate-key rule, shared by oidc.js and provisioning.js, so ship it with them. node/identity.js: createIdentity() issues and resolves sessions and revokeSubject() ends every session of one person; sessionCookie() and clearSessionCookie() write the cookie, and createCsrf() guards the sign-in POST.

Needs xml-crypto ^6, @xmldom/xmldom ^0.8.10 from npm.

What you supply

Get it

Download the Playground See pricing

A feature of the Vibe Coder Playground.

Questions

Is Roles, tenants and an audit log audited?
Yes. A full due-diligence audit was run on 2026-09-29 and the verdict was a pass.
What do I still have to do myself?
Your identity-provider connection, which the block cannot ship: the metadata, this app's entity id and ACS URL, the group-to-role table, the SCIM token, and the routes that call start() and finish(). Until those are wired, can() and assertCan() rank whatever role the caller passes, which is the exact failure the source codebase discloses about itself: a complete ranked role table that could not deny anything, because nothing bound a request to a non-owner role. Row-level security at the database is the other companion, because withTenant() scopes queries in application code only.
How do I get this?
It is a feature of the Vibe Coder Playground. Download the Playground, and see the pricing page for what each plan includes.

All Playground features · Free code blocks · Learn to build from zero · The coding guide