mirror of
https://github.com/binaricat/Netcatty.git
synced 2026-11-16 20:11:08 +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>
42 lines
1.8 KiB
JavaScript
42 lines
1.8 KiB
JavaScript
"use strict";
|
|
|
|
const test = require("node:test");
|
|
const assert = require("node:assert/strict");
|
|
const { signWithRecovery } = require("./fidoSignFlow.cjs");
|
|
const prompts = require("./fidoPromptHandler.cjs");
|
|
|
|
test("a signature arriving after cancellation is never returned to SSH", async () => {
|
|
const context = { leaseId: "cancelled-sign", controller: new AbortController() };
|
|
const result = await signWithRecovery(context, {}, callback => {
|
|
context.controller.abort();
|
|
callback(null, Buffer.from("late signature"));
|
|
});
|
|
assert.equal(result.error.code, "ERR_FIDO_CANCELLED");
|
|
assert.equal(result.signature, undefined);
|
|
});
|
|
|
|
test("a device result after the deadline requires recovery even if its signature is valid", async () => {
|
|
const context = { leaseId: "late-sign", controller: new AbortController() };
|
|
const received = [];
|
|
const sender = { id: 311, isDestroyed: () => false, send(channel, request) {
|
|
if (channel !== "netcatty:fido-prompt-request") return;
|
|
received.push(request);
|
|
queueMicrotask(() => prompts.handleResponse({ sender }, { requestId: request.requestId, cancelled: true }));
|
|
} };
|
|
const result = await signWithRecovery(context, { resolveWebContents: () => sender }, callback => {
|
|
context.timedOut = true;
|
|
callback(null, Buffer.from("late signature"));
|
|
});
|
|
assert.equal(received[0].reason, "timeout");
|
|
assert.equal(result.error.code, "ERR_FIDO_CANCELLED");
|
|
assert.equal(result.signature, undefined);
|
|
});
|
|
|
|
test("losing the prompt window fails closed instead of choosing a saved password", async () => {
|
|
const context = { leaseId: "missing-window", controller: new AbortController() };
|
|
const result = await signWithRecovery(context, { password: "test-only", resolveWebContents: () => null }, callback => {
|
|
callback(new Error("agent refused"));
|
|
});
|
|
assert.equal(result.error.code, "ERR_FIDO_CANCELLED");
|
|
});
|