Add M10.3a account-bound session grants and region session control
Foundation / checks (deploy) (push) Successful in 5s
Foundation / checks (ecs) (push) Successful in 1m47s
Foundation / checks (client) (push) Failing after 9m42s
Foundation / checks (network) (push) Successful in 8m49s
Foundation / postgres-tools (push) Canceled after 0s
Foundation / server-image (push) Canceled after 0s
Foundation / image (push) Canceled after 0s
Foundation / checks (postgres) (push) Canceled after 8m13s
Foundation / checks (tsan) (push) Canceled after 7m13s
Foundation / checks (checks) (push) Canceled after 17m58s

Provider-independent 128-bit AccountIds; ECDSA P-256 session grants v1 signed by
issuer keys and verified by regions with public keys only, the environment byte
signed so dev grants never verify in stage or World0. Per-account serials make the
newest grant win: replay and older stolen grants are refused, a newer grant replaces
the account's session, and refresh renews in place. Attempt rates and capacities
are bounded. The evo_identity library provides the provider, account directory and
grant issuer interfaces with a dev-only test provider. ADR-0091.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
dingo
2026-10-03 20:54:04 -04:00
co-authored by Claude Opus 5.5
parent 34e142f68d
commit 01b4b06a09
17 changed files with 1409 additions and 7 deletions
+3 -1
View File
@@ -519,7 +519,9 @@ networking/M10_TIMING_TRACES.md); targets are not yet qualified on the reference
hardware (10.9). 10.2 split: 10.2a selection, pins and build of msquic/OpenSSL done
(ADR-0090); 10.2b bounded channels, exact CA pinning and the impairment relay done;
10.2c loss/head-of-line measurements done (networking/M10_TRANSPORT_MEASUREMENTS.md).
10.3-10.9 planned.
10.3 split (ADR-0091): 10.3a account ids, ECDSA grants, identity adapter and region
session control done; 10.3b QUIC session handshake and 10.3c durable control lease
follow. 10.4-10.9 planned.
**Entry:** M9 client/session evidence and M7/M8 dev/stage durability. Read
NETWORK_ARCHITECTURE, PERSISTENCE_ARCHITECTURE and ADR-0017. The M9 transport is
+5 -1
View File
@@ -16,7 +16,11 @@ check authoritative, minimum-MTU start) and the owned impairment relay, tested o
platforms. M10.2c measures loss and head-of-line blocking through the relay: under 5-10 %
loss the ordered stream's p95 latency is 3-5.5x the datagram channel's and exceeds the
250 ms target at 100 ms RTT, while datagrams stay <= 67 ms, which confirms the channel split
(networking/M10_TRANSPORT_MEASUREMENTS.md). M10.2 is complete. Next: M10.3 session binding.
(networking/M10_TRANSPORT_MEASUREMENTS.md). M10.2 is complete. M10.3a (ADR-0091) adds provider-independent account ids, ECDSA P-256
session grants verified with public keys only, the identity adapter and grant issuer
library, and per-region session control (newest grant wins and replaces the old session,
replay and stale grants refused, in-session refresh, attempt rate limits). Next: M10.3b
QUIC session handshake, then the durable control lease (10.3c).
## Previous gate - 2026-10-02
@@ -0,0 +1,86 @@
# ADR-0091: M10 session identity, grants and control authority
## Status
Accepted for M10.3 (2026-10-03). Decisions confirmed with the maintainer on 2026-10-03:
ECDSA P-256 grants through Mbed TLS PSA; an identity adapter and grant issuer as a
library (no service, no Steam yet); a newer grant replaces an account's existing
session; unique control backed by a durable per-world control lease. Delivery:
10.3a grants, identity adapter and region session control (this text);
10.3b the QUIC session handshake; 10.3c the durable control lease. Each segment
amends this ADR. The M9 dev path (ADR-0082/0083, protocol v1) is unchanged.
## Context
ADR-0017 and NETWORK_ARCHITECTURE require short-lived world/region/account-scoped
grants, reconnect that cannot duplicate control, secrets kept out of logs, and an
identity provider independent of Steam. ADR-0089 fixed that reconnect is a new grant,
a new session and a fresh baseline, and that no session survives an epoch change.
M9 has only dev grants: HMAC-SHA256, a u64 subject, refusal of a second session per
subject, single use remembered in a file ledger. No account backend exists, and no
controllable organism exists yet (organisms arrive with M11).
## Decision
**Accounts.** `AccountId` is 128 random bits assigned by the account directory and
never derived from a provider id. Providers authenticate a credential to a
`ProviderSubject` (provider kind plus opaque subject); the directory maps subjects to
accounts. Logs and events may carry only `log_label` (the first four id bytes).
**Grant format v1** (schemas/network/session-grant-v1.md): fixed 160 bytes,
`EVO-GRANT` marker, version, environment byte, issuer key id, grant id, account,
per-account serial, world/frame, region, issued/expiry seconds; ECDSA P-256 over
SHA-256 of the first 96 bytes (Mbed TLS 4.1.1 PSA, already pinned; no new dependency).
Issuers hold private keys (`GrantSigningKey`, non-exportable PSA keys); regions hold
only public keys (`GrantVerifier`, at most 8 per environment for rotation), so a
compromised region cannot mint grants. Verification checks the signature before any
claim and then requires the signed environment byte to equal the verifier's.
**Dev cannot reach production, by four independent checks:** M9 dev grants have
another marker and length; a dev-signed session grant carries the dev environment
byte and fails in stage/World0 even if a dev public key were misconfigured there;
`DevTestProvider` (credential `dev-test:<name>`, no secret) cannot be constructed
outside dev; `GrantIssuer` refuses a provider and key from different environments.
**Serials order grants; the newest wins.** The directory issues per-account serials
that strictly increase, with non-decreasing `issued_at`. A region accepts a grant only
if its serial is greater than every serial it accepted for that account. This gives
single use (replay is `stale_grant`) and makes an older unexpired grant, for example a
stolen one, useless once a newer grant was presented. A region remembers an account's
serial until the newest accepted `issued_at` plus its maximum lifetime, after which
every older grant has expired.
**Session control** (`SessionControl`, per region, single owner, transport-neutral):
environment, world, region, lifetime (default maximum 300 s), clock skew (30 s),
expiry and serial checks; at most one session per account. A valid newer grant for an
account that holds a session closes the old session first and reports it as
superseded, so control is never shared and a dropped client reconnects without waiting
for the 5 s liveness timeout. `refresh` renews the session in place with a newer grant
(no reconnect or new baseline); a session closes when its grant expires. An epoch
change closes every session. Bounds: sessions (32), tracked accounts (4,096; full fails
closed rather than forgetting serials), and attempt rates: region-wide attempts before
signature verification (64 per 60 s) and verified attempts per account (4 per 60 s),
counted whether or not accepted. A refused open (capacity) does not consume the grant.
These limits are engineering defaults, not game rules.
**Identity adapter** (`evo_identity`, library): `IdentityProvider`, `AccountDirectory`
(bounded in-memory implementation for tests and tools), `GrantIssuer` (credential to
signed grant, lifetime 1..3600 s). Production providers and a running issuer service
are later work behind these interfaces.
## Alternatives considered
| Option | Disposition |
|---|---|
| HMAC grants per environment | Every region could forge grants for its environment. |
| Ed25519 | Not in Mbed TLS; would need a new crypto dependency. |
| Refuse a second login (M9 behaviour) | A silently dropped client waits for the liveness timeout; kept for M9 only. |
| Per-grant single-use set | Does not stop an older unused grant (stolen) from taking control; serial ordering subsumes it. |
| Grant lifetime as session lifetime without refresh | Short grants would force reconnects and fresh baselines every few minutes. |
## Consequences and limits (10.3a)
- Serials and sessions are in memory: a restarted region process would accept an
already-used, still-unexpired grant again (bounded by the 300 s lifetime), and two
regions of one world could each admit the same account. The durable control lease
(10.3c) closes both. Until then nothing deploys M10 sessions.
- If a newer grant is stolen before its owner presents it, the thief can take control
until the owner presents a still newer grant. Grants travel only inside TLS and are
never logged; revocation (bans) and channel binding are not designed yet.
- Private-key provisioning: `GrantSigningKey::import` takes a raw 32-byte P-256 scalar;
a provisioning tool and secret handling come with the issuer service.
+1
View File
@@ -98,6 +98,7 @@ design. No unadopted candidate is a link dependency of the proof.
- [ADR-0084: Engineering UI toolkit](0084-engineering-ui-toolkit.md) - Dear ImGui 1.92.9b pinned (M9.8a) and integrated as the engineering client overlay with toolkit-first input routing (M9.8c).
- [ADR-0090: M10 QUIC transport](0090-m10-quic-transport.md) - msquic 2.6.2 with OpenSSL 3.5.9 LTS (TLS 1.3 only) from pinned sources on Windows and Linux; DATAGRAM frames for superseding state, streams for reliable actions; M9 TLS/TCP kept as dev fallback; owned impairment relay; exact CA pinning due in 10.2b.
- [ADR-0091: M10 session identity and control](0091-m10-session-identity-and-control.md) - provider-independent 128-bit AccountIds, ECDSA P-256 session grants (regions hold public keys only, signed environment byte), per-account serials where the newest grant wins, takeover of an existing session, in-session refresh, bounded attempt rates; identity adapter and issuer as a library; durable control lease follows (10.3c).
- [ADR-0089: M10 timing and budgets](0089-m10-timing-and-budgets.md) - ratified 50 ms tick, 1 s flush with final outcomes p95 <= 1.5 s, responsiveness LAN p95 <= 150 ms / 100 ms RTT <= 250 ms, reference hardware; derived scheduling, sequence, baseline, queue/byte/work budgets and the exact/tolerant determinism contract; records the per-tick biology coupling.
- [ADR-0088: Rendered deployment policy](0088-rendered-deployment-policy.md) - the deploy policy check renders every overlay with pinned kustomize v5.8.1 (checksum-verified, explicit preparation) and validates effective objects; unsupported kustomize features refused.
- [ADR-0087: Dev session route](0087-dev-session-route.md) - evolution-dev only: void.aeternalisgames.com:7400 via a dedicated internal MetalLB VIP to the region pod, TLS end to end, CIDR-limited, operator-opened windows enforced by evo-server; committed disabled with fail-closed policy tests.
+3 -1
View File
@@ -6,7 +6,9 @@ proposals for M10. M10 timing and workload budgets: ADR-0089 and
with OpenSSL (ADR-0090): bounded DATAGRAM and reliable-stream channels with exact CA
pinning (`evo_network_quic`, M10.2b); loss/head-of-line measurements (M10.2c,
[M10_TRANSPORT_MEASUREMENTS](../networking/M10_TRANSPORT_MEASUREMENTS.md)) confirm
superseding state on DATAGRAMs and reliable actions on the ordered stream. The scoped M9 dev session (TLS 1.3, protocol v1, dev-only grants)
superseding state on DATAGRAMs and reliable actions on the ordered stream. Session
identity and control (ADR-0091, M10.3): ECDSA-signed account-scoped grants
([session-grant-v1](../../schemas/network/session-grant-v1.md)), newest grant wins. The scoped M9 dev session (TLS 1.3, protocol v1, dev-only grants)
is specified in [DEV_SESSION_PROTOCOL](../networking/DEV_SESSION_PROTOCOL.md) and
ADR-0082. M0 has no networking. Steam distribution follows later through
an identity-provider adapter; core account IDs are independent of Steam IDs.
+30
View File
@@ -4087,7 +4087,37 @@ extension was negotiated (measurement now waits for it); clang-tidy widening fin
Executed: Linux format check, GCC 14 build, CTest `-L quic` 2/2, clang-tidy 19 on the tool
and relay; Windows MSVC preset `quic` build and CTest 3/3; both measurement runs.
Correction (later the same day): the Windows build preceded the final formatting pass,
which sorted `<timeapi.h>` before `<windows.h>`; the committed tool did not compile with
MSVC. Fixed in the next commit (separate include block); MSVC preset `quic` rebuilt, CTest
3/3 and a 2 s measurement run. The `-Action test` step of windows-check does not build:
always run `-Action build` first.
Limits: no kernel TCP/netem comparison (user-space relay by decision), single host and
loopback, development hardware, 15 samples of 16 KiB messages per configuration, run
length cuts off in-flight stream messages; msquic not under sanitizers; quic preset not
in CI.
## 2026-10-03 — M10.3a session grants, identity adapter and session control (ADR-0091)
Implemented `SessionControl` and `AccountId` (evo_network_protocol), ECDSA P-256 session
grants `GrantSigningKey`/`GrantVerifier` (evo_network_tls, Mbed TLS PSA) and the identity
adapter `evo_identity` (DevTestProvider, MemoryAccountDirectory, GrantIssuer); tests in
`tests/network_control.cpp` (part of `evo-network-tests`, label `network`).
Tests: sign/verify round trip; every one of the 160 grant bytes flipped is refused (key
id bytes as unknown key, others as bad signature); truncated and M9 dev grants refused;
dev-signed grants refused by stage and World0 verifiers with and without the dev public
key configured; key rotation, duplicate and excess keys, relabelled key id, invalid
point, key import and moved-from keys; DevTestProvider refused outside dev, credential
syntax; directory stability, capacity and serial/issue-time monotonicity; issuer end to
end into session control and environment mismatch; control scope (world, region,
environment), lifetime, skew and expiry; replay and older unexpired grants refused
(`stale_grant`), newest grant superseding the previous session, account and region
attempt limits with window reset, refused open not consuming the grant, account capacity
failing closed until older grants can no longer verify, refresh (extension, stale,
wrong account, unknown session), grant expiry and epoch change closing sessions; log label.
Executed: Linux GCC 14 preset `network` build and CTest `-L network` 1/1; Clang 19
ASan/UBSan (Debug, leak detection) `evo-network-tests`; clang-tidy 19 on the new sources
and tests; format check; Windows MSVC 19.44 preset `network` build and CTest 1/1.
Not done: QUIC session handshake (10.3b), durable control lease and serial persistence
across restarts and regions (10.3c), revocation, private-key provisioning tooling.