Prove EveUnity receipt trust boundaries

This commit is contained in:
Meta Vens 2026-08-26 21:03:27 +02:00
commit d1663b36d1
3 changed files with 53 additions and 6 deletions

View file

@ -289,6 +289,53 @@ namespace GameCult.Eve.UnityScene.Tests
Assert.That(observed, Is.Empty);
}
[TestCase("provider", "other.provider")]
[TestCase("surface", "other.surface")]
[TestCase("authority", "other.runtime")]
[TestCase("state", "mysterious")]
public void UntrustedReceiptCannotRetireOrPublishTheCommand(string field, string value)
{
using var transport = new EveUnityCultMeshLiveProviderTransport(
"test-cache",
"cultnet+tcp://127.0.0.1:1",
"test.verse",
"test.runtime",
"test.provider",
"test.surface");
var request = Request("launch-untrusted", "launch");
var type = typeof(EveUnityCultMeshLiveProviderTransport);
var pending = (IDictionary<string, EveSurfaceCommandRequest>)type.GetField(
"_pendingCommands",
BindingFlags.NonPublic | BindingFlags.Instance)!.GetValue(transport)!;
var publish = type.GetMethod("PublishReceipt", BindingFlags.NonPublic | BindingFlags.Instance)!;
pending.Add(request.CommandId, request);
var observed = new List<EveUnitySceneCommandReceipt>();
transport.CommandReceiptAvailable += observed.Add;
var providerId = field == "provider" ? value : request.ProviderId;
var surfaceId = field == "surface" ? value : request.SurfaceId;
var authority = field == "authority" ? value : "test.runtime";
var state = field == "state" ? value : "accepted";
var receipt = new EveCommandReceiptDocument(
"receipt-untrusted-" + field,
request.CommandId,
request.Command,
state,
"AetheriaEve",
authority,
providerId,
surfaceId,
"",
DateTimeOffset.UtcNow.ToString("O"),
1,
invocationHash: EveCommandInvocationHash.Compute(request));
publish.Invoke(transport, new object[] { receipt });
Assert.That(pending.ContainsKey(request.CommandId), Is.True);
Assert.That(observed, Is.Empty);
}
[Test]
public void ProviderSelectionCarriesStableIdentityWithoutExposingAPhysicalRoute()
{

View file

@ -5,7 +5,7 @@
"unity": "2021.3",
"description": "Unity UI Toolkit lowering for gamecult.eve.surface.v1 documents.",
"dependencies": {
"org.gamecult.eve.surface": "0.3.5"
"org.gamecult.eve.surface": "0.3.6"
},
"keywords": [
"Eve",