#requires -Version 7.0
param([ValidateSet('Debug','Release')][string]$Configuration = 'Release', [string]$ServerPath, [string]$InventoryFixture)
$ErrorActionPreference = 'Stop'
$taskRoot = [IO.Path]::GetFullPath((Join-Path $PSScriptRoot '..'))
if ($ServerPath) { $exe = [IO.Path]::GetFullPath($ServerPath) }
else {
$taskBuildRoot = Join-Path $taskRoot ('artifacts/smoke-build/' + [Guid]::NewGuid().ToString('N'))
dotnet build (Join-Path $taskRoot 'Server/XFEWarframe.Server/XFEWarframe.Server.csproj') -c $Configuration ("-p:OutputPath=" + $taskBuildRoot + [IO.Path]::DirectorySeparatorChar) --nologo -v quiet
if ($LASTEXITCODE -ne 0) { throw 'Smoke-test build failed' }
$exe = Join-Path $taskBuildRoot 'XFEWarframe.Server.exe'
}
if (-not (Test-Path -LiteralPath $exe -PathType Leaf)) { throw 'Server executable not found' }
$root = Join-Path $taskRoot ('artifacts/http-smoke-' + [Guid]::NewGuid().ToString('N'))
New-Item -ItemType Directory -Path $root -Force | Out-Null
$taskAssets = Join-Path $root 'assets'
New-Item -ItemType Directory -Path $taskAssets -Force | Out-Null
[IO.File]::WriteAllBytes((Join-Path $taskAssets 'H.Cache.bin'), [byte[]]@(0, 255, 1, 128, 10, 13))
$probe = [Net.Sockets.TcpListener]::new([Net.IPAddress]::Loopback, 0)
$probe.Start()
$port = $probe.LocalEndpoint.Port
$probe.Stop()
$probe.Start()
$gamePort = $probe.LocalEndpoint.Port
$probe.Stop()
$probe.Start()
$ircPort = $probe.LocalEndpoint.Port
$probe.Stop()
$probe.Start()
$ircTlsPort = $probe.LocalEndpoint.Port
$probe.Stop()
$origin = "http://127.0.0.1:$port"
$server = Start-Process -FilePath $exe -ArgumentList @('"--root=' + $root + '"', "--port=$port", "--game-port=$gamePort", "--irc-port=$ircPort", "--irc-tls-port=$ircTlsPort") -WindowStyle Hidden -PassThru -RedirectStandardOutput (Join-Path $root 'stdout.log') -RedirectStandardError (Join-Path $root 'stderr.log')
$handler = [Net.Http.HttpClientHandler]::new()
# Only the isolated loopback test fixture uses this self-signed TLS exception.
$handler.ServerCertificateCustomValidationCallback = [Net.Http.HttpClientHandler]::DangerousAcceptAnyServerCertificateValidator
$client = [Net.Http.HttpClient]::new($handler)
$client.Timeout = [TimeSpan]::FromSeconds(20)
$checks = [Collections.Generic.List[object]]::new()
function Check([bool]$Condition, [string]$Name) {
if (-not $Condition) { throw "FAILED: $Name" }
$checks.Add(@{name=$Name; passed=$true})
Write-Output "PASS $Name"
}
function Request([string]$Path, [string]$Method = 'GET', [string]$Json, [switch]$Admin, [switch]$Gzip, [switch]$Tls) {
$requestOrigin = if($Tls) { "https://127.0.0.1:$gamePort" } else { $origin }
$message = [Net.Http.HttpRequestMessage]::new([Net.Http.HttpMethod]::new($Method), ($requestOrigin + $Path))
if ($Admin) { $message.Headers.Authorization = [Net.Http.Headers.AuthenticationHeaderValue]::new('Bearer', $script:adminToken) }
if ($PSBoundParameters.ContainsKey('Json')) {
$body = [Text.Encoding]::UTF8.GetBytes($Json)
if ($Gzip) {
$buffer = [IO.MemoryStream]::new()
$zip = [IO.Compression.GZipStream]::new($buffer, [IO.Compression.CompressionMode]::Compress, $true)
$zip.Write($body); $zip.Dispose(); $body = $buffer.ToArray(); $buffer.Dispose()
}
$message.Content = [Net.Http.ByteArrayContent]::new($body)
$message.Content.Headers.ContentType = [Net.Http.Headers.MediaTypeHeaderValue]::new('application/octet-stream')
if ($Gzip) { $message.Content.Headers.ContentEncoding.Add('gzip') }
}
try {
$response = $client.SendAsync($message).GetAwaiter().GetResult()
try {
$bytes = $response.Content.ReadAsByteArrayAsync().GetAwaiter().GetResult()
return @{Status=[int]$response.StatusCode; Body=[Text.Encoding]::UTF8.GetString($bytes); Bytes=$bytes; ContentType=$response.Content.Headers.ContentType.MediaType}
} finally { $response.Dispose() }
} finally { $message.Dispose() }
}
try {
$ready = $false
for ($i = 0; $i -lt 40; $i++) {
if ($server.HasExited) { throw 'Server exited during startup' }
try { if ((Request '/health').Status -eq 200) { $ready = $true; break } } catch { }
Start-Sleep -Milliseconds 250
}
Check $ready 'ServerInteractive HTTP listener starts'
Check ((Request '/health' -Tls).Status -eq 200) 'Game HTTPS listener completes TLS handshake'
$script:adminToken = (Get-Content -LiteralPath (Join-Path $root 'server.json') -Raw | ConvertFrom-Json).AdminToken
Check ((Request '/control/v1/accounts').Status -eq 401) 'Management rejects missing token'
Check ((Request '/control/v1/snapshot' -Admin).Status -eq 200) 'Bearer management authentication'
Check ((Request '/control/v1/news' -Admin).Status -eq 200 -and (Request '/control/v1/messages' -Admin).Status -eq 200) 'News and mail routes are available'
$registration = Request '/player/v1/register' 'POST' '{"email":"portal@example.invalid","password":"PortalTest-123","displayName":"Portal","signIn":false}'
Check ($registration.Status -eq 201 -and -not ($registration.Body | ConvertFrom-Json).token) 'Desktop registration does not sign in'
$portalLogin = Request '/player/v1/login' 'POST' '{"email":"portal@example.invalid","password":"PortalTest-123"}'
Check ($portalLogin.Status -eq 200 -and ($portalLogin.Body | ConvertFrom-Json).token.Length -eq 64) 'Desktop login over HTTP'
Add-Type -LiteralPath (Join-Path (Split-Path $exe) 'BouncyCastle.Cryptography.dll')
$digest = [Org.BouncyCastle.Crypto.Digests.WhirlpoolDigest]::new()
$passwordBytes = [Text.Encoding]::UTF8.GetBytes('PortalTest-123')
$digest.BlockUpdate($passwordBytes, 0, $passwordBytes.Length)
$hashBytes = [byte[]]::new($digest.GetDigestSize()); [void]$digest.DoFinal($hashBytes, 0)
$gameBody = @{email='portal@example.invalid';password=[Convert]::ToHexString($hashBytes).ToLowerInvariant();ClientType='Windows';kick=$true} | ConvertTo-Json -Compress
$gameBuild = '2026.08.19.11.06/SakCydygO6-qG7S-xI5diQ'
$gameLogin = Request ("/api/login.php?buildLabel=$gameBuild&clientMod=XFEWarframe") 'POST' $gameBody -Gzip -Tls
Check ($gameLogin.Status -eq 200) 'Same desktop account signs into game over HTTPS with gzip and full build identity'
$gameSession = $gameLogin.Body | ConvertFrom-Json
Check ($gameSession.BuildLabel -eq $gameBuild -and -not $gameSession.PSObject.Properties['DTLS']) 'Game login retains manifest hash and omits unsupported DTLS field'
if ($InventoryFixture) {
$fixtureJson = [IO.File]::ReadAllText([IO.Path]::GetFullPath($InventoryFixture))
$fixture = $fixtureJson | ConvertFrom-Json
$fixtureAccount = '/control/v1/accounts/' + $gameSession.id
Check ((Request ($fixtureAccount + '/import') 'POST' ('{"inventory":' + $fixtureJson + '}') -Admin).Status -eq 200) 'Imported inventory copy loads in isolated account'
Check ((Request ($fixtureAccount + '/tutorial') 'POST' '{"skipTutorial":true}' -Admin).Status -eq 200) 'Tutorial skipping applies to imported inventory'
$fixtureResult = Request ('/api/inventory.php?accountId=' + $gameSession.id + '&nonce=' + $gameSession.Nonce) -Tls
Check ($fixtureResult.Status -eq 200) 'Imported inventory can be read with real game session over TLS'
$fixtureInventory = $fixtureResult.Body | ConvertFrom-Json
Check ($fixtureInventory.ReceivedStartingGear -and $fixtureInventory.Suits.Count -eq $fixture.Suits.Count -and $fixtureInventory.LoadOutPresets.NORMAL.Count -eq $fixture.LoadOutPresets.NORMAL.Count) 'Imported suits and loadouts survive tutorial skipping'
$fixtureShip = Request ('/api/getShip.php?accountId=' + $gameSession.id + '&nonce=' + $gameSession.Nonce) -Tls
$fixtureFeatures = ($fixtureShip.Body | ConvertFrom-Json).Ship.Features
Check ($fixtureShip.Status -eq 200 -and $fixtureFeatures -contains '/Lotus/Types/Items/ShipFeatureItems/ArsenalFeatureItem' -and $fixtureFeatures -contains '/Lotus/Types/Items/ShipFeatureItems/FoundryFeatureItem') 'Completed imported quests restore arsenal and foundry modules'
}
$page = Request '/webui/'
Check ($page.Status -eq 404 -and $page.ContentType -eq 'application/json') 'Web page is not served'
Check ((Request '/api/login.php' 'POST' '{broken').Status -eq 400) 'Malformed game body returns 400'
$login = Request '/api/login.php' 'POST' '{"email":"smoke@test.local","password":"test-client-digest","ClientType":"Windows","kick":true}' -Gzip
Check ($login.Status -eq 200) 'Gzip octet-stream game login'
$account = $login.Body | ConvertFrom-Json
Check ($account.IRC.Count -eq 1 -and $account.IRC[0] -eq "127.0.0.1:$ircTlsPort") 'Game login advertises the integrated chat host and overridden port'
if (-not ('XFEChatSmoke' -as [type])) {
Add-Type -TypeDefinition @'
using System;
using System.IO;
using System.Net.Security;
using System.Net.Sockets;
using System.Security.Authentication;
using System.Security.Cryptography;
using System.Text;
public static class XFEChatSmoke
{
private sealed class Peer : IDisposable
{
private readonly TcpClient socket;
private readonly Stream stream;
private readonly StreamReader reader;
private readonly StreamWriter writer;
public Peer(int port, bool tls, string id, string nonce, string name, byte[] nativeKey = null)
{
socket = new TcpClient("127.0.0.1", port);
stream = socket.GetStream();
if (tls)
{
// Only this isolated loopback fixture trusts the generated test certificate.
var ssl = new SslStream(stream, false, (sender, certificate, chain, errors) => true);
ssl.AuthenticateAsClient("localhost", null, SslProtocols.Tls12, false); stream = ssl;
}
stream.ReadTimeout = 5000; stream.WriteTimeout = 5000;
reader = new StreamReader(stream, new UTF8Encoding(false));
writer = new StreamWriter(stream, new UTF8Encoding(false)) { AutoFlush = true, NewLine = "\r\n" };
var notice = Expect("skipping identd");
var challenge = Convert.ToUInt32(notice.Substring(notice.IndexOf("Auth ") + 5, 8), 16);
Send("NICK " + name + "\ue000"); Send("USER " + id + " 0 * " + (nativeKey == null ? "nonce=" + nonce : NativeProof(id, nonce, challenge, nativeKey)));
Expect(" 001 "); Expect(" 305 "); Expect(" 422 ");
Send("JOIN #Gsmoke"); Expect(" 366 ");
}
public void Send(string line) { writer.WriteLine(line); }
public string Expect(string marker)
{
for (int i = 0; i < 100; ++i)
{
var line = reader.ReadLine();
if (line == null) throw new IOException("IRC connection closed before expected reply");
if (line.Contains(marker)) return line;
}
throw new IOException("Expected IRC reply not received");
}
public void Dispose() { socket.Dispose(); }
}
public static void Run(int port, int tlsPort, string firstId, string firstNonce, string firstName, string secondId, string secondNonce, string secondName)
{
using (var first = new Peer(tlsPort, true, firstId, firstNonce, firstName))
using (var second = new Peer(port, false, secondId, secondNonce, secondName))
{
first.Send("PRIVMSG #Gsmoke :星际通讯验证"); second.Expect("PRIVMSG #Gsmoke :星际通讯验证");
second.Send("PRIVMSG " + firstName + "\ue000 :私聊验证"); first.Expect("PRIVMSG " + firstName + "\ue000 :私聊验证");
first.Send("PING :smoke-ready"); first.Expect(" PONG XFEWarframe :smoke-ready");
}
}
private static string NativeProof(string id, string nonce, uint challenge, byte[] key)
{
const uint seed = 0x12345678;
int firstSplit = (int)(challenge % key.Length), secondSplit = (int)(seed % key.Length);
byte[][] parts = { key.AsSpan(0, firstSplit).ToArray(), key.AsSpan(firstSplit).ToArray(), Encoding.UTF8.GetBytes("accountId=" + id + "&nonce=" + nonce), key.AsSpan(0, secondSplit).ToArray(), key.AsSpan(secondSplit).ToArray() };
using (var first = new MemoryStream()) using (var second = new MemoryStream())
{
for (int i = 0; i < 17; ++i) { var bytes = parts[i % 5]; (i % 2 == 0 ? first : second).Write(bytes, 0, bytes.Length); }
var a = MD5.HashData(first.ToArray()); var b = MD5.HashData(second.ToArray()); var proof = new byte[20];
System.Buffers.Binary.BinaryPrimitives.WriteUInt32BigEndian(proof, seed);
for (int i = 0; i < 16; ++i) proof[i + 4] = (byte)(a[i] ^ b[i]);
return Convert.ToHexString(proof).ToLowerInvariant();
}
}
public static void RunNative(int tlsPort, string id, string nonce, string name, string key)
{
using (var peer = new Peer(tlsPort, true, id, nonce, name, Convert.FromBase64String(key)))
{ peer.Send("PING :native-ready"); peer.Expect(" PONG XFEWarframe :native-ready"); }
}
}
'@
}
[XFEChatSmoke]::Run($ircPort, $ircTlsPort, $gameSession.id, [string]$gameSession.Nonce, $gameSession.DisplayName, $account.id, [string]$account.Nonce, $account.DisplayName)
Check $true 'Integrated TCP/TLS chat authenticates actual HTTP sessions and delivers Chinese channel/private messages'
$nativeLogin = Request ("/api/login.php?buildLabel=$gameBuild&clientMod=XFEWarframe") 'POST' $gameBody -Gzip -Tls
$nativeSession = $nativeLogin.Body | ConvertFrom-Json
$nativeKey = (Get-Content (Join-Path $taskRoot 'Server/data/irc-auth.json') -Raw | ConvertFrom-Json).KeyBase64
[XFEChatSmoke]::RunNative($ircTlsPort, $nativeSession.id, [string]$nativeSession.Nonce, $nativeSession.DisplayName, $nativeKey)
Check $true 'Native game challenge proof authenticates an actual game login from ServerInteractive'
$query = '?accountId=' + $account.id + '&nonce=' + $account.Nonce
$save = Request ('/api/saveSettings.php' + $query) 'POST' '{"Settings":{"FieldOfView":95}}'
Check ($save.Status -eq 200) 'Raw JSON game settings upload'
$inventory = Request ('/api/inventory.php' + $query)
Check ($inventory.Status -eq 200 -and ($inventory.Body | ConvertFrom-Json).Settings.FieldOfView -eq 95) 'Persisted inventory over HTTP'
Check ((Request ('/api/inventory.php?accountId=' + $account.id + '&nonce=1')).Status -eq 401) 'Game rejects wrong nonce'
$worldResponse = Request '/cdn/worldState.php'
Check ($worldResponse.Status -eq 200) 'CDN world-state alias executes C# generator'
$world = $worldResponse.Body | ConvertFrom-Json
Check ($world.ActiveMissions.Count -gt 0 -and $world.Sorties.Count -gt 0 -and $world.Conquests.Count -gt 0 -and $world.Descents.Count -gt 0) 'World rotations, fissures, sorties, conquests and descents'
$routes = (Request '/control/v1/routes' -Admin).Body | ConvertFrom-Json
Check ($routes.Count -eq 332 -and @($routes | Where-Object Status -eq 'pending').Count -eq 0) 'All 332 route definitions have native handlers'
$descentBody = '{"Mode":"r","Category":"DM_COH_NORMAL"}'
$descent = Request ('/api/descentRewards.php' + $query) 'POST' $descentBody
Check ($descent.Status -eq 200 -and $descent.Body -eq (Request ('/api/descentRewards.php' + $query) 'POST' $descentBody).Body) 'Weekly reward selection is stable across retries'
$blessingBody = '{"Mode":"s","Category":"DM_COH_NORMAL","SelectedUpgrades":["","selection-identifier","other/identifier",""]}'
$blessing = Request ('/api/descentRewards.php' + $query) 'POST' $blessingBody -Gzip -Tls
$blessingData = $blessing.Body | ConvertFrom-Json
Check ($blessing.Status -eq 200 -and $blessingData.SelectedUpgrades.Count -eq 4 -and $blessingData.SelectedUpgrades[0] -ceq '' -and $blessingData.SelectedUpgrades[1] -ceq 'selection-identifier' -and $blessingData.SelectedUpgrades[2] -ceq 'other/identifier' -and $blessingData.SelectedUpgrades[3] -ceq '') 'Gzip HTTPS descent selection preserves opaque identifiers and indexed empty positions'
$blessingRetry = Request ('/api/descentRewards.php' + $query) 'POST' $blessingBody -Gzip -Tls
Check ($blessingRetry.Status -eq 200 -and $blessingRetry.Body -ceq $blessing.Body) 'Descent blessing retry echoes the same seed, rewards and selection'
$blessingInventory = (Request ('/api/inventory.php' + $query) -Tls).Body | ConvertFrom-Json
$storedBlessing = @($blessingInventory.DescentRewards | Where-Object Category -eq DM_COH_NORMAL)[0]
Check (($storedBlessing.SelectedUpgrades | ConvertTo-Json -Compress) -ceq ($blessingData.SelectedUpgrades | ConvertTo-Json -Compress)) 'Descent blessing identifiers persist through a real inventory request'
$unlock = Request ('/api/entratiLabConquestMode.php' + $query) 'POST' '{"BuyMode":1}'
Check ($unlock.Status -eq 200 -and ($unlock.Body | ConvertFrom-Json).EntratiVaultCountLastPeriod -eq 2) 'Conquest unlock consumes two search pulses'
$retry = Request ('/api/entratiLabConquestMode.php' + $query) 'POST' '{"BuyMode":1}'
Check ($unlock.Body -eq $retry.Body) 'Repeated conquest unlock does not charge again'
$invalid = Request ('/api/modularWeaponCrafting.php' + $query) 'POST' '{"WeaponType":"/Lotus/Weapons/Ostron/Melee/LotusModularWeapon","Parts":["a","b","c"]}'
Check ($invalid.Status -eq 400) 'Invalid modular crafting is rejected'
$cache = Request '/origin/Windows/1/H.Cache.bin'
Check ($cache.Status -eq 200 -and [Convert]::ToBase64String($cache.Bytes) -eq 'AP8BgAoN') 'Local game cache is served byte-exact'
Check ((Request '/SplitCaches/missing.bin').Status -eq 404) 'Absent game assets return 404'
$pe = Request '/PublicExport/Manifest/ExportWarframes_zh.json!smoke'
Check ($pe.Status -eq 200 -and ($pe.Body | ConvertFrom-Json).ExportWarframes.Count -gt 100) 'Chinese PublicExport client shape'
$index = Request '/PublicExport/index_zh.txt.lzma'
$expected = [IO.File]::ReadAllBytes((Join-Path $taskRoot 'Server/data/fixed_responses/PublicExport/index_zh.txt.lzma'))
Check ($index.Status -eq 200 -and [Convert]::ToBase64String($index.Bytes) -eq [Convert]::ToBase64String($expected)) 'PublicExport binary is byte-exact'
$logs = Request '/control/v1/logs' -Admin
Check (-not $logs.Body.Contains('test-client-digest') -and -not $logs.Body.Contains($script:adminToken) -and -not $logs.Body.Contains('nonce=')) 'Request logs redact credentials'
$shutdown = Request '/control/v1/shutdown' 'POST' '{}' -Admin
Check ($shutdown.Status -eq 200 -and $server.WaitForExit(5000)) 'Graceful management shutdown'
Check ($server.ExitCode -eq 0) 'Console exits successfully'
$chatLogs = [IO.File]::ReadAllText((Join-Path $root 'stdout.log'))
Check (-not $chatLogs.Contains([string]$gameSession.Nonce) -and -not $chatLogs.Contains('星际通讯验证') -and -not $chatLogs.Contains('私聊验证')) 'Chat logs omit credentials and message bodies'
foreach ($releasedPort in @($ircPort, $ircTlsPort)) {
$releasedProbe = [Net.Sockets.TcpListener]::new([Net.IPAddress]::Loopback, $releasedPort)
try { $releasedProbe.Start() } finally { $releasedProbe.Stop() }
}
Check $true 'Graceful shutdown releases both IRC listeners'
$checks | ConvertTo-Json | Set-Content -LiteralPath (Join-Path $root 'results.json') -Encoding utf8
Write-Output "HTTP smoke results: $root"
} finally {
$client.Dispose()
if (-not $server.HasExited) { Stop-Process -Id $server.Id -ErrorAction SilentlyContinue }
$server.Dispose(); $script:adminToken = $null
}
#requires -Version 7.0
param([ValidateSet('Debug','Release')][string]$Configuration = 'Release', [string]$ServerPath, [string]$InventoryFixture)
$ErrorActionPreference = 'Stop'
$taskRoot = [IO.Path]::GetFullPath((Join-Path $PSScriptRoot '..'))
if ($ServerPath) { $exe = [IO.Path]::GetFullPath($ServerPath) }
else {
$taskBuildRoot = Join-Path $taskRoot ('artifacts/smoke-build/' + [Guid]::NewGuid().ToString('N'))
dotnet build (Join-Path $taskRoot 'Server/XFEWarframe.Server/XFEWarframe.Server.csproj') -c $Configuration ("-p:OutputPath=" + $taskBuildRoot + [IO.Path]::DirectorySeparatorChar) --nologo -v quiet
if ($LASTEXITCODE -ne 0) { throw 'Smoke-test build failed' }
$exe = Join-Path $taskBuildRoot 'XFEWarframe.Server.exe'
}
if (-not (Test-Path -LiteralPath $exe -PathType Leaf)) { throw 'Server executable not found' }
$root = Join-Path $taskRoot ('artifacts/http-smoke-' + [Guid]::NewGuid().ToString('N'))
New-Item -ItemType Directory -Path $root -Force | Out-Null
$taskAssets = Join-Path $root 'assets'
New-Item -ItemType Directory -Path $taskAssets -Force | Out-Null
[IO.File]::WriteAllBytes((Join-Path $taskAssets 'H.Cache.bin'), [byte[]]@(0, 255, 1, 128, 10, 13))
$probe = [Net.Sockets.TcpListener]::new([Net.IPAddress]::Loopback, 0)
$probe.Start()
$port = $probe.LocalEndpoint.Port
$probe.Stop()
$probe.Start()
$gamePort = $probe.LocalEndpoint.Port
$probe.Stop()
$probe.Start()
$ircPort = $probe.LocalEndpoint.Port
$probe.Stop()
$probe.Start()
$ircTlsPort = $probe.LocalEndpoint.Port
$probe.Stop()
$origin = "http://127.0.0.1:$port"
$server = Start-Process -FilePath $exe -ArgumentList @('"--root=' + $root + '"', "--port=$port", "--game-port=$gamePort", "--irc-port=$ircPort", "--irc-tls-port=$ircTlsPort") -WindowStyle Hidden -PassThru -RedirectStandardOutput (Join-Path $root 'stdout.log') -RedirectStandardError (Join-Path $root 'stderr.log')
$handler = [Net.Http.HttpClientHandler]::new()
# Only the isolated loopback test fixture uses this self-signed TLS exception.
$handler.ServerCertificateCustomValidationCallback = [Net.Http.HttpClientHandler]::DangerousAcceptAnyServerCertificateValidator
$client = [Net.Http.HttpClient]::new($handler)
$client.Timeout = [TimeSpan]::FromSeconds(20)
$checks = [Collections.Generic.List[object]]::new()
function Check([bool]$Condition, [string]$Name) {
if (-not $Condition) { throw "FAILED: $Name" }
$checks.Add(@{name=$Name; passed=$true})
Write-Output "PASS $Name"
}
function Request([string]$Path, [string]$Method = 'GET', [string]$Json, [switch]$Admin, [switch]$Gzip, [switch]$Tls) {
$requestOrigin = if($Tls) { "https://127.0.0.1:$gamePort" } else { $origin }
$message = [Net.Http.HttpRequestMessage]::new([Net.Http.HttpMethod]::new($Method), ($requestOrigin + $Path))
if ($Admin) { $message.Headers.Authorization = [Net.Http.Headers.AuthenticationHeaderValue]::new('Bearer', $script:adminToken) }
if ($PSBoundParameters.ContainsKey('Json')) {
$body = [Text.Encoding]::UTF8.GetBytes($Json)
if ($Gzip) {
$buffer = [IO.MemoryStream]::new()
$zip = [IO.Compression.GZipStream]::new($buffer, [IO.Compression.CompressionMode]::Compress, $true)
$zip.Write($body); $zip.Dispose(); $body = $buffer.ToArray(); $buffer.Dispose()
}
$message.Content = [Net.Http.ByteArrayContent]::new($body)
$message.Content.Headers.ContentType = [Net.Http.Headers.MediaTypeHeaderValue]::new('application/octet-stream')
if ($Gzip) { $message.Content.Headers.ContentEncoding.Add('gzip') }
}
try {
$response = $client.SendAsync($message).GetAwaiter().GetResult()
try {
$bytes = $response.Content.ReadAsByteArrayAsync().GetAwaiter().GetResult()
return @{Status=[int]$response.StatusCode; Body=[Text.Encoding]::UTF8.GetString($bytes); Bytes=$bytes; ContentType=$response.Content.Headers.ContentType.MediaType}
} finally { $response.Dispose() }
} finally { $message.Dispose() }
}
try {
$ready = $false
for ($i = 0; $i -lt 40; $i++) {
if ($server.HasExited) { throw 'Server exited during startup' }
try { if ((Request '/health').Status -eq 200) { $ready = $true; break } } catch { }
Start-Sleep -Milliseconds 250
}
Check $ready 'ServerInteractive HTTP listener starts'
Check ((Request '/health' -Tls).Status -eq 200) 'Game HTTPS listener completes TLS handshake'
$script:adminToken = (Get-Content -LiteralPath (Join-Path $root 'server.json') -Raw | ConvertFrom-Json).AdminToken
Check ((Request '/control/v1/accounts').Status -eq 401) 'Management rejects missing token'
Check ((Request '/control/v1/snapshot' -Admin).Status -eq 200) 'Bearer management authentication'
Check ((Request '/control/v1/news' -Admin).Status -eq 200 -and (Request '/control/v1/messages' -Admin).Status -eq 200) 'News and mail routes are available'
$registration = Request '/player/v1/register' 'POST' '{"email":"portal@example.invalid","password":"PortalTest-123","displayName":"Portal","signIn":false}'
Check ($registration.Status -eq 201 -and -not ($registration.Body | ConvertFrom-Json).token) 'Desktop registration does not sign in'
$portalLogin = Request '/player/v1/login' 'POST' '{"email":"portal@example.invalid","password":"PortalTest-123"}'
Check ($portalLogin.Status -eq 200 -and ($portalLogin.Body | ConvertFrom-Json).token.Length -eq 64) 'Desktop login over HTTP'
Add-Type -LiteralPath (Join-Path (Split-Path $exe) 'BouncyCastle.Cryptography.dll')
$digest = [Org.BouncyCastle.Crypto.Digests.WhirlpoolDigest]::new()
$passwordBytes = [Text.Encoding]::UTF8.GetBytes('PortalTest-123')
$digest.BlockUpdate($passwordBytes, 0, $passwordBytes.Length)
$hashBytes = [byte[]]::new($digest.GetDigestSize()); [void]$digest.DoFinal($hashBytes, 0)
$gameBody = @{email='portal@example.invalid';password=[Convert]::ToHexString($hashBytes).ToLowerInvariant();ClientType='Windows';kick=$true} | ConvertTo-Json -Compress
$gameBuild = '2026.08.19.11.06/SakCydygO6-qG7S-xI5diQ'
$gameLogin = Request ("/api/login.php?buildLabel=$gameBuild&clientMod=XFEWarframe") 'POST' $gameBody -Gzip -Tls
Check ($gameLogin.Status -eq 200) 'Same desktop account signs into game over HTTPS with gzip and full build identity'
$gameSession = $gameLogin.Body | ConvertFrom-Json
Check ($gameSession.BuildLabel -eq $gameBuild -and -not $gameSession.PSObject.Properties['DTLS']) 'Game login retains manifest hash and omits unsupported DTLS field'
if ($InventoryFixture) {
$fixtureJson = [IO.File]::ReadAllText([IO.Path]::GetFullPath($InventoryFixture))
$fixture = $fixtureJson | ConvertFrom-Json
$fixtureAccount = '/control/v1/accounts/' + $gameSession.id
Check ((Request ($fixtureAccount + '/import') 'POST' ('{"inventory":' + $fixtureJson + '}') -Admin).Status -eq 200) 'Imported inventory copy loads in isolated account'
Check ((Request ($fixtureAccount + '/tutorial') 'POST' '{"skipTutorial":true}' -Admin).Status -eq 200) 'Tutorial skipping applies to imported inventory'
$fixtureResult = Request ('/api/inventory.php?accountId=' + $gameSession.id + '&nonce=' + $gameSession.Nonce) -Tls
Check ($fixtureResult.Status -eq 200) 'Imported inventory can be read with real game session over TLS'
$fixtureInventory = $fixtureResult.Body | ConvertFrom-Json
Check ($fixtureInventory.ReceivedStartingGear -and $fixtureInventory.Suits.Count -eq $fixture.Suits.Count -and $fixtureInventory.LoadOutPresets.NORMAL.Count -eq $fixture.LoadOutPresets.NORMAL.Count) 'Imported suits and loadouts survive tutorial skipping'
$fixtureShip = Request ('/api/getShip.php?accountId=' + $gameSession.id + '&nonce=' + $gameSession.Nonce) -Tls
$fixtureFeatures = ($fixtureShip.Body | ConvertFrom-Json).Ship.Features
Check ($fixtureShip.Status -eq 200 -and $fixtureFeatures -contains '/Lotus/Types/Items/ShipFeatureItems/ArsenalFeatureItem' -and $fixtureFeatures -contains '/Lotus/Types/Items/ShipFeatureItems/FoundryFeatureItem') 'Completed imported quests restore arsenal and foundry modules'
}
$page = Request '/webui/'
Check ($page.Status -eq 404 -and $page.ContentType -eq 'application/json') 'Web page is not served'
Check ((Request '/api/login.php' 'POST' '{broken').Status -eq 400) 'Malformed game body returns 400'
$login = Request '/api/login.php' 'POST' '{"email":"smoke@test.local","password":"test-client-digest","ClientType":"Windows","kick":true}' -Gzip
Check ($login.Status -eq 200) 'Gzip octet-stream game login'
$account = $login.Body | ConvertFrom-Json
Check ($account.IRC.Count -eq 1 -and $account.IRC[0] -eq "127.0.0.1:$ircTlsPort") 'Game login advertises the integrated chat host and overridden port'
if (-not ('XFEChatSmoke' -as [type])) {
Add-Type -TypeDefinition @'
using System;
using System.IO;
using System.Net.Security;
using System.Net.Sockets;
using System.Security.Authentication;
using System.Security.Cryptography;
using System.Text;
public static class XFEChatSmoke
{
private sealed class Peer : IDisposable
{
private readonly TcpClient socket;
private readonly Stream stream;
private readonly StreamReader reader;
private readonly StreamWriter writer;
public Peer(int port, bool tls, string id, string nonce, string name, byte[] nativeKey = null)
{
socket = new TcpClient("127.0.0.1", port);
stream = socket.GetStream();
if (tls)
{
// Only this isolated loopback fixture trusts the generated test certificate.
var ssl = new SslStream(stream, false, (sender, certificate, chain, errors) => true);
ssl.AuthenticateAsClient("localhost", null, SslProtocols.Tls12, false); stream = ssl;
}
stream.ReadTimeout = 5000; stream.WriteTimeout = 5000;
reader = new StreamReader(stream, new UTF8Encoding(false));
writer = new StreamWriter(stream, new UTF8Encoding(false)) { AutoFlush = true, NewLine = "\r\n" };
var notice = Expect("skipping identd");
var challenge = Convert.ToUInt32(notice.Substring(notice.IndexOf("Auth ") + 5, 8), 16);
Send("NICK " + name + "\ue000"); Send("USER " + id + " 0 * " + (nativeKey == null ? "nonce=" + nonce : NativeProof(id, nonce, challenge, nativeKey)));
Expect(" 001 "); Expect(" 305 "); Expect(" 422 ");
Send("JOIN #Gsmoke"); Expect(" 366 ");
}
public void Send(string line) { writer.WriteLine(line); }
public string Expect(string marker)
{
for (int i = 0; i < 100; ++i)
{
var line = reader.ReadLine();
if (line == null) throw new IOException("IRC connection closed before expected reply");
if (line.Contains(marker)) return line;
}
throw new IOException("Expected IRC reply not received");
}
public void Dispose() { socket.Dispose(); }
}
public static void Run(int port, int tlsPort, string firstId, string firstNonce, string firstName, string secondId, string secondNonce, string secondName)
{
using (var first = new Peer(tlsPort, true, firstId, firstNonce, firstName))
using (var second = new Peer(port, false, secondId, secondNonce, secondName))
{
first.Send("PRIVMSG #Gsmoke :星际通讯验证"); second.Expect("PRIVMSG #Gsmoke :星际通讯验证");
second.Send("PRIVMSG " + firstName + "\ue000 :私聊验证"); first.Expect("PRIVMSG " + firstName + "\ue000 :私聊验证");
first.Send("PING :smoke-ready"); first.Expect(" PONG XFEWarframe :smoke-ready");
}
}
private static string NativeProof(string id, string nonce, uint challenge, byte[] key)
{
const uint seed = 0x12345678;
int firstSplit = (int)(challenge % key.Length), secondSplit = (int)(seed % key.Length);
byte[][] parts = { key.AsSpan(0, firstSplit).ToArray(), key.AsSpan(firstSplit).ToArray(), Encoding.UTF8.GetBytes("accountId=" + id + "&nonce=" + nonce), key.AsSpan(0, secondSplit).ToArray(), key.AsSpan(secondSplit).ToArray() };
using (var first = new MemoryStream()) using (var second = new MemoryStream())
{
for (int i = 0; i < 17; ++i) { var bytes = parts[i % 5]; (i % 2 == 0 ? first : second).Write(bytes, 0, bytes.Length); }
var a = MD5.HashData(first.ToArray()); var b = MD5.HashData(second.ToArray()); var proof = new byte[20];
System.Buffers.Binary.BinaryPrimitives.WriteUInt32BigEndian(proof, seed);
for (int i = 0; i < 16; ++i) proof[i + 4] = (byte)(a[i] ^ b[i]);
return Convert.ToHexString(proof).ToLowerInvariant();
}
}
public static void RunNative(int tlsPort, string id, string nonce, string name, string key)
{
using (var peer = new Peer(tlsPort, true, id, nonce, name, Convert.FromBase64String(key)))
{ peer.Send("PING :native-ready"); peer.Expect(" PONG XFEWarframe :native-ready"); }
}
}
'@
}
[XFEChatSmoke]::Run($ircPort, $ircTlsPort, $gameSession.id, [string]$gameSession.Nonce, $gameSession.DisplayName, $account.id, [string]$account.Nonce, $account.DisplayName)
Check $true 'Integrated TCP/TLS chat authenticates actual HTTP sessions and delivers Chinese channel/private messages'
$nativeLogin = Request ("/api/login.php?buildLabel=$gameBuild&clientMod=XFEWarframe") 'POST' $gameBody -Gzip -Tls
$nativeSession = $nativeLogin.Body | ConvertFrom-Json
$nativeKey = (Get-Content (Join-Path $taskRoot 'Server/data/irc-auth.json') -Raw | ConvertFrom-Json).KeyBase64
[XFEChatSmoke]::RunNative($ircTlsPort, $nativeSession.id, [string]$nativeSession.Nonce, $nativeSession.DisplayName, $nativeKey)
Check $true 'Native game challenge proof authenticates an actual game login from ServerInteractive'
$query = '?accountId=' + $account.id + '&nonce=' + $account.Nonce
$save = Request ('/api/saveSettings.php' + $query) 'POST' '{"Settings":{"FieldOfView":95}}'
Check ($save.Status -eq 200) 'Raw JSON game settings upload'
$inventory = Request ('/api/inventory.php' + $query)
Check ($inventory.Status -eq 200 -and ($inventory.Body | ConvertFrom-Json).Settings.FieldOfView -eq 95) 'Persisted inventory over HTTP'
Check ((Request ('/api/inventory.php?accountId=' + $account.id + '&nonce=1')).Status -eq 401) 'Game rejects wrong nonce'
$worldResponse = Request '/cdn/worldState.php'
Check ($worldResponse.Status -eq 200) 'CDN world-state alias executes C# generator'
$world = $worldResponse.Body | ConvertFrom-Json
Check ($world.ActiveMissions.Count -gt 0 -and $world.Sorties.Count -gt 0 -and $world.Conquests.Count -gt 0 -and $world.Descents.Count -gt 0) 'World rotations, fissures, sorties, conquests and descents'
$routes = (Request '/control/v1/routes' -Admin).Body | ConvertFrom-Json
Check ($routes.Count -eq 332 -and @($routes | Where-Object Status -eq 'pending').Count -eq 0) 'All 332 route definitions have native handlers'
$descentBody = '{"Mode":"r","Category":"DM_COH_NORMAL"}'
$descent = Request ('/api/descentRewards.php' + $query) 'POST' $descentBody
Check ($descent.Status -eq 200 -and $descent.Body -eq (Request ('/api/descentRewards.php' + $query) 'POST' $descentBody).Body) 'Weekly reward selection is stable across retries'
$blessingBody = '{"Mode":"s","Category":"DM_COH_NORMAL","SelectedUpgrades":["","selection-identifier","other/identifier",""]}'
$blessing = Request ('/api/descentRewards.php' + $query) 'POST' $blessingBody -Gzip -Tls
$blessingData = $blessing.Body | ConvertFrom-Json
Check ($blessing.Status -eq 200 -and $blessingData.SelectedUpgrades.Count -eq 4 -and $blessingData.SelectedUpgrades[0] -ceq '' -and $blessingData.SelectedUpgrades[1] -ceq 'selection-identifier' -and $blessingData.SelectedUpgrades[2] -ceq 'other/identifier' -and $blessingData.SelectedUpgrades[3] -ceq '') 'Gzip HTTPS descent selection preserves opaque identifiers and indexed empty positions'
$blessingRetry = Request ('/api/descentRewards.php' + $query) 'POST' $blessingBody -Gzip -Tls
Check ($blessingRetry.Status -eq 200 -and $blessingRetry.Body -ceq $blessing.Body) 'Descent blessing retry echoes the same seed, rewards and selection'
$blessingInventory = (Request ('/api/inventory.php' + $query) -Tls).Body | ConvertFrom-Json
$storedBlessing = @($blessingInventory.DescentRewards | Where-Object Category -eq DM_COH_NORMAL)[0]
Check (($storedBlessing.SelectedUpgrades | ConvertTo-Json -Compress) -ceq ($blessingData.SelectedUpgrades | ConvertTo-Json -Compress)) 'Descent blessing identifiers persist through a real inventory request'
$unlock = Request ('/api/entratiLabConquestMode.php' + $query) 'POST' '{"BuyMode":1}'
Check ($unlock.Status -eq 200 -and ($unlock.Body | ConvertFrom-Json).EntratiVaultCountLastPeriod -eq 2) 'Conquest unlock consumes two search pulses'
$retry = Request ('/api/entratiLabConquestMode.php' + $query) 'POST' '{"BuyMode":1}'
Check ($unlock.Body -eq $retry.Body) 'Repeated conquest unlock does not charge again'
$invalid = Request ('/api/modularWeaponCrafting.php' + $query) 'POST' '{"WeaponType":"/Lotus/Weapons/Ostron/Melee/LotusModularWeapon","Parts":["a","b","c"]}'
Check ($invalid.Status -eq 400) 'Invalid modular crafting is rejected'
$cache = Request '/origin/Windows/1/H.Cache.bin'
Check ($cache.Status -eq 200 -and [Convert]::ToBase64String($cache.Bytes) -eq 'AP8BgAoN') 'Local game cache is served byte-exact'
Check ((Request '/SplitCaches/missing.bin').Status -eq 404) 'Absent game assets return 404'
$pe = Request '/PublicExport/Manifest/ExportWarframes_zh.json!smoke'
Check ($pe.Status -eq 200 -and ($pe.Body | ConvertFrom-Json).ExportWarframes.Count -gt 100) 'Chinese PublicExport client shape'
$index = Request '/PublicExport/index_zh.txt.lzma'
$expected = [IO.File]::ReadAllBytes((Join-Path $taskRoot 'Server/data/fixed_responses/PublicExport/index_zh.txt.lzma'))
Check ($index.Status -eq 200 -and [Convert]::ToBase64String($index.Bytes) -eq [Convert]::ToBase64String($expected)) 'PublicExport binary is byte-exact'
$logs = Request '/control/v1/logs' -Admin
Check (-not $logs.Body.Contains('test-client-digest') -and -not $logs.Body.Contains($script:adminToken) -and -not $logs.Body.Contains('nonce=')) 'Request logs redact credentials'
$shutdown = Request '/control/v1/shutdown' 'POST' '{}' -Admin
Check ($shutdown.Status -eq 200 -and $server.WaitForExit(5000)) 'Graceful management shutdown'
Check ($server.ExitCode -eq 0) 'Console exits successfully'
$chatLogs = [IO.File]::ReadAllText((Join-Path $root 'stdout.log'))
Check (-not $chatLogs.Contains([string]$gameSession.Nonce) -and -not $chatLogs.Contains('星际通讯验证') -and -not $chatLogs.Contains('私聊验证')) 'Chat logs omit credentials and message bodies'
foreach ($releasedPort in @($ircPort, $ircTlsPort)) {
$releasedProbe = [Net.Sockets.TcpListener]::new([Net.IPAddress]::Loopback, $releasedPort)
try { $releasedProbe.Start() } finally { $releasedProbe.Stop() }
}
Check $true 'Graceful shutdown releases both IRC listeners'
$checks | ConvertTo-Json | Set-Content -LiteralPath (Join-Path $root 'results.json') -Encoding utf8
Write-Output "HTTP smoke results: $root"
} finally {
$client.Dispose()
if (-not $server.HasExited) { Stop-Process -Id $server.Id -ErrorAction SilentlyContinue }
$server.Dispose(); $script:adminToken = $null
}