test: remove low-value signature and SSH examples (#43570)

Co-authored-by: OrcaWin <293788423+OrcaWin@users.noreply.github.com>
This commit is contained in:
OrcaWin
2026-11-17 02:17:53 -08:00
committed by GitHub
co-authored by OrcaWin
parent 4b18d9b198
commit 9fe58fd772
2 changed files with 0 additions and 93 deletions
@@ -5,11 +5,8 @@ import { describe, expect, it, vi } from 'vitest'
import {
POWERSHELL_TIMEOUT_MS,
findSignatureOffenders,
isWindowsPayloadBinary,
listWindowsPayloadBinaries,
main,
parseArgs,
parseDistinguishedName,
verifyWindowsPayloadSignatures
} from './verify-windows-payload-signatures.mjs'
@@ -37,36 +34,6 @@ function fakePowerShell(signerFor) {
})
}
describe('isWindowsPayloadBinary', () => {
it('keeps Windows binaries, including the Windows orcad template target', () => {
expect(isWindowsPayloadBinary('Orca.exe')).toBe(true)
expect(isWindowsPayloadBinary('ffmpeg.DLL')).toBe(true)
expect(
isWindowsPayloadBinary('resources/node_modules/node-pty/build/Release/conpty.node')
).toBe(true)
expect(
isWindowsPayloadBinary(
'resources/orcad-template/targets/win32-x64/node_modules/node-pty/build/Release/pty.node'
)
).toBe(true)
})
it('skips non-binaries and non-Windows orcad template payloads', () => {
expect(isWindowsPayloadBinary('resources/app.asar')).toBe(false)
expect(isWindowsPayloadBinary('resources/node_modules/node-pty/lib/index.js')).toBe(false)
expect(
isWindowsPayloadBinary(
'resources/orcad-template/targets/linux-x64-glibc/node_modules/node-pty/build/Release/pty.node'
)
).toBe(false)
expect(
isWindowsPayloadBinary(
'resources/orcad-template/targets/darwin-arm64/node_modules/@parcel/watcher/watcher.node'
)
).toBe(false)
})
})
describe('listWindowsPayloadBinaries', () => {
it('walks the whole tree with forward-slash relative paths', () => {
const root = makePayload([
@@ -141,16 +108,6 @@ describe('findSignatureOffenders', () => {
})
})
describe('parseDistinguishedName', () => {
it('reads quoted and escaped values and voids repeated keys', () => {
const attributes = parseDistinguishedName('CN="Foo, Inc.", O=Bar\\, Ltd, OU=a, OU=b')
expect(attributes.get('CN')).toBe('Foo, Inc.')
expect(attributes.get('O')).toBe('Bar, Ltd')
expect(attributes.get('OU')).toBeNull()
expect(parseDistinguishedName(null).size).toBe(0)
})
})
describe('verifyWindowsPayloadSignatures', () => {
it('checks every binary in one PowerShell call and reports the unsigned ones', () => {
const root = makePayload([
@@ -267,12 +224,3 @@ describe('main', () => {
expect(result.code).toBe(2)
})
})
describe('parseArgs', () => {
it('rejects unknown modes and extra positionals', () => {
expect(parseArgs(['dir'])).toEqual({ root: 'dir', mode: 'required' })
expect(() => parseArgs(['dir', '--mode', 'off'])).toThrow('Usage')
expect(() => parseArgs(['a', 'b'])).toThrow('Usage')
expect(parseArgs(['dir', '--summary', 's.json']).summaryPath).toBe('s.json')
})
})
@@ -8,7 +8,6 @@ import {
captureOrcadLaunchSshSessionCommand,
ORCAD_LAUNCH_SSH_SESSION_FILENAME,
orcadLaunchSshSessionProbeCommand,
orcadSshSessionAncestorShellFunction,
parseOrcadLaunchSshSession,
writeOrcadLaunchSshSessionCommand
} from './orcad-launch-ssh-session'
@@ -102,31 +101,6 @@ describe.skipIf(process.platform === 'win32')('orcad launch SSH session', () =>
rmSync(dir, { recursive: true, force: true })
})
it('finds the nearest sshd ancestor, skipping the shells between', () => {
const fn = orcadSshSessionAncestorShellFunction()
expect(sh(`${fn} orcad_ssh_session 12345`).trim()).toBe('500 Thu Oct 9 08:00:00 2026')
})
it('finds no session for a process outside SSH', () => {
const fn = orcadSshSessionAncestorShellFunction()
const out = sh(`${fn} orcad_ssh_session 12345 || echo NONE`, { FAKE_PS_SHELL_PARENT: '300' })
expect(out.trim()).toBe('NONE')
})
it('records the launch and its session after the detached PID', () => {
const pidFile = join(dir, ORCAD_PID_FILENAME)
const out = sh(
`${captureOrcadLaunchSshSessionCommand()} sleep 0 & echo $! > '${pidFile}' && ` +
`${writeOrcadLaunchSshSessionCommand(mac, dir)} && cat '${pidFile}'`
)
const pid = out.trim()
expect(pid).toMatch(/^\d+$/)
expect(readFileSync(join(dir, ORCAD_LAUNCH_SSH_SESSION_FILENAME), 'utf8').trim()).toBe(
`${pid} 500 Thu Oct 9 08:00:00 2026`
)
expect(probe()).toBe('live')
})
it('records the session from the full macOS launch, which still prints the runtime PID', () => {
writeFileSync(join(dir, 'orcad.js'), 'setTimeout(() => {}, 200)')
const command = orcadLaunchCommand(mac, {
@@ -188,16 +162,6 @@ describe.skipIf(process.platform === 'win32')('orcad launch SSH session', () =>
expect(existsSync(join(dir, ORCAD_LAUNCH_SSH_SESSION_FILENAME))).toBe(false)
})
it('creates the data root on a first deploy before recording', () => {
const data = join(dir, 'fresh', 'data')
const pidFile = join(dir, ORCAD_PID_FILENAME)
sh(
`${captureOrcadLaunchSshSessionCommand()} sleep 0 & echo $! > '${pidFile}' && ` +
`${writeOrcadLaunchSshSessionCommand(mac, data)}`
)
expect(existsSync(join(data, ORCAD_LAUNCH_SSH_SESSION_FILENAME))).toBe(true)
})
it('removes an earlier record when this launch finds no session', () => {
writeRecord('1', '1 500 Thu Oct 9 08:00:00 2026')
sh(
@@ -209,11 +173,6 @@ describe.skipIf(process.platform === 'win32')('orcad launch SSH session', () =>
expect(existsSync(join(dir, ORCAD_LAUNCH_SSH_SESSION_FILENAME))).toBe(false)
})
it('reports exited once the launching session is gone', () => {
writeRecord('77', '77 500 Thu Oct 9 08:00:00 2026')
expect(probe({ FAKE_PS_GONE: '500' })).toBe('exited')
})
it('reads a reused PID with another start time as exited', () => {
writeRecord('77', '77 500 Wed Oct 8 08:00:00 2026')
expect(probe()).toBe('exited')