Fix credential auth optional password (#1009)

This commit is contained in:
ZacharyZcR
2026-07-10 08:03:14 +08:00
committed by GitHub
parent 37560fa133
commit 6b98b86969
8 changed files with 79 additions and 14 deletions
+2 -1
View File
@@ -4,6 +4,7 @@ import { eq, and } from "drizzle-orm";
import { SimpleDBOps } from "../utils/simple-db-ops.js";
import { logger } from "../utils/logger.js";
import {
pickResolvedPassword,
pickResolvedUsername,
expandOidcUsername,
} from "./credential-username.js";
@@ -190,7 +191,7 @@ export async function resolveHostById(
if (credentials.length > 0) {
const cred = credentials[0] as Record<string, unknown>;
host.password = cred.password;
host.password = pickResolvedPassword(host.password, cred.password);
// Prefer the normalised private key; fall back to raw key field
host.key = (cred.privateKey || cred.key) as string | null;
host.keyPassword = cred.keyPassword;