Mirexa

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_TICKS Tick queries (QUERY_STREAM with the ticks flag, including a rollup from trades); tick sub-queries of QUERY_MULTI; tick subscriptions.
1 0x02 READ_CANDLES Candle queries (including column queries and candle rollups); candle sub-queries of QUERY_MULTI; candle subscriptions; LIST_GAPS; GET_STREAM_METADATA.
2 0x04 WRITE_TICKS INGEST_TICK_BATCH.
3 0x08 WRITE_CANDLES INGEST_CANDLE_BATCH (live, history and correction routes); FILL_GAP; ACCEPT_GAP.
4 0x10 ADMIN_STREAM Changing a stream's metadata over the data protocol: SET_STREAM_METADATA, ADD_STREAM_CLOSURE, REMOVE_STREAM_CLOSURE, SET_STREAM_LINEAGE.
5 0x20 LIST_STREAMS Stream discovery: LIST_STREAMS; also NODE_STATS.
6 0x40 ADMIN_CLUSTER Every call on the gRPC control listener, when control.admin_auth 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]
  1. The request. The token's permission bitmap. With security.auth.enabled: true it counts only if the token's Ed25519 signature verifies against one of security.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.
  2. 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.
  3. The ceiling. If security.max_permissions is 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.
  4. The answer. INIT_ACK returns the grant. When it is narrower than the request, the node logs session grant narrowed with 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:

yaml
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 includes LIST_STREAMS (since 2026-10-30), so a tokenless client can list streams and read NODE_STATS; a node that must not disclose its catalog leaves the bit out of max_permissions.

With authentication off, permissions are self-asserted: any client that writes its own INIT can request any defined bit, and the node enforces what was asked. Use security.max_permissions to 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 Unauthorized and the connection closed; a subscriber is disconnected at expiry, delayed by security.auth.subscriber_grace if 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 drops READ_CANDLES or READ_TICKS that 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

Tests

Further reading

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 Bearer scheme the control plane accepts: https://www.rfc-editor.org/rfc/rfc6750

  1. Server.handleListNodes in /internal/network/server.go; TestListNodes_NeedsAReadOrTheListPermission. ↩︎

  2. handleUnsubscribe and handleStreamAck in /internal/network/server.go check no permission; handleReauth checks the new token through Handshaker.Reauthorize. ↩︎

  3. ParsePermissionNames and permissionTable in /internal/wire/handshake.go; TestPermissions_NamesRoundTrip. ↩︎

  4. PermListStreams doc comment in /internal/wire/handshake.go; handleListGaps in /internal/network/server.go. ↩︎

  5. TestServer_EveryEnforcementSiteRefusesAnExcludedGrant. ↩︎

  6. Server.handleQueryMulti in /internal/network/multiquery.go. ↩︎

  7. GrantIncludes in /internal/wire/handshake.go; TestClient_HasPermissionAgreesWithGrantedPermissions. ↩︎

  8. Handshaker.admit in /internal/network/handshaker.go and the narrowed-grant log in Server.handleConn; TestServer_GrantCeilingNeverWidens, TestServer_UndefinedPermissionBitIsRefused, TestServer_GrantCeilingAppliesWithAuthDisabled. ↩︎

  9. resolveGrantCeiling in /cmd/server/main.go. ↩︎

  10. unauthenticatedRequest and unauthenticatedValidity in /internal/wireclient/client.go; the Python SDK copies the set in mirexa/_conn.py (separate repository, read 2026-10-30). ↩︎

  11. Server.sessionRefusal and sessionExpiry in /internal/network/server.go. ↩︎

  12. Server.handleReauth in /internal/network/reauth.go. ↩︎

  13. AdminAuth.Verify and bearerFrom in /internal/control/admin_auth.go, over network.Server.Admission; TestAdminAuth_RefusesAKeyTheClusterRevoked, TestAdminAuth_RefusesATokenBeyondTheValidityWindow, TestAdminAuth_TheGrantCeilingApplies. ↩︎