Permissions

Tau's permission model is a five-bit capability bitmap applied per database. It governs every statement when --auth is enabled on the server.


The CRUDA bitmap

bitletternamecontrols
4CCreateCREATE LENS, DERIVE LENS, SET TTL LENS, UNSET TTL LENS
3RReadAT, RANGE, REDUCE, SHOW LENSES, HISTORY LENS, AT AS OF, AT LAYER, BACKUP DATABASE
2UUpdate / writeAPPEND, COPY, BATCH APPEND
1DDeleteDROP LENS
0AAdminCREATE DATABASE, DROP DATABASE, CREATE USER, DROP USER, GRANT, REVOKE, SHOW USERS, SHOW GRANTS (others), RESTORE DATABASE

Effective permission = grants[db] | grants["*"]. The wildcard key "*" applies to every database, including databases created after the grant.


Permission required per statement

statementrequired permission
CREATE DATABASEA on * (global admin)
DROP DATABASEA on the named database
SHOW DATABASESany grant (output filtered per-user)
SHOW STATUSnone
CREATE LENSC on active database
DROP LENSD on active database
DERIVE LENSC on active database
SET TTL LENSC on active database
UNSET TTL LENSC on active database
SHOW LENSESR on active database
APPEND LENSU on active database
BATCH APPEND LENSU on active database
COPY LENSU on active database
AT LENSR on active database
AT LENS … AS OFR on active database
AT LENS … LAYERR on active database
RANGE LENSR on active database
REDUCE LENSR on active database
HISTORY LENSR on active database
BACKUP DATABASER on the named database
RESTORE DATABASEA on * (global admin)
START TRANSACTIONchecked at commit time per buffered statement
CREATE USERA on * (global admin)
DROP USERA on * (global admin)
GRANTA on target database, or global admin
REVOKEA on target database, or global admin
SHOW USERSA on * (global admin)
SHOW GRANTS (self)none — any authenticated user may view their own grants
SHOW GRANTS (other)A on * (global admin)
AUTHnone — unauthenticated
QUIT / EXITnone

Global admin

A user is a global admin when they hold A on "*":

GRANT A ON * TO alice

Global admins can perform all operations on all databases, including databases that do not yet exist. The bootstrap user created with --username / --password on first start is automatically a global admin.


Granting permissions

GRANT <perms> ON <db|*> TO <user>

<perms> is any combination of the five letters (C, R, U, D, A), the shorthand * (all bits), or - (no bits). Letters may appear in any order.

GRANT RU ON sensors TO alice        ← read + write on sensors
GRANT * ON * TO bob                 ← full access everywhere
GRANT A ON * TO carol               ← promote to global admin
GRANT - ON staging TO dave          ← revoke all bits on staging

Revoking permissions

REVOKE <perms> ON <db|*> FROM <user>

REVOKE clears the specified bits. It does not affect grants on other databases.

REVOKE U ON sensors FROM alice      ← remove write access on sensors

Wildcard grants

A grant on "*" is a wildcard. It combines with database-specific grants via bitwise OR:

  • alice has R on sensors and CRU on *
  • Effective permission on sensors = R | CRU = CRUE (no delete, no admin)
  • Effective permission on any other database = CRU

Embedded use bypasses auth

Library consumers calling Executor::exec directly never pass through check_permission. Auth is a server-side concern, enforced only when using exec_as / exec_read_as in the TCP server layer.


Example: read-only analyst

CREATE USER analyst PASSWORD "hunter2"
GRANT R ON metrics TO analyst

analyst can execute AT, RANGE, REDUCE, HISTORY LENS, SHOW LENSES. They cannot APPEND, CREATE LENS, DROP LENS, or access other databases.

Example: service account with write access

CREATE USER ingest PASSWORD "s3cr3t"
GRANT CRU ON * TO ingest

ingest can create lenses and append data on any database but cannot delete lenses (D) or perform admin operations (A).