* docs: design SSH relay PTY backpressure * fix(ssh): bound relay frame decoding * fix(relay): bound PTY output publication * fix(ssh): bound PTY model admission * fix(ssh): settle closed model admissions * feat(ssh): negotiate bounded PTY consumer sessions * fix(ssh): fence exit on renderer settlement * feat(ssh): track PTY source credit end to end * fix(ssh): recover bounded PTY output across reconnect * feat(ssh): complete relay PTY output backpressure * fix(ssh): close final PTY source credit races * docs(ssh): record final backpressure validation * feat(ssh): complete relay PTY source-credit lifecycle * test(ssh): complete provider notification fixture * fix(ssh): preserve terminal source credit across rotation * fix(ssh): fail closed on recovery cancellation * fix(ssh): prioritize mux control writes after drain * fix(ssh): retire canceled relay restore deliveries * fix(ssh): order exit cancellation cleanup * fix(ssh): gate provisional source activation * test(ssh): register mux drain-priority coverage * fix(ssh): type stale owner recovery mismatches * fix(ssh): close projection replacement races * fix(relay): contain streaming edge failures * fix(ssh): secure relay endpoint credentials * docs(ssh): reconcile final backpressure lifecycle * fix(ssh): bound main IPC output lifecycle * fix(ssh): close recovery ownership gaps * docs(ssh): record exact artifact validation * fix(ssh): reject reclaimed snapshot replacements * fix(ssh): fence model admission across reconnect * fix(ssh): contain migration failure per PTY * docs(ssh): record final exact-head validation * test(ssh): align deploy fixtures with credential publication * feat(ssh): add per-target bounded output setting * fix(ssh): close source recovery review gaps * fix(ssh): latch source credit environment override * feat(ssh): make PTY source credit the default * docs(ssh): record always-on relay validation * docs(ssh): bind validation to current main * test(ssh): grant source credit in IPC fixture * test(ssh): grant source credit in fake relay --------- Co-authored-by: OrcaWin <293788423+OrcaWin@users.noreply.github.com>
51 lines
2.1 KiB
TypeScript
51 lines
2.1 KiB
TypeScript
import { Buffer } from 'node:buffer'
|
|
import { describe, expect, it } from 'vitest'
|
|
import { relayEndpointCredentialWriteCommand } from './ssh-relay-endpoint-credential'
|
|
import { getRemoteHostPlatform } from './ssh-remote-platform'
|
|
|
|
function decodePowerShellCommand(command: string): string {
|
|
const encoded = command.match(/-EncodedCommand\s+([A-Za-z0-9+/=]+)/)?.[1]
|
|
if (!encoded) {
|
|
throw new Error(`Expected an encoded PowerShell command: ${command}`)
|
|
}
|
|
return Buffer.from(encoded, 'base64').toString('utf16le')
|
|
}
|
|
|
|
describe('relay endpoint credential writes', () => {
|
|
it('publishes a POSIX credential only from a restrictive temporary file', () => {
|
|
const command = relayEndpointCredentialWriteCommand(
|
|
getRemoteHostPlatform('linux-x64'),
|
|
'/opt/orca node/bin/node',
|
|
'/home/me user/.orca-remote/relay.sock.credential'
|
|
)
|
|
|
|
expect(command).toContain('{flag:"wx",mode:0o600}')
|
|
expect(command).toContain('fs.writeFileSync(t,')
|
|
expect(command).not.toContain('fs.writeFileSync(p,')
|
|
expect(command.indexOf('fs.writeFileSync(t,')).toBeLessThan(
|
|
command.indexOf('fs.renameSync(t,p)')
|
|
)
|
|
expect(command).toContain("'/home/me user/.orca-remote/relay.sock.credential'")
|
|
})
|
|
|
|
it('creates a Windows credential with its owner-only ACL before publication', () => {
|
|
const script = decodePowerShellCommand(
|
|
relayEndpointCredentialWriteCommand(
|
|
getRemoteHostPlatform('win32-x64'),
|
|
'C:/Program Files/nodejs/node.exe',
|
|
'C:/Users/me user/.orca-remote/relay.sock.credential'
|
|
)
|
|
)
|
|
|
|
expect(script).toContain("$path = 'C:/Users/me user/.orca-remote/relay.sock.credential'")
|
|
expect(script).toContain('$security.SetAccessRuleProtection($true,$false)')
|
|
expect(script).toContain('[System.IO.FileStream]::new($tempPath')
|
|
expect(script).toContain('[System.IO.FileOptions]::WriteThrough,$security)')
|
|
expect(script.indexOf('[System.IO.FileStream]::new')).toBeLessThan(
|
|
script.indexOf('[System.IO.File]::Move($tempPath,$path)')
|
|
)
|
|
expect(script).not.toContain('Set-Acl')
|
|
expect(script).not.toContain('icacls')
|
|
})
|
|
})
|