mirror of
https://github.com/binaricat/Netcatty.git
synced 2026-11-23 00:20:45 +00:00
* feat(ssh): restore FIDO2 security key support (#2308) Consolidate the restored feature and its review fixes before rebasing onto current main. Original PR head: 5d0a0c6c9a550364d3ec5c2331395cedfc9ea7ae. * fix(ssh): verify and repair FIDO authentication with simulated hardware Preserve complete OpenSSH SK signature payloads, classify combined PIN/presence prompts correctly, expand IdentityFile tokens, retain certificate selectors, and route shared-agent signing prompts to their originating window. Dismiss prompts when notification helpers exit. Add a software SK provider and opt-in real OpenSSH integration coverage for both algorithms, certificates, SFTP, forwarding, and concurrent windows. * refactor(ui): refine security key forms and authentication motion Use shared Select and Switch controls, concise localized copy and compact token-based dialogs. Add scoped enter/exit, field transition and presence animations with reduced-motion support. Preserve raw prompt details and visible PIN errors. * fix(ssh): align security key prompts with hardware presence and verify Docker logins * fix(ui): keep security key dialog above its remounted overlay * fix: address Codex review on PR #2823 * feat(ssh): guide security key recovery and explicit authentication fallback * test(ssh): exercise security key authentication on native Windows * test(ssh): verify Windows fixture signatures and explicit fallback * test(ssh): configure Windows OpenSSH toolchain and document coverage --------- Co-authored-by: netcatty-bot <308658023+netcatty-bot@users.noreply.github.com>
77 lines
2.1 KiB
JavaScript
77 lines
2.1 KiB
JavaScript
"use strict";
|
|
|
|
const test = require("node:test");
|
|
const assert = require("node:assert/strict");
|
|
const { EventEmitter } = require("node:events");
|
|
const { attachFidoAgentRelease } = require("./attachFidoAgentRelease.cjs");
|
|
|
|
test("attachFidoAgentRelease invokes release once on close", () => {
|
|
const conn = new EventEmitter();
|
|
let releaseCount = 0;
|
|
const agent = {
|
|
_releaseNetcattyFidoAgent: () => { releaseCount += 1; },
|
|
};
|
|
|
|
attachFidoAgentRelease(conn, agent);
|
|
conn.emit("close");
|
|
|
|
assert.equal(releaseCount, 1);
|
|
conn.emit("close");
|
|
assert.equal(releaseCount, 1);
|
|
});
|
|
|
|
test("attachFidoAgentRelease invokes release once on end", () => {
|
|
const conn = new EventEmitter();
|
|
let releaseCount = 0;
|
|
const agent = {
|
|
_releaseNetcattyFidoAgent: () => { releaseCount += 1; },
|
|
};
|
|
|
|
attachFidoAgentRelease(conn, agent);
|
|
conn.emit("end");
|
|
|
|
assert.equal(releaseCount, 1);
|
|
conn.emit("end");
|
|
assert.equal(releaseCount, 1);
|
|
});
|
|
|
|
test("attachFidoAgentRelease is one-shot across close and end", () => {
|
|
const conn = new EventEmitter();
|
|
let releaseCount = 0;
|
|
const agent = {
|
|
_releaseNetcattyFidoAgent: () => { releaseCount += 1; },
|
|
};
|
|
|
|
attachFidoAgentRelease(conn, agent);
|
|
conn.emit("close");
|
|
conn.emit("end");
|
|
|
|
assert.equal(releaseCount, 1);
|
|
});
|
|
|
|
test("attachFidoAgentRelease no-ops without conn or release hook", () => {
|
|
let releaseCount = 0;
|
|
const agent = {
|
|
_releaseNetcattyFidoAgent: () => { releaseCount += 1; },
|
|
};
|
|
|
|
attachFidoAgentRelease(null, agent);
|
|
attachFidoAgentRelease(new EventEmitter(), null);
|
|
attachFidoAgentRelease(new EventEmitter(), {});
|
|
|
|
assert.equal(releaseCount, 0);
|
|
});
|
|
|
|
test("explicit FIDO cancellation ends the transport instead of trying another credential", () => {
|
|
const conn = new EventEmitter();
|
|
let ended = 0;
|
|
conn.end = () => { ended++; };
|
|
attachFidoAgentRelease(conn, { _releaseNetcattyFidoAgent() {} });
|
|
conn.emit("error", Object.assign(new Error("cancelled"), { code: "ERR_FIDO_CANCELLED" }));
|
|
assert.equal(ended, 1);
|
|
conn.emit("error", new Error("ordinary agent error"));
|
|
assert.equal(ended, 1);
|
|
conn.emit("close");
|
|
assert.equal(conn.listenerCount("error"), 0);
|
|
});
|