fix: honor SSH agent opt-out

This commit is contained in:
bincxz committed 2026-07-12 17:49:57 +08:00
1 parent 7cb722a5c5
commit 0046291376
14 files changed
+61 -13

No files matched your search

@@ -9,6 +9,7 @@ const path = require("node:path");
const { Duplex } = require("node:stream");
const {
buildAuthHandler,
getAvailableAgentSocket,
getNativeOpenSshAgentSocket,
cygwinAgentConnectable,
@@ -18,6 +19,16 @@ const {
resolveIdentityAgentPath,
} = require("./sshAuthHelper.cjs");
test("explicit agent opt-out suppresses automatic socket fallback", () => {
const auth = buildAuthHandler({
username: "deploy",
allowAgentFallback: false,
sshAgentSocketOverride: "/tmp/agent.sock",
});
assert.equal(auth.agent, null);
});
test("IdentityAgent paths expand standard OpenSSH connection tokens", () => {
const resolved = resolveIdentityAgentPath(
"%d/.ssh/agent-%h-%p-%r-%u-%l-%L-%i-%%-%C.sock",