Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# StartSession Operator Action Schema

## Implementation status

The shared StartSession action, mutation-digest codec, pre-authorization reservation tuple, post-authorization execution tuple, and Account authority-evidence bundle are present as common-platform-core value and codec contracts with focused Java tests and shared Java/Python digest vectors. Logging & Admin also implements durable StartSession pre-authorization reservation persistence and the read-only `ReadCurrentClaimEvidence` transport for Account claim-evidence handoff. Production reservation construction is write-denied and passive/read-only; mutation-capable construction is isolated to test-only fixtures. These implementations do not establish current Account authority. Account issuance and redemption are not wired; Game Session and Game Design runtime registration and owner execution integration are not implemented. External routing and end-to-end launch proof remain unproved. No external route or runtime activation is enabled by this boundary.

## Normative contract

This document defines the StartSession action-family schema `firemud.game-session.start-session`, version `1`, owned by `game-session-service`. It defines the digest input shape for the `StartSession` operator action. It does not make the external operator route routable or establish an authorization decision.

The request is a JSON object whose declared member order is `actionFamilySchemaId`, `actionFamilySchemaVersion`, `scope`, `target`, `expectedVersion`, `mutation`, and `auditReason`. `expectedVersion` is absent for this creation action and must not appear in the JSON request, including as `null`. Its absence remains an explicit seventh field in the canonical digest preimage. All other top-level members are required.

| Member | Required shape and constraint |
| --- | --- |
| `actionFamilySchemaId` | String exactly `firemud.game-session.start-session`. |
| `actionFamilySchemaVersion` | String exactly `1`. |
| `scope` | Object with exactly `tenantId`, then `targetNamespace`. |
| `scope.tenantId` | Canonical lowercase, hyphenated, non-nil UUID. |
| `scope.targetNamespace` | Kubernetes workload namespace label: 1–63 lowercase ASCII letters or digits, with internal hyphens allowed and no leading or trailing hyphen. |
| `target` | Object with exactly `gameTemplateId`, then `ownerAccountId`. |
| `target.gameTemplateId` | JSON string matching `[1-9][0-9]*`, within the current owner's signed `long` range. JSON numbers and strings with a sign, leading zero, decimal point, or exponent are rejected. |
| `target.ownerAccountId` | Canonical lowercase, hyphenated, non-nil Account UUID. Private legacy identifier mappings remain the receiver's responsibility. |
| `expectedVersion` | Explicitly absent for StartSession creation. Any supplied value, including `null`, is rejected. |
| `mutation` | Object with the optional member `clientIp`. |
| `mutation.clientIp` | Absent or a string whose NFC-normalized UTF-8 encoding is at most 128 bytes. Empty string is distinct from absence. `null` and all other types are rejected. No address parsing or ownership claim is implied. |
| `auditReason` | Required string, nonblank after NFC normalization, at most 1,000 normalized UTF-8 bytes. |

For the `auditReason` nonblank constraint, the shared blank codepoint set is exactly U+0009–U+000D, U+0020, U+0085, U+00A0, U+1680, U+2000–U+200A, U+2028, U+2029, U+202F, U+205F, and U+3000. Implementations must use this explicit set rather than a language-provided whitespace predicate. Other codepoints, including U+200B ZERO WIDTH SPACE, do not make an audit reason blank.

JSON object members must appear in the declared order. Duplicate raw keys, keys colliding after NFC normalization, unknown or missing members, wrong JSON types, malformed Unicode, invalid UTF-8, and trailing tokens are rejected before a digest is returned. Object and array values use the recursive typed grammar from [ADR 0047, Bounded Owner Delegation](../../decisions/adr-0047-logging-admin-as-external-operator-write-ingress.md#bounded-owner-delegation); no generic JSON canonicalization is a substitute.

The schema uses these shared parser and encoding bounds:

| Limit | Maximum |
| --- | ---: |
| Raw UTF-8 JSON input | 16 KiB |
| Composite nesting depth | 8 |
| Members in one object | 16 |
| Elements in one array | 64 |
| NFC-normalized string or object-key bytes | 4,096 |
| Raw or canonical numeric bytes | 128 |
| Numeric scale | 128 |
| Canonical segment payload | 8,192 bytes |
| Complete `mutationDigest/v1` preimage | 32 KiB |

## Digest inputs and exclusions

The SHA-256 preimage follows ADR 0047's exact `mutationDigest/v1` framing. The schema pair and these typed fields are included in the ADR-defined order: `scope`, `target`, absent `expectedVersion`, `mutation`, and `auditReason`. The `mutation` object always declares one member, `clientIp`; if it is omitted from JSON, the digest still includes that member in its declared position with type `absent` and presence `0`. An empty string is encoded as a present `string` and therefore has a different digest.

The target owner is fixed to `game-session-service` for this schema and is carried separately in the ADR 0048 execution tuple; it is not a digest field. `controlPlaneRequestId`, any separately tagged action-family request identity, reservation owner and claim fence, transport credentials, opaque authorization references, actor assertions, and Account authority evidence are outside these seven grammar fields and are compared at their respective boundaries under [ADR 0047](../../decisions/adr-0047-logging-admin-as-external-operator-write-ingress.md#bounded-owner-delegation) and [ADR 0048](../../decisions/adr-0048-durable-idempotent-operator-write-execution.md#one-correlated-execution).

The action contains no runtime version or patch input. It does not assert current ownership or authority. Owner-domain checks, source selection and execution remain separate runtime prerequisites outside this shared-contract slice.

The shared Java implementation exposes `StartSessionOperatorActionCodec.decode(byte[])`, `canonicalPreimage(...)`, and `mutationDigest(...)`, plus the immutable typed action accessors. Shared Java and Python conformance vectors are stored in [the common vector fixture](../../../../services/common-platform-core/src/test/resources/operator/start-session-mutation-digest-v1-vectors.json).
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,11 @@ curl -H 'Authorization: Bearer <disposable non-production privileged JWT>' \

## gRPC

- `logging_admin.v1.StartSessionReservationEvidenceService/ReadCurrentClaimEvidence` – internal, read-only Account handoff for the exact durable Logging & Admin StartSession reservation claim. It accepts only an active, unexpired `AUTHORIZATION_PENDING` or `AUTHORIZED` row whose request ID, canonical pre-authorization tuple, mutation digest, original reservation owner/fence, current claim owner/fence, and persisted claim purpose match exactly. `ISSUE` is allowed only for an original claim or a fresh claim recovered from `RESERVED`, after that claim has advanced the same reservation to `AUTHORIZATION_PENDING`; recovery from `AUTHORIZATION_PENDING` is lookup-only until its original Account response is found, then it may enrich the same tuple and perform the one original owner handoff. Recovery from `AUTHORIZED` may only look up that original Account response before the same one-time handoff. No recovery creates a new request, authorization reference, or owner attempt, or changes the original reservation owner/fence. The response returns that stored claim evidence and observation time; it does not issue an authorization reference, advance the reservation, or authorize owner execution. A missing row returns `NOT_FOUND`; stale, mismatched, or expired claims return `FAILED_PRECONDITION`; malformed input returns `INVALID_ARGUMENT`; persistence unavailability returns `UNAVAILABLE`.
- This RPC is the sole entry in `firemud.auth.grpc.public-methods`, so the shared Bearer-JWT interceptor does not authenticate it. The gRPC server still requires a client certificate, and the shared TLS peer interceptor extracts the normalized URI principal and presented-leaf SHA-256 from the same verified TLS session as separate evidence. The receiver permits only `spiffe://firemud/ns/<configured-namespace>/sa/account-service`, no authenticated caller context, and a leaf approved for this exact method by the protected server-owned file in [Configuration](./configuration.md#service-specific-variables). Missing/blank namespace or approval configuration, a missing peer or leaf, an unapproved leaf, malformed/unavailable approval policy, and any different or cross-namespace peer are denied before the reservation read. A JWT header is neither authority nor rejected as a blanket condition.
- The reservation boundary is currently passive in production: Spring/public service and repository constructors deny acquire, recovery-claim acquisition, renewal, expiry, authorization transitions/enrichment, and owner handoff before repository/SQL work. Read methods remain available. There is no configuration, environment, or caller-controlled switch that enables these writes; mutation-capable construction exists only in the isolated test-fixtures source set. The proto/read contract therefore does not claim that production reservation writes or the operator workflow are enabled.
- The persisted canonical tuple can contain an actor Account ID, tenant and target-owner identifiers, operator reason, and optional client IP. Treat these fields as potentially personal or subject-linked data. The 30-second claim lease is a concurrency/recovery lease, not a retention period. Lifecycle and exact handoff remain governed by [ADR 0048](../../decisions/adr-0048-durable-idempotent-operator-write-execution.md); transport identity remains governed by [ADR 0038](../../decisions/adr-0038-explicit-jwt-profiles-and-mtls-workload-identity.md). Retention, terminalization, legal holds, export/erasure treatment, tombstones, and safe-watermark cleanup are not implemented here and must follow [DATA-01 / ADR 0050](../../decisions/adr-0050-versioned-export-retention-and-erasure-policy.md) and [ADR 0163](../../decisions/adr-0163-service-owned-retention-classes-with-cross-service-safety.md); no retention duration is inferred from the lease.
- Activation remains blocked on this family's owner registry and approved finite schedule, including subject/tenant export, erasure or minimization, legal holds, backups and restore reconciliation. Its nonterminal reservations are live/recoverable work; any future terminal receipts and recovery lineage need cross-owner retry/restore-safe watermarks, while audit reason and client IP require purpose-bound governance and payload minimization. Post-authorization evidence also includes token identifiers and authorization-reference fingerprints, not the opaque reference itself. Proof-qualified terminalization, dependent-owner closure, tombstone/anti-replay preservation and bounded cleanup are still missing; the existing DELETE/TRUNCATE protections remain intact. Isolated run-owned tests cannot satisfy or enable this production activation gate.
- `Ping(PingRequest) returns (PingResponse)` – connectivity check defined in [`logging_admin_service.proto`](../../../../protos/logging-admin/v1/logging_admin_service.proto); the current gRPC interceptor requires a Bearer JWT, while the target classification remains platform health policy.
- `QueryLogs(QueryLogsRequest) returns (QueryLogsResponse)` – queries the service-owned PostgreSQL `log_events` table for the exact tenant and case-insensitive message containment and returns matching stored messages; it does not query the deployed structured-log pipeline.
- `ApplyModerationAction(ApplyModerationActionRequest) returns (ApplyModerationActionResponse)` – unavailable/gated implementation contract for moderation policy input/audit until the action-family schema, shared cross-language `mutationDigest/v1` golden vectors, Account authorization-reference issuance, and receiving-boundary validation/redemption exist; it now hard fails closed with an application-level `UNAVAILABLE` error before dispatch or persistence, while separate fixed-category policy/audit evidence and owner enforcement are absent, and it is not current supported external operator mutation. Target behavior uses one Account reference bound to the exact request identity/digest and redeemed exactly once by Logging & Admin for local policy-input/audit persistence; that reference is never forwarded or reused. Any future owner-enforcement command uses a separate Account reference redeemed once by its receiving owner. `EvaluateModerationPolicy` remains the live read contract used at owner enforcement boundaries and carries no mutation authorization reference.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,15 @@ The Logging & Admin Service does **not** connect to Redis at runtime. It consume
| `FIREMUD_AUTH_JWT_SECRET` | Legacy HMAC JWT validation secret (transitional only; not for player-facing environments) | *(none)* |
| `FIREMUD_AUTH_JWT_SECRET_PATH` | Legacy file path for HMAC JWT validation secret (transitional only; not for player-facing environments) | *(none)* |
| `FIREMUD_AUTH_JWT_EXPIRATION_MS` | Lifetime of issued JWTs in milliseconds | `3600000` |
| `FIREMUD_GRPC_WORKLOAD_NAMESPACE` | Namespace required for the exact Account workload identity on the StartSession reservation evidence RPC; blank configuration denies that method | *(none)* |
| `FIREMUD_GRPC_ACCOUNT_RESERVATION_EVIDENCE_APPROVED_LEAF_FILE` | Absolute path to the protected, method-scoped Account leaf-approval file for `ReadCurrentClaimEvidence`; blank, unreadable, or invalid policy denies the method | *(none)* |
| `FIREMUD_SERVICES_ACCOUNT_SERVICE` | gRPC endpoint (host:port) for the Account Service | *(none)* |
| `FIREMUD_SERVICES_GAME_SESSION_SERVICE` | gRPC endpoint (host:port) for the Game Session Service | *(none)* |

`logging_admin.v1.StartSessionReservationEvidenceService/ReadCurrentClaimEvidence` is the only method exempted from the shared Bearer-JWT interceptor. The server's required client-certificate handshake and verified TLS peer interceptor remain enabled. The receiver requires both the exact Account SPIFFE identity in `FIREMUD_GRPC_WORKLOAD_NAMESPACE` and approval of the SHA-256 fingerprint derived from the presented TLS leaf. It reads the configured file for each request; a missing path, read failure, malformed file, or unapproved leaf denies the request before reservation access. The JWT header is not an identity source for this method.

The file is a protected server-owned input mounted read-only for Logging & Admin. It contains exactly one required `active=<64 lowercase hexadecimal SHA-256>` line and may contain one `overlap=<64 lowercase hexadecimal SHA-256>;expires-at=<epoch-milliseconds>` line after it. The entries must name distinct leaves. Blank lines, comments, extra entries, duplicate leaves, uppercase or malformed fingerprints, non-absolute paths, and malformed expiry values are rejected. The overlap leaf is accepted only before its absolute expiry time as evaluated by the Logging & Admin host clock; the two-entry limit bounds overlap to one active and one retiring leaf. Replace the file atomically to rotate or revoke approval: publish a new active leaf with the prior leaf as overlap and an explicit deadline, then replace it with the new active leaf alone; immediate revocation replaces the file without the affected fingerprint. Provisioning and custody of this file, including rotation updates, are environment responsibilities and are not supplied or proven by this code change. No production leaf approval or live rotation is claimed.

## Proto Files

API schemas are kept in [`protos/logging-admin/v1`](../../../../protos/logging-admin/v1). When these change, run `./gradlew generateProto` to refresh generated sources.
25 changes: 25 additions & 0 deletions design/architecture/system-architecture-authz-route-matrix.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3709,6 +3709,31 @@ routes:
implementation_status:
known_drift:
- current_service_has_no_ReadLogEventReceipt_handler_and_returns_UNIMPLEMENTED; target_Account_mTLS_receipt_readback_and_runtime_proof_are_unavailable
- service: logging-admin-service
route: ReadCurrentClaimEvidence
transport: grpc
scope: account
route_status: target_not_currently_routable
classification: internal_workload
auth_path: exact_mtls_workload
issued_token_state: none
accepted_token_profiles: []
token_type: none
token_issuer: none
token_audience: none
method_policy: exact_declared_route
allowed_callers:
any_of: [account-service]
mtls_callers:
any_of: ["spiffe://firemud/ns/{namespace}/sa/account-service"]
end_user_token_required: false
caller_context: absent
certificate_instance_approval:
evidence: presented_leaf_der_sha256_from_grpc_tls_session
source: protected_method_scoped_file
maximum_approved_instances: 2
overlap: explicit_expiring_replacement_only
absent_or_invalid_policy: deny
- service: game-session-service
route: ToggleFeatureFlag
transport: grpc
Expand Down
Loading
Loading