[Init] Initial commit - NetMesh terminal manager
Some checks failed
build-packages / resolve bundled mosh-client (push) Has been cancelled
build-packages / resolve bundled et-client (push) Has been cancelled
build-packages / build-macos (push) Has been cancelled
build-packages / build-windows (push) Has been cancelled
build-packages / build-linux-x64 (push) Has been cancelled
build-packages / build-linux-arm64 (push) Has been cancelled
build-packages / release (push) Has been cancelled
build-packages / update Nix release metadata (push) Has been cancelled
build-packages / bump homebrew tap (push) Has been cancelled
test / lint-and-test (push) Has been cancelled
AI automation / Route event (push) Has been cancelled
AI automation / Hand reopened issue to maintainers (push) Has been cancelled
AI automation / Clean source issue state (push) Has been cancelled
AI automation / Reconcile handoffs (push) Has been cancelled
AI automation / Classify issue (push) Has been cancelled
AI automation / Claude Code smoke (push) Has been cancelled
AI automation / Review issue follow-up (push) Has been cancelled
AI automation / Publish issue follow-up (push) Has been cancelled
AI automation / Implement with Claude Code (push) Has been cancelled
AI automation / Publish implement PR (push) Has been cancelled
AI automation / Continue queued issue comments (push) Has been cancelled
AI automation / Codex review loop (push) Has been cancelled
AI automation / Publish Codex fix (push) Has been cancelled
AI automation / Clear Codex dispatch marker (push) Has been cancelled
AI automation / Own PR re-request Codex (push) Has been cancelled
AI automation / External PR re-request Codex (push) Has been cancelled
AI automation / Poll Codex reaction / retry (push) Has been cancelled
build-et-binaries / build-linux-x64 (push) Has been cancelled
build-et-binaries / build-linux-arm64 (push) Has been cancelled
build-et-binaries / build-macos-universal (push) Has been cancelled
build-et-binaries / build-windows-x64 (push) Has been cancelled
build-et-binaries / release (push) Has been cancelled
Some checks failed
build-packages / resolve bundled mosh-client (push) Has been cancelled
build-packages / resolve bundled et-client (push) Has been cancelled
build-packages / build-macos (push) Has been cancelled
build-packages / build-windows (push) Has been cancelled
build-packages / build-linux-x64 (push) Has been cancelled
build-packages / build-linux-arm64 (push) Has been cancelled
build-packages / release (push) Has been cancelled
build-packages / update Nix release metadata (push) Has been cancelled
build-packages / bump homebrew tap (push) Has been cancelled
test / lint-and-test (push) Has been cancelled
AI automation / Route event (push) Has been cancelled
AI automation / Hand reopened issue to maintainers (push) Has been cancelled
AI automation / Clean source issue state (push) Has been cancelled
AI automation / Reconcile handoffs (push) Has been cancelled
AI automation / Classify issue (push) Has been cancelled
AI automation / Claude Code smoke (push) Has been cancelled
AI automation / Review issue follow-up (push) Has been cancelled
AI automation / Publish issue follow-up (push) Has been cancelled
AI automation / Implement with Claude Code (push) Has been cancelled
AI automation / Publish implement PR (push) Has been cancelled
AI automation / Continue queued issue comments (push) Has been cancelled
AI automation / Codex review loop (push) Has been cancelled
AI automation / Publish Codex fix (push) Has been cancelled
AI automation / Clear Codex dispatch marker (push) Has been cancelled
AI automation / Own PR re-request Codex (push) Has been cancelled
AI automation / External PR re-request Codex (push) Has been cancelled
AI automation / Poll Codex reaction / retry (push) Has been cancelled
build-et-binaries / build-linux-x64 (push) Has been cancelled
build-et-binaries / build-linux-arm64 (push) Has been cancelled
build-et-binaries / build-macos-universal (push) Has been cancelled
build-et-binaries / build-windows-x64 (push) Has been cancelled
build-et-binaries / release (push) Has been cancelled
This commit is contained in:
121
electron/bridges/portForwardingBridge.endpoint.test.cjs
Normal file
121
electron/bridges/portForwardingBridge.endpoint.test.cjs
Normal file
@@ -0,0 +1,121 @@
|
||||
const assert = require("node:assert/strict");
|
||||
const test = require("node:test");
|
||||
|
||||
const {
|
||||
buildPortForwardEndpoint,
|
||||
buildPortForwardEndpointFromStartPayload,
|
||||
} = require("./portForwardingBridge.cjs");
|
||||
const {
|
||||
buildConnectionReuseEndpoint,
|
||||
buildEndpointKey,
|
||||
normalizeEndpoint,
|
||||
} = require("./sshConnectionPool.cjs");
|
||||
|
||||
const baseOptions = {
|
||||
hostId: "pf-profile",
|
||||
hostname: "pf-endpoint.test",
|
||||
port: 22,
|
||||
username: "alice",
|
||||
authMethod: "key",
|
||||
keyId: "pf-key",
|
||||
privateKey: "PF_PRIVATE_SECRET",
|
||||
publicKey: "ssh-ed25519 PF_PUBLIC_KEY",
|
||||
passphrase: "PF_PASSPHRASE_SECRET",
|
||||
identityFilePaths: ["/keys/pf"],
|
||||
useSshAgent: true,
|
||||
identityAgent: "/run/user/1000/pf-agent-a.sock",
|
||||
identitiesOnly: true,
|
||||
agentPublicKeys: ["ssh-ed25519 PF_AGENT_KEY_A"],
|
||||
addKeysToAgent: "confirm",
|
||||
useKeychain: true,
|
||||
legacyAlgorithms: false,
|
||||
skipEcdsaHostKey: false,
|
||||
algorithmOverrides: { kex: ["curve25519-sha256"] },
|
||||
verifyHostKeys: true,
|
||||
knownHosts: [{
|
||||
id: "kh-pf-endpoint",
|
||||
hostname: "pf-endpoint.test",
|
||||
port: 22,
|
||||
keyType: "ssh-ed25519",
|
||||
fingerprint: "SHA256:pf-endpoint-a",
|
||||
publicKey: "ssh-ed25519 PF_KNOWN_HOST_KEY_A",
|
||||
}],
|
||||
};
|
||||
|
||||
function endpointKey(options = baseOptions) {
|
||||
return buildEndpointKey(buildPortForwardEndpoint(options));
|
||||
}
|
||||
|
||||
test("port-forward endpoint identity changes for every effective agent selection setting", () => {
|
||||
const baseKey = endpointKey();
|
||||
const variants = [
|
||||
{ identityAgent: "/run/user/1000/pf-agent-b.sock" },
|
||||
{ identitiesOnly: false },
|
||||
{ agentPublicKeys: ["ssh-ed25519 PF_AGENT_KEY_B"] },
|
||||
{ addKeysToAgent: "yes" },
|
||||
{ useKeychain: false },
|
||||
];
|
||||
|
||||
for (const variant of variants) {
|
||||
assert.notEqual(endpointKey({ ...baseOptions, ...variant }), baseKey);
|
||||
}
|
||||
});
|
||||
|
||||
test("port-forward endpoint identity changes for every effective algorithm setting", () => {
|
||||
const baseKey = endpointKey();
|
||||
const variants = [
|
||||
{ legacyAlgorithms: true },
|
||||
{ skipEcdsaHostKey: true },
|
||||
{ algorithmOverrides: { kex: ["diffie-hellman-group14-sha256"] } },
|
||||
];
|
||||
|
||||
for (const variant of variants) {
|
||||
assert.notEqual(endpointKey({ ...baseOptions, ...variant }), baseKey);
|
||||
}
|
||||
});
|
||||
|
||||
test("port-forward endpoint identity includes the effective known-host trust set", () => {
|
||||
const baseKey = endpointKey();
|
||||
const rotatedKnownHosts = [{
|
||||
...baseOptions.knownHosts[0],
|
||||
fingerprint: "SHA256:pf-endpoint-b",
|
||||
publicKey: "ssh-ed25519 PF_KNOWN_HOST_KEY_B",
|
||||
}];
|
||||
|
||||
assert.notEqual(endpointKey({ ...baseOptions, knownHosts: rotatedKnownHosts }), baseKey);
|
||||
assert.equal(
|
||||
endpointKey(),
|
||||
buildEndpointKey(buildConnectionReuseEndpoint(baseOptions, { sftpSudo: false })),
|
||||
);
|
||||
});
|
||||
|
||||
test("port-forward endpoint normalizes to the common digest-only connection identity", () => {
|
||||
const normalized = normalizeEndpoint(buildPortForwardEndpoint(baseOptions));
|
||||
const serialized = JSON.stringify(normalized);
|
||||
|
||||
assert.ok(normalized?.authFingerprint);
|
||||
for (const secret of [
|
||||
baseOptions.privateKey,
|
||||
baseOptions.passphrase,
|
||||
baseOptions.agentPublicKeys[0],
|
||||
baseOptions.knownHosts[0].publicKey,
|
||||
]) {
|
||||
assert.equal(serialized.includes(secret), false);
|
||||
}
|
||||
});
|
||||
|
||||
test("port-forward start identity uses the resolved keepalive policy", () => {
|
||||
const payload = {
|
||||
...baseOptions,
|
||||
resolvedKeepaliveInterval: 30,
|
||||
resolvedKeepaliveCountMax: 10,
|
||||
};
|
||||
assert.equal(
|
||||
buildEndpointKey(buildPortForwardEndpointFromStartPayload(payload)),
|
||||
buildEndpointKey(buildConnectionReuseEndpoint({
|
||||
...baseOptions,
|
||||
keepaliveInterval: 30,
|
||||
keepaliveCountMax: 10,
|
||||
})),
|
||||
);
|
||||
});
|
||||
Reference in New Issue
Block a user