Overview
Jinba Toolbox implements a multi-layered security model centered on organization-based isolation. Every resource — toolsets, tools, versions, runs, API keys, and webhooks — belongs to an organization and is protected by role-based access control (RBAC), authenticated sessions or API keys, and database-level tenant isolation.Authentication
Jinba Toolbox supports two authentication methods, each designed for a different access pattern:Session-Based (Web)
Used by the admin web console. Powered by Better Auth with session cookies.
- Cookie-based session management
- For human users managing toolsets
- Full CRUD access to organization resources
API Key (Programmatic)
Used by the SDK, AI agents, and external integrations. Passed as a Bearer token.
Authorization: Bearer jtb_xxxxxxxxxxxx- For automated and programmatic access
- Scoped to a single organization
API Key Management
API keys are scoped to an organization and track their issuer:- No expiration by default — keys remain valid until manually deleted.
- Last-used timestamp is recorded for each key.
- Issuer tracking — the member who created the key is recorded.
- Audit logging — key creation and deletion events are logged.
API Key Endpoints
Role-Based Access Control (RBAC)
Role Hierarchy
Jinba Toolbox defines roles at two levels:Organization Roles
Permission Matrix
Role Rules
- Each organization has exactly one Owner.
- Ownership can be transferred to another member (the original owner becomes Admin).
- Only Owners and Admins can invite new members.
- Members can manage their own API keys but cannot see or delete keys created by others.
Organization-Based Isolation
Every resource in Jinba Toolbox is scoped to an organization. The isolation is enforced at multiple layers:Application Layer
The API server validates that the authenticated user or API key belongs to the target organization before processing any request. This ensures that even if a database query is somehow misconfigured, the application layer blocks unauthorized access.Database Layer (Row Level Security)
PostgreSQL Row Level Security (RLS) provides an additional layer of tenant isolation at the database level:1
Request arrives
The API server authenticates the request and determines the organization ID.
2
Set session variable
Before executing any queries, the server sets the PostgreSQL session variable:
3
RLS filters rows
PostgreSQL automatically filters all query results to only include rows belonging to the current organization.
tool_settooltool_set_versionrunapikeywebhookaudit_log
Audit Logging
Significant actions within an organization are recorded in an audit log:
Tool executions are tracked separately in the
runs table with full input/output logging.
Audit Log Data Model
Viewing Audit Logs
Audit logs are available to Owner and Admin roles in the web console at/org/:orgId/settings/audit-log. Logs are retained indefinitely.
Sandbox Isolation
Tool execution occurs in isolated sandbox environments (E2B or Daytona). Each execution runs in a fresh or resumed sandbox instance with:- Process isolation — each sandbox is a separate container or VM.
- Network isolation — sandboxes cannot access the API server’s internal network.
- Configurable environment variables — secrets are injected per toolset, not shared across toolsets.
- Automatic cleanup — sandboxes are terminated after execution completes or times out.
Best Practices
- Use separate API keys for different environments (production, staging, CI/CD) to limit blast radius if a key is compromised.
- Audit API key usage — review the last-used timestamp regularly and delete keys that are no longer needed.
- Assign the least-privilege role — use Member for developers who only need to create and edit tools.
- Review audit logs periodically to detect unexpected access patterns.
- Do not share API keys between organizations — each key is scoped to a single organization.
Related
- REST API — Authentication details and endpoint reference
- Webhooks — Event notification security (signature verification)
- Sandbox Providers — Execution environment isolation