Scriptum Auth And Access
Last validated: 2026-05-11
This document describes how tenant identity and access control are enforced in current Scriptum runtime.
Identity Inputs Required By API
scriptum-api derives tenant context from gRPC metadata headers:
x-organization-idx-organization-name
If either is missing, API returns Unauthenticated for most business RPCs.
Bearer Token Handling
cli-scriptum attaches:
authorization: Bearer <token>x-organization-idandx-organization-namewhen configured
Important runtime note:
- In this codebase, tenant extraction is done from metadata headers.
- Token validation/authorization policy is expected to be enforced by platform/gateway layers and optional IAM integration, not by deep token parsing inside Scriptum handlers.
Tenant Isolation Model
All script and thread data is scoped under tenant storage prefix:
tenants/{org_id}/...
Thread index entries are also org-scoped in NATS KV keyspace:
{org_id}.{script_name}.{thread_id}
This keeps script/thread metadata isolated by org ID.
IAM Resource Registration
Scriptum supports optional IAM registration for script resources.
What gets registered
- Resource kind: script
- DRN shape:
drn:dodil:scriptum:{org_id}:{script_name} - Scopes include script CRUD/versioning/thread-related scope names
When registration happens
- On
CreateScript, Scriptum registers IAM resource. - On
DeleteScript, Scriptum deregisters IAM resource.
Failure behavior
CreateScriptis effectively transactional with IAM: if IAM registration fails, registry create is rolled back.DeleteScriptmay return error if IAM deregistration fails after registry delete.
IAM Startup Behavior
Code defaults in ServerConfig:
SCRIPTUM_IAM__ENABLED=trueSCRIPTUM_IAM__FAIL_ON_INIT_ERROR=true
Operational drift to know:
.env.examplestill documents false/false style defaults.- If operators rely only on
.env.examplecomments, behavior may be surprising.
gRPC mTLS
- Controlled by
SCRIPTUM_GRPC__ENABLE_MTLS. - In
SCRIPTUM_ENVIRONMENT=production, mTLS must be enabled or API startup fails. - Certs are loaded from Vault env settings when enabled.
Service Discovery Dependency
- IAM manager resolves IAM endpoint via service discovery manager.
- If IAM is enabled but service discovery is disabled/unavailable, behavior depends on
SCRIPTUM_IAM__FAIL_ON_INIT_ERROR.
Environment Variable Access Surfaces
Tenant env APIs
SetEnvVar,GetEnvVar,ListEnvVars,DeleteEnvVar,ImportEnvVars
Script overlay env APIs
GetScriptEnv,UpdateScriptEnv
Effective env merge semantics
- Base: tenant env
- Overlay: script env
- Merge rule: non-empty script value overrides; empty script value defers to tenant
Sensitive Data Caveat
ListEnvVars currently returns both keys and values in API responses.
- Proto tool description says values are not returned for security.
- Runtime implementation currently includes values.
- Treat CLI/API output for env listing as sensitive.
Access Control Gaps To Be Aware Of
- Tool registration/get methods are unimplemented server-side.
- Thread cancel is unimplemented.
- Artifact listing is unimplemented.
- Some scope annotations in proto are broader than currently implemented behavior.
Recommended Guardrails
- Enforce bearer validation and org header integrity at ingress/gateway.
- Keep IAM enabled in production and fail fast on IAM init errors.
- Restrict who can call env listing APIs until keys-only behavior is enforced.
- Treat org ID as canonical tenant isolation key in observability and audit records.