Authenticate CultMesh authority routes and replay operations
This commit is contained in:
parent
6835ea4c10
commit
f622ee1b24
30 changed files with 1432 additions and 142 deletions
|
|
@ -8,7 +8,8 @@ This is the implementation map for the browser Verse boundary.
|
|||
`samples/eve-two-runtime` remains the clean package-consumer/jsdom checkpoint.
|
||||
`samples/eve-browser-network` runs a durable C# provider, a real Chromium Eve
|
||||
lowerer, an independent C# headless observer, and a separate local Odin fixture
|
||||
over authenticated binary CultNet WebSocket routes. It proves one canonical
|
||||
over binary loopback CultNet WebSocket routes under an explicit
|
||||
`local-development` trust policy. It proves one canonical
|
||||
command effect, idempotent retry, shared observation, provider restart on a new
|
||||
physical route, browser rediscovery, retained lease resubscription, and a second
|
||||
canonical command after reconnection.
|
||||
|
|
@ -29,6 +30,10 @@ not a complete public Verse proof:
|
|||
`cultmesh.verse_catalog_request.v0` and
|
||||
`cultmesh.verse_catalog_response.v0`; application callbacks no longer need to
|
||||
smuggle provider URLs into the browser client;
|
||||
- `CultMeshBrowserClient` owns the final authority gate: remote use requires a
|
||||
consumer-pinned Odin P-256 root, an Odin-signed route certificate, `wss://`,
|
||||
and provider possession proof over a fresh nonce. A catalog source cannot
|
||||
bypass that gate by returning a route-shaped object;
|
||||
- Kotlin has a channel-aware WebSocket transport adapter, TypeScript has the
|
||||
browser client, and `GameCult.Networking.WebSockets` provides the bounded C#
|
||||
schema server host adapter;
|
||||
|
|
@ -58,9 +63,9 @@ Owner:
|
|||
|
||||
Inputs:
|
||||
|
||||
- an Odin-discovered WebSocket transport candidate;
|
||||
- an Odin-discovered route certificate and consumer-configured Odin root;
|
||||
- stable Verse and provider identities;
|
||||
- authenticated session evidence;
|
||||
- provider key possession over a fresh client nonce;
|
||||
- requested schema ids and record keys;
|
||||
- typed operation invocations and idempotency keys;
|
||||
- canonical CultNet schema-v0 MessagePack messages.
|
||||
|
|
|
|||
|
|
@ -9,9 +9,10 @@ selection owner then resolves the provider runtime from Odin's descriptor before
|
|||
opening the session. Discovery owns the current physical routes, and the session
|
||||
manager owns connection reuse, path rotation, and transport failure state.
|
||||
Each Odin route binds that authority runtime to one endpoint, protocol set, and
|
||||
generation. The client verifies the same tuple with the connected peer before
|
||||
the session becomes online; runtime membership and endpoint reachability are
|
||||
not independent routing evidence.
|
||||
generation. For a remote Verse, Odin signs that exact tuple and the provider's
|
||||
P-256 public key. The client pins an Odin root from its own configuration, then
|
||||
requires the connected provider to sign a fresh client nonce. A route cannot
|
||||
become usable by merely repeating the expected Verse and runtime strings.
|
||||
|
||||
```csharp
|
||||
using GameCult.Mesh;
|
||||
|
|
@ -22,9 +23,22 @@ const string verseId = "sample.counter";
|
|||
var target = new CultMeshSessionTarget(verseId, "sample.counter-daemon");
|
||||
using var timeout = new CancellationTokenSource(TimeSpan.FromSeconds(30));
|
||||
var cancellationToken = timeout.Token;
|
||||
var odinRoot = new CultMeshEcdsaP256PublicKey(
|
||||
Environment.GetEnvironmentVariable("ODIN_ROOT_KEY_ID")
|
||||
?? throw new InvalidOperationException("Set ODIN_ROOT_KEY_ID."),
|
||||
Environment.GetEnvironmentVariable("ODIN_ROOT_P256_X")
|
||||
?? throw new InvalidOperationException("Set ODIN_ROOT_P256_X."),
|
||||
Environment.GetEnvironmentVariable("ODIN_ROOT_P256_Y")
|
||||
?? throw new InvalidOperationException("Set ODIN_ROOT_P256_Y."));
|
||||
using var mesh = new CultMeshClient(new CultMeshClientOptions
|
||||
{
|
||||
RendezvousEndpoints = new[] { odinEndpoint }
|
||||
RendezvousEndpoints = new[] { odinEndpoint },
|
||||
Sessions = new CultMeshSessionManagerOptions
|
||||
{
|
||||
Trust = new CultMeshAuthorityTrustPolicy(
|
||||
CultMeshAuthorityTrustMode.AuthenticatedRemote,
|
||||
new[] { odinRoot })
|
||||
}
|
||||
});
|
||||
|
||||
using var counterLease = await mesh.LeaseDocumentAsync<CounterState>(
|
||||
|
|
@ -64,6 +78,21 @@ using var stateWatch = session.WatchState().Subscribe(state =>
|
|||
Application code does not reconnect, sleep, rank endpoints, or replace the
|
||||
session. Those decisions belong to CultMesh.
|
||||
|
||||
For a deliberately local, moddable Verse, select the exception explicitly and
|
||||
use only in-process or loopback routes:
|
||||
|
||||
```csharp
|
||||
Sessions = new CultMeshSessionManagerOptions
|
||||
{
|
||||
Trust = new CultMeshAuthorityTrustPolicy(CultMeshAuthorityTrustMode.LocalDevelopment)
|
||||
}
|
||||
```
|
||||
|
||||
`LocalDevelopment` never accepts an unsigned non-loopback route. Verse names,
|
||||
provider names, and Odin wire fields cannot turn this exception on. Remote
|
||||
routes require a trusted Odin signature, provider nonce proof, certificate
|
||||
validity, and a protected channel.
|
||||
|
||||
Fast session-management check (this uses controlled transports; it is not the
|
||||
network proof):
|
||||
|
||||
|
|
@ -71,7 +100,7 @@ network proof):
|
|||
dotnet test tests/GameCult.Mesh.Tests/GameCult.Mesh.Tests.csproj --filter FullyQualifiedName~CultMeshSessionManagerTests
|
||||
```
|
||||
|
||||
The real checkpoint in chapter 4 additionally advertises a better-priority
|
||||
The local checkpoint in chapter 4 additionally advertises a better-priority
|
||||
endpoint for the wrong authority runtime. Both the C# and browser clients must
|
||||
ignore it, verify the intended peer, survive route replacement, and reject
|
||||
wrong-source operation responses.
|
||||
|
|
|
|||
|
|
@ -64,13 +64,20 @@ operation.
|
|||
transport diagnostics. None of these grant provider authority or become content
|
||||
identity.
|
||||
|
||||
Before a schema, content, or realtime session becomes online, the transport
|
||||
must prove that the connected peer matches the selected Verse, authority
|
||||
runtime, protocol, and route generation. TCP schema and content lanes use the
|
||||
portable CultNet session-open handshake. QUIC uses the exact Odin-bound route
|
||||
plus its TLS endpoint/certificate proof. A connector that returns bytes without
|
||||
authority proof is rejected; racing every endpoint in a Verse descriptor is
|
||||
not route selection.
|
||||
Before a schema, content, or realtime session becomes online, consumer-owned
|
||||
trust verifies an Odin-signed route certificate binding Verse, authority
|
||||
runtime, protocol set, endpoint, generation, validity interval, and provider
|
||||
P-256 key. Schema and content lanes then require a fresh client nonce signed by
|
||||
that provider key. QUIC uses the signed endpoint plus its TLS
|
||||
endpoint/certificate proof. A connector that returns bytes without this chain
|
||||
is rejected; racing every endpoint in a Verse descriptor is not route
|
||||
selection. Unsigned traffic exists only under an explicitly selected
|
||||
`LocalDevelopment` policy and only for in-process or loopback routes.
|
||||
|
||||
Route and session signatures use ECDSA P-256 with SHA-256 and fixed-width IEEE
|
||||
P1363 `r || s` encoding, matching browser WebCrypto. Their canonical
|
||||
transcripts are ordered UTF-8 fields prefixed by four-byte big-endian lengths;
|
||||
serializer bytes are never signature authority.
|
||||
|
||||
**Forbidden writers:** applications and renderers do not choose unadvertised
|
||||
endpoints, implement reconnect loops, or bypass verification. Schema messages
|
||||
|
|
@ -94,7 +101,8 @@ new seam does not pretend that migration has already occurred.
|
|||
## Security and release gate
|
||||
|
||||
The current TCP control and content connectors are plaintext and therefore
|
||||
restricted to local or otherwise trusted deployment. Adding TLS must not move
|
||||
restricted to explicit loopback development. They cannot carry an authenticated
|
||||
remote session. Adding TLS must not move
|
||||
discovery, authorization, content verification, or application semantics into
|
||||
the TCP adapter.
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue