Extract shared contract, drop BinaryFormatter wire, modernize to net8/x64

Make the Console<->Launcher system source-built and modern now that the console
is under our control and the WinXP-era pods are gone.

Contract extraction (Contract/Tesla.Contract.csproj):
- One multi-targeted (net48;net8.0-windows) source project for the RPC contract,
  replacing the vendored TeslaConsoleLaunchLib.dll and the hand-synced Tesla.Net
  replica in Launcher/LaunchModels_Shared.cs. Emits assembly TeslaConsoleLaunchLib.

SecureConfig extraction (SecureConfig/Tesla.SecureConfig.csproj):
- net48 source of the first-boot provisioning protocol (UDP beacons, OFB crypto,
  RSA key exchange), replacing the vendored TeslaSecureConfiguration.dll.

Remove BinaryFormatter from the wire (RCE sink + the reason net6 was pinned):
- Console<->Launcher RPC is now length-prefixed System.Text.Json frames
  (Contract/PodRpcProtocol.cs) over the unchanged OFB transport; dispatch by
  method name. Deleted the SerializationBinder / MethodInfoProxy machinery.
- Console-local BinaryFormatter (Site config, mission replays) intentionally
  retained: local net48 file I/O, not the network surface.

Runtime modernization:
- Launcher Service + Agent: net6 -> net8, win-x86 -> win-x64 (all pods are
  64-bit Win10). Kept the SHA1-default PBKDF2 (Console key-derivation compat)
  with SYSLIB0041 suppressed and documented.

Tests: differential suite now 73 green. Added SecureConfigCompatTests (OFB
ciphertext byte-identical to the vendored DLL) and PodRpcProtocolTests (JSON
round-trip of every request/response shape); removed the now-obsolete
BinaryFormatter byte-identity guard.

Build hygiene: per-project obj dirs (Launcher/Directory.Build.props) fix a
NuGet restore collision between the two Launcher projects sharing one folder.

NOT runtime-verified against a live pod.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Cyd
2026-06-30 08:15:17 -05:00
co-authored by Claude Opus 4.8
parent 548550b312
commit b9d8027cf6
19 changed files with 2441 additions and 393 deletions
+8 -97
View File
@@ -1,105 +1,16 @@
// =============================================================================
// TeslaLauncher — Shared Models
// TeslaLauncher — Shared IPC Models
// =============================================================================
// Wire types (Tesla.Net): BinaryFormatter-compatible replicas of the original
// structs from TeslaConsoleLaunchLib.dll. Field names, types, and order must
// match exactly for serialization compatibility.
// IPC types (Tesla.Launcher.Shared): JSON messages between the Windows Service
// and the user-session Agent over a Named Pipe. These never touch the Console
// TCP connection.
//
// IPC types (Tesla.Launcher.Shared): JSON messages between Service and Agent
// over Named Pipe. These never touch the Console TCP connection.
// The BinaryFormatter wire types (Tesla.Net: LaunchData, InvokeCommand, ...)
// formerly replicated here by hand now live in the shared Tesla.Contract project
// (assembly TeslaConsoleLaunchLib), referenced by the Service. This file is also
// compiled into the Agent, which uses only the IPC types below.
// =============================================================================
using System;
using System.Reflection;
using System.Runtime.Serialization;
namespace Tesla.Net
{
/// <summary>RPC command from TeslaConsole. Function is a MethodBase of ILauncherService.</summary>
[Serializable]
public struct InvokeCommand
{
public MethodBase Function;
public object[] Parameters;
}
/// <summary>RPC result returned to TeslaConsole.</summary>
[Serializable]
public struct InvokeResult
{
public object Result;
public Exception Exception;
public TimeSpan CallDuration;
}
/// <summary>App identifier + display name pair.</summary>
[Serializable]
public struct LaunchPair
{
public Guid LaunchKey;
public string DisplayName;
}
/// <summary>Describes one launchable simulation application.</summary>
[Serializable]
public struct LaunchData
{
public LaunchPair LaunchPair;
public string WorkingDirectory;
public string ExeFile;
public string Arguments;
public bool AutoRestart;
}
/// <summary>Tracks a currently running simulation process.</summary>
[Serializable]
public struct LaunchedAppData
{
public int ProcessId;
public Guid LaunchKey;
}
/// <summary>Complete pod state snapshot for FullUpdate RPC.</summary>
[Serializable]
public struct FullUpdateData
{
public LaunchData[] InstalledApps;
public LaunchedAppData[] LaunchedApps;
public float VolumeLevel;
}
/// <summary>Progress of an out-of-band product installation.</summary>
[Serializable]
public struct OutOfBandProgress
{
public int PercentComplete;
public string Status;
public bool IsCompleted;
}
/// <summary>Interface for BinaryFormatter MethodBase resolution. Signatures must match the original exactly.</summary>
public interface ILauncherService
{
float VolumeLevel { get; set; }
void ClearStore();
DateTime Ping(DateTime now);
Guid InitiateInstallProduct();
OutOfBandProgress GetOutOfBandProgress(Guid invokeCallId);
int LaunchApp(Guid launchKey);
LaunchPair[] GetLaunchableApps();
void KillApp(Guid launchKey, int processId);
void KillAllOfType(Guid launchKey);
void KillAllApps();
void Shutdown(bool restart);
LaunchedAppData[] GetLaunchedApps();
LaunchData[] GetInstalledApps();
void RemoveApp(Guid index);
void InstallApp(LaunchData data);
void UninstallApp(Guid launchKey);
FullUpdateData FullUpdate();
}
}
namespace Tesla.Launcher.Shared
{
/// <summary>Command forwarded from the Windows Service to the Userspace Agent.</summary>