Remove pre-1.0 audit and protected request scaffolding
This commit is contained in:
@@ -14,4 +14,4 @@ access.
|
||||
Semantic events come from bounded Run stdout/stderr console records. Unknown
|
||||
records create diagnostics and never produce fabricated events. DSNs, rows,
|
||||
connections, and credentials do not leave Run; request text is protected and
|
||||
redacted from browser and audit projections.
|
||||
redacted from browser and platform projections.
|
||||
|
||||
@@ -13,7 +13,7 @@ import (
|
||||
var errAdapterUnsupported = errors.New("runtime capability is unavailable")
|
||||
|
||||
// AuthorizedConfigPort is supplied through the platform-authorized Run channel.
|
||||
// It exposes logical, allowlisted configuration values only; it never exposes a
|
||||
// It exposes logical, declared configuration values only; it never exposes a
|
||||
// path, DSN, credential, arbitrary command, or database handle.
|
||||
type AuthorizedConfigPort interface {
|
||||
ReadConfig(context.Context) (map[string]string, error)
|
||||
@@ -25,7 +25,7 @@ type ConfigFieldPatch struct {
|
||||
}
|
||||
|
||||
// AuthorizedGameDataPort is a typed, Run-owned read/patch boundary. Implementations
|
||||
// must probe their local schema, use field allowlists and safe windows, and return
|
||||
// must probe their local schema, use declared fields and safe windows, and return
|
||||
// bounded snapshots rather than rows or connection details.
|
||||
type AuthorizedGameDataPort interface {
|
||||
ReadPlayerState(context.Context, string, []string) (PlayerStateSnapshot, error)
|
||||
@@ -109,11 +109,11 @@ type UE4SSNotificationPort interface {
|
||||
}
|
||||
type UE4SSNotificationReceipt struct{ Accepted bool }
|
||||
type ue4SSPlayerNotification struct {
|
||||
ServerID string
|
||||
RecipientSteamID string
|
||||
Message string
|
||||
chatType int
|
||||
protectedAuditCommand string
|
||||
ServerID string
|
||||
RecipientSteamID string
|
||||
Message string
|
||||
chatType int
|
||||
localCommandPreview string
|
||||
}
|
||||
type UE4SSVehicleSpawnPort interface {
|
||||
SpawnVehicle(context.Context, ue4SSVehicleSpawn) (UE4SSVehicleSpawnReceipt, error)
|
||||
@@ -128,9 +128,9 @@ const (
|
||||
|
||||
type UE4SSVehicleSpawnReceipt struct{ Outcome UE4SSVehicleSpawnOutcome }
|
||||
type ue4SSVehicleSpawn struct {
|
||||
ServerID string
|
||||
VehicleCode string
|
||||
protectedAuditCommand string
|
||||
ServerID string
|
||||
VehicleCode string
|
||||
localCommandPreview string
|
||||
}
|
||||
|
||||
// RuntimeAdapter is bound to one server. Availability is discovered from its
|
||||
@@ -312,13 +312,13 @@ func newUE4SSPlayerNotification(serverID, playerID, message string) (ue4SSPlayer
|
||||
if strings.TrimSpace(serverID) == "" || !steamID64(playerID) || !validNotificationMessage(message) {
|
||||
return ue4SSPlayerNotification{}, fmt.Errorf("invalid typed notification")
|
||||
}
|
||||
return ue4SSPlayerNotification{ServerID: serverID, RecipientSteamID: playerID, Message: message, chatType: fixedNotificationType, protectedAuditCommand: "SendChat 4 \"" + escapeUE4SSChatMessage(message) + "\" " + playerID}, nil
|
||||
return ue4SSPlayerNotification{ServerID: serverID, RecipientSteamID: playerID, Message: message, chatType: fixedNotificationType, localCommandPreview: "SendChat 4 \"" + escapeUE4SSChatMessage(message) + "\" " + playerID}, nil
|
||||
}
|
||||
func newUE4SSVehicleSpawn(serverID, vehicleCode string) (ue4SSVehicleSpawn, error) {
|
||||
if strings.TrimSpace(serverID) == "" || !supportedVehicleSpawnCode(vehicleCode) {
|
||||
return ue4SSVehicleSpawn{}, fmt.Errorf("invalid typed vehicle spawn")
|
||||
}
|
||||
return ue4SSVehicleSpawn{ServerID: serverID, VehicleCode: vehicleCode, protectedAuditCommand: "#spawnvehicle " + vehicleCode}, nil
|
||||
return ue4SSVehicleSpawn{ServerID: serverID, VehicleCode: vehicleCode, localCommandPreview: "#spawnvehicle " + vehicleCode}, nil
|
||||
}
|
||||
func steamID64(value string) bool {
|
||||
if len(value) != 17 {
|
||||
|
||||
@@ -105,13 +105,13 @@ func TestSupportedAdaptersDispatchThroughIsolatedTypedPorts(t *testing.T) {
|
||||
if err := dispatcher.DispatchOnce(context.Background()); err != nil {
|
||||
t.Fatalf("dispatch supported adapters: %v", err)
|
||||
}
|
||||
if len(port.notifications) != 1 || port.notifications[0].ServerID != "server-1" || port.notifications[0].protectedAuditCommand == "" {
|
||||
if len(port.notifications) != 1 || port.notifications[0].ServerID != "server-1" || port.notifications[0].localCommandPreview == "" {
|
||||
t.Fatalf("notification did not remain server-bound and idempotent: %+v", port.notifications)
|
||||
}
|
||||
if len(port.patches) != 1 || gateway.completed["config-read"][0].Payload["fields"].(map[string]string)["ServerName"] != "Moonlight" || gateway.completed["config-patch"][0].Payload["appliedFields"].(map[string]string)["ServerName"] != "Moonlight" || gateway.completed["notify"][0].Payload["accepted"] != true {
|
||||
t.Fatalf("supported adapters did not return their bounded successful results: patches=%+v completed=%+v", port.patches, gateway.completed)
|
||||
}
|
||||
if len(port.spawns) != 3 || port.spawns[0].protectedAuditCommand != "#spawnvehicle BPC_Laika_C" || port.spawns[1].protectedAuditCommand != "#spawnvehicle BPC_WolfsWagen_C" || port.spawns[2].protectedAuditCommand != "#spawnvehicle BPC_Laika_C" {
|
||||
if len(port.spawns) != 3 || port.spawns[0].localCommandPreview != "#spawnvehicle BPC_Laika_C" || port.spawns[1].localCommandPreview != "#spawnvehicle BPC_WolfsWagen_C" || port.spawns[2].localCommandPreview != "#spawnvehicle BPC_Laika_C" {
|
||||
t.Fatalf("vehicle adapter did not use only fixed private templates: %+v", port.spawns)
|
||||
}
|
||||
if gateway.completed["spawn-success"][0].Payload["outcome"] != "succeeded" || gateway.completed["spawn-failed"][0].Payload["outcome"] != "failed" || gateway.completed["spawn-unknown"][0].Payload["outcome"] != "unknown" {
|
||||
@@ -173,8 +173,8 @@ func TestSupportedAdapterTransportFailuresCompleteWithoutProtectedOutput(t *test
|
||||
t.Fatalf("%s did not redact failed typed-port output: %+v", id, result)
|
||||
}
|
||||
}
|
||||
if len(port.notifications) != 1 || port.notifications[0].protectedAuditCommand == "" {
|
||||
t.Fatalf("notification fixture did not receive one protected typed request: %+v", port.notifications)
|
||||
if len(port.notifications) != 1 || port.notifications[0].localCommandPreview == "" {
|
||||
t.Fatalf("notification fixture did not receive one typed request: %+v", port.notifications)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -197,10 +197,10 @@ func TestUE4SSNotificationIsTypedAndRedacted(t *testing.T) {
|
||||
t.Fatalf("typed notification was not delivered: result=%+v err=%v deliveries=%+v", result, err, port.deliveries)
|
||||
}
|
||||
delivery := port.deliveries[0]
|
||||
if delivery.ServerID != "server-1" || delivery.chatType != fixedNotificationType || delivery.protectedAuditCommand != "SendChat 4 \"Moon \\\"gift\\\"\" 76561198000000001" {
|
||||
if delivery.ServerID != "server-1" || delivery.chatType != fixedNotificationType || delivery.localCommandPreview != "SendChat 4 \"Moon \\\"gift\\\"\" 76561198000000001" {
|
||||
t.Fatalf("notification did not use the fixed UE4SS contract: %+v", delivery)
|
||||
}
|
||||
if result["message"] == delivery.protectedAuditCommand || result["command"] != nil || result["rcon"] != nil {
|
||||
if result["message"] == delivery.localCommandPreview || result["command"] != nil || result["rcon"] != nil {
|
||||
t.Fatalf("notification leaked protected transport details: %+v", result)
|
||||
}
|
||||
}
|
||||
@@ -230,7 +230,7 @@ func TestNotificationFailureIsCachedWithoutInvokingRewardDelivery(t *testing.T)
|
||||
}
|
||||
}
|
||||
|
||||
func TestVersionedVehicleSpawnUsesFixedTemplateAndPrivateAuditOnly(t *testing.T) {
|
||||
func TestVersionedVehicleSpawnUsesFixedTemplateAndPrivatePreviewOnly(t *testing.T) {
|
||||
port := &nonProductionVehicleSpawnPortFixture{receipt: UE4SSVehicleSpawnReceipt{Outcome: UE4SSVehicleSpawnAccepted}}
|
||||
adapter := RuntimeAdapter{BoundServerID: "server-1", VehicleSpawn: port}
|
||||
result, err := adapter.SpawnVehicle(context.Background(), map[string]any{"vehicleCode": "BPC_Laika_C"})
|
||||
@@ -238,10 +238,10 @@ func TestVersionedVehicleSpawnUsesFixedTemplateAndPrivateAuditOnly(t *testing.T)
|
||||
t.Fatalf("fixed vehicle spawn was not delivered: result=%+v err=%v requests=%+v", result, err, port.requests)
|
||||
}
|
||||
request := port.requests[0]
|
||||
if request.ServerID != "server-1" || request.VehicleCode != "BPC_Laika_C" || request.protectedAuditCommand != "#spawnvehicle BPC_Laika_C" {
|
||||
if request.ServerID != "server-1" || request.VehicleCode != "BPC_Laika_C" || request.localCommandPreview != "#spawnvehicle BPC_Laika_C" {
|
||||
t.Fatalf("vehicle spawn did not use the fixed template: %+v", request)
|
||||
}
|
||||
if result["command"] != nil || result["rcon"] != nil || result["audit"] != nil || result["outcome"] == request.protectedAuditCommand {
|
||||
if result["command"] != nil || result["rcon"] != nil || result["outcome"] == request.localCommandPreview {
|
||||
t.Fatalf("vehicle spawn leaked protected transport details: %+v", result)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -112,7 +112,7 @@ func TestRunOneShotSmokeLeavesUnsupportedCommandUnackedAndUnexecuted(t *testing.
|
||||
return jsonHTTPResponse(http.StatusOK, heartbeatResponse{Accepted: true, InstallationID: config.Component.InstallationID, Status: "online", Health: "healthy", NextHeartbeatSeconds: 30, SessionExpiresAt: sessionExpiry, ServerTime: stamp}), nil
|
||||
case 2:
|
||||
step++
|
||||
return jsonHTTPResponse(http.StatusOK, claimResponse{Items: []ClaimedCommand{{ID: "unsupported-1", ProfileKey: ProfileKey, CommandType: "announcement.send", Payload: map[string]any{"message": "must not execute"}, FencingToken: 18, LeaseExpiresAt: stamp.Add(time.Minute), ExpiresAt: stamp.Add(5 * time.Minute)}}, Count: 1}), nil
|
||||
return jsonHTTPResponse(http.StatusOK, claimResponse{Items: []ClaimedCommand{{ID: "unsupported-1", ProfileKey: ProfileKey, CommandType: "diagnostic.unsupported", Payload: map[string]any{"message": "must not execute"}, FencingToken: 18, LeaseExpiresAt: stamp.Add(time.Minute), ExpiresAt: stamp.Add(5 * time.Minute)}}, Count: 1}), nil
|
||||
default:
|
||||
return nil, fmt.Errorf("unsupported command triggered transport: %s", request.URL.Path)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user