Wiki Reference
Permissions
Every permission bit in a Mirexa session token, what each one guards, and how a node computes the grant it enforces.
Every Mirexa session carries a 64-bit permission bitmap. A client presents one in its session token at the handshake, the node narrows it to what it is willing to grant, and from then on every request is checked against that grant. Seven bits are defined. This page lists them, says which operations each one guards, and explains how the grant is computed.
How tokens are minted and keys configured is in Authentication and tokens; the token's byte layout is in Wire protocol.
The bits
| Bit | Value | Name | Guards |
|---|---|---|---|
| 0 | 0x01 |
READ_ |
Tick queries (QUERY_ with the ticks flag, including a rollup from trades); tick sub-queries of QUERY_; tick subscriptions. |
| 1 | 0x02 |
READ_ |
Candle queries (including column queries and candle rollups); candle sub-queries of QUERY_; candle subscriptions; LIST_; GET_. |
| 2 | 0x04 |
WRITE_ |
INGEST_. |
| 3 | 0x08 |
WRITE_ |
INGEST_ (live, history and correction routes); FILL_; ACCEPT_. |
| 4 | 0x10 |
ADMIN_ |
Changing a stream's metadata over the data protocol: SET_, ADD_, REMOVE_, SET_. |
| 5 | 0x20 |
LIST_ |
Stream discovery: LIST_; also NODE_. |
| 6 | 0x40 |
ADMIN_ |
Every call on the gRPC control listener, when control. is on. Nothing on the data protocol checks it. |
| 7–63 | undefined | A token setting any of these is refused at the handshake. |
LIST_NODES is allowed with any one of LIST_STREAMS, READ_CANDLES or READ_TICKS,
so a read-only session can find the other nodes of a cluster.[1] The remaining
client frames — UNSUBSCRIBE_STREAM, STREAM_ACK and REAUTH — need no permission:
the first two act only on the session's own subscriptions, and a renewal is checked as a new
token.[2]
The names are case-insensitive where they are typed (mirexa-cli token issue -perms,
security.max_permissions); an unknown name is an error, never silently skipped.[3]
Why discovery has its own bit
LIST_STREAMS is separate from the read bits so that exposing prices and exposing the
catalog are separately grantable: a node can serve the data of streams a client already
knows without disclosing which instruments it holds. LIST_GAPS and
GET_STREAM_METADATA need READ_CANDLES instead, because they describe a stream the caller
already named.[4]
What each check looks like
A request lacking its permission is answered ERROR Unauthorized with a message naming the
missing permission (for example session lacks the write_candles permission). Nothing is
done, and the connection stays open.[5] In a QUERY_MULTI, every sub-query's
permission is checked before any runs, and one missing permission refuses the whole batch;
the node does not answer the permitted subset.[6]
A grant "includes" a permission only if it carries every bit of the mask; the empty mask is never included. This is the single definition both the node and the Go client use.[7]
How the grant is computed
flowchart LR
T[token's requested bitmap] --> V{signature valid,<br/>key not revoked,<br/>not expired?}
V -- no --> R[refused: ERROR Unauthorized]
V -- yes --> U{undefined bits set?}
U -- yes --> R
U -- no --> C["grant = requested AND max_permissions<br/>(if max_permissions is set)"]
C --> A[INIT_ACK carries the grant]
- The request. The token's permission bitmap. With
security.auth.enabled: trueit counts only if the token's Ed25519 signature verifies against one ofsecurity.auth.trusted_keys, the token is unexpired and expires no more than one hour ahead, and its signing key has not been revoked; that is the default, and a single node with no keys configured trusts an issuer it generates itself. With authentication off any signature is accepted, so the bitmap is whatever the client asserts. - Undefined bits (7–63) refuse the token outright rather than being masked off: a bit this node does not understand means the issuer knows something it does not, and granting the understood subset would let a client believe it has access it was refused.
- The ceiling. If
security.max_permissionsis set, the grant is the requested bitmap ANDed with it. The ceiling only narrows, never widens, and it applies whether or not authentication is on — it is the way to make a node read-only without any key material. - The answer.
INIT_ACKreturns the grant. When it is narrower than the request, the node logssession grant narrowedwith both sets.[8]
In short: grant = token bitmap ∩ security.max_permissions, with authentication deciding
whether the token bitmap is trustworthy at all.
A client should read the granted bitmap from INIT_ACK rather than assume it got what it
asked for (client.Client.HasPermission in Go). Finding a missing permission there costs a
branch; finding it as a refused write costs the batch.
security.max_permissions
A list of permission names, for example:
security:
max_permissions: [READ_CANDLES, READ_TICKS, LIST_STREAMS]
Empty or absent means no ceiling. An unknown name, or a list that names nothing grantable, stops the node at startup.[9] The config field's own comment lists only the four read/write names, but every name in the table above is accepted.
Without a token
When a Go or Python client is given no token, it sends an unauthenticated INIT: tenant 0,
an expiry 30 minutes ahead, a zero signature, and a request for
READ_CANDLES | WRITE_CANDLES | READ_TICKS | WRITE_TICKS | ADMIN_STREAM | LIST_STREAMS.[10]
- A node with authentication on refuses it (
Unauthorized, signature not from a trusted key). - A node with authentication off grants exactly that set, clamped by
max_permissions. That includesLIST_STREAMS(since 2026-10-30), so a tokenless client can list streams and readNODE_STATS; a node that must not disclose its catalog leaves the bit out ofmax_permissions.
With authentication off, permissions are self-asserted: any client that writes its own
INITcan request any defined bit, and the node enforces what was asked. Usesecurity.max_permissionsto bound what such a node will do, and turn authentication on wherever the network is not trusted.
Over the life of a session
- Expiry. The grant lasts until the token's expiry. The next frame after it is refused
Unauthorizedand the connection closed; a subscriber is disconnected at expiry, delayed bysecurity.auth.subscriber_graceif set.[11] - Revocation. When an issuer key is revoked through the control plane, every node refuses new handshakes and renewals signed by it, and refuses the next frame of an existing session under it.
- Renewal (
REAUTH). A new token, checked by the same rules and required to name the same tenant, replaces the session's grant and expiry. Writes and queries are held to the new grant from the next frame. If the new grant dropsREAD_CANDLESorREAD_TICKSthat the session had, its subscriptions are ended and the connection is closed, so a subscriber re-establishes under what the new token permits.[12] - Tenant. The tenant id is signed into the token and must match on renewal; no other operation reads it yet. Mirexa has no per-tenant data isolation.
The control plane
The gRPC control listener uses the same tokens, the same trusted keys and the same
admission rule as the handshake above: with control.admin_auth: true, every call must carry
authorization: Bearer <token> metadata, the token is admitted exactly as a session token is
(signature, revoked keys, expiry, the one-hour limit, defined bits, security.max_permissions),
and the resulting grant must hold ADMIN_CLUSTER. A missing, malformed, untrusted, revoked or
expired credential is UNAUTHENTICATED; a valid token whose grant lacks the bit is
PERMISSION_DENIED.[13] See Control-plane gRPC API.
The dashboard
The web dashboard holds one Mirexa token for all its users. What a dashboard user can do is
their dashboard role intersected with the grant the node gave the dashboard's own token
(itself clamped by the node's max_permissions). See The web dashboard.
References
Source
- Permission constants,
DefinedPermissions,GrantIncludes,ParsePermissionNames Handshaker.admit— the grant computation- Per-frame checks:
handleIngest,handleIngestTicks,handleSubscribe,handleQuery,handleTickQuery,handleRollupQuery,handleListStreams,handleListNodes,handleListGaps,handleQueryMulti,metadataWrite,handleGetStreamMetadata,handleFillGap,handleAcceptGap,handleNodeStats handleReauthsecurityOptions,resolveGrantCeiling;SecurityConfig.MaxPermissionsClient.initFrame,unauthenticatedRequestAdminAuth.Verify
Tests
TestServer_EveryEnforcementSiteRefusesAnExcludedGrant,TestServer_EveryEnforcementSiteServesAGrantedRequest— /internal/network/auth_enforcement_test.goTestServer_GrantCeilingAppliesWithAuthDisabled,TestServer_GrantCeilingNeverWidens,TestServer_UndefinedPermissionBitIsRefused— /internal/network/auth_grant_test.goTestServer_AuthEnabledRefusesATamperedGrant— /internal/network/auth_handshake_test.goTestServer_ListStreamsRequiresItsOwnPermission— /internal/network/list_streams_test.go;TestServer_ListGapsRequiresReadCandles— /internal/network/list_gaps_test.goTestListNodes_NeedsAReadOrTheListPermission— /internal/network/list_nodes_test.go;TestNodeStats_NeedsTheListPermission— /tests/node_stats_test.goTestServer_MetadataWritesNeedAdminStream— /internal/network/stream_metadata_test.goTestPermissions_NamesRoundTrip— /internal/wire/handshake_signing_test.go;TestClient_HasPermissionAgreesWithGrantedPermissions— /client/permission_test.goTestAuth_SDKPresentsACLIIssuedToken,TestAuth_SDKReadsANarrowedGrant— /tests/auth_end_to_end_test.goTestReauth_ARequestIsHeldToTheRenewedGrant,TestReauth_ANarrowedGrantEndsTheSubscriptionsItNoLongerPermits— /tests/auth_renewal_test.goTestServerBinary_AKeyRevokedThroughTheControlPlaneIsRefusedOnEveryNode— /tests/server_binary_revocation_test.goTestAdminAuth_AcceptsATokenCarryingAdminCluster,TestAdminAuth_UnauthenticatedAndDeniedAreDifferentCodes,TestAdminAuth_ExpiryIsCheckedAfterTheSignature— /internal/control/admin_auth_test.go
Further reading
- Authentication and tokens, mirexa-cli token
- Wire protocol, Error codes, Control-plane gRPC API
- Configuration reference, The web dashboard
External
- RFC 8032, "Edwards-Curve Digital Signature Algorithm (EdDSA)": https://www.rfc-editor.org/rfc/rfc8032
- RFC 6750, "The OAuth 2.0 Authorization Framework: Bearer Token Usage" — the
Bearerscheme the control plane accepts: https://www.rfc-editor.org/rfc/rfc6750
Server.handleListNodesin /internal/network/server.go;TestListNodes_NeedsAReadOrTheListPermission. ↩︎handleUnsubscribeandhandleStreamAckin /internal/network/server.go check no permission;handleReauthchecks the new token throughHandshaker.Reauthorize. ↩︎ParsePermissionNamesandpermissionTablein /internal/wire/handshake.go;TestPermissions_NamesRoundTrip. ↩︎PermListStreamsdoc comment in /internal/wire/handshake.go;handleListGapsin /internal/network/server.go. ↩︎TestServer_EveryEnforcementSiteRefusesAnExcludedGrant. ↩︎Server.handleQueryMultiin /internal/network/multiquery.go. ↩︎GrantIncludesin /internal/wire/handshake.go;TestClient_HasPermissionAgreesWithGrantedPermissions. ↩︎Handshaker.admitin /internal/network/handshaker.go and the narrowed-grant log inServer.handleConn;TestServer_GrantCeilingNeverWidens,TestServer_UndefinedPermissionBitIsRefused,TestServer_GrantCeilingAppliesWithAuthDisabled. ↩︎resolveGrantCeilingin /cmd/server/main.go. ↩︎unauthenticatedRequestandunauthenticatedValidityin /internal/wireclient/client.go; the Python SDK copies the set inmirexa/_conn.py(separate repository, read 2026-10-30). ↩︎Server.sessionRefusalandsessionExpiryin /internal/network/server.go. ↩︎Server.handleReauthin /internal/network/reauth.go. ↩︎AdminAuth.VerifyandbearerFromin /internal/control/admin_auth.go, overnetwork.Server.Admission;TestAdminAuth_RefusesAKeyTheClusterRevoked,TestAdminAuth_RefusesATokenBeyondTheValidityWindow,TestAdminAuth_TheGrantCeilingApplies. ↩︎