Merge commit from fork

This commit is contained in:
ZacharyZcR
2026-07-15 14:21:13 +08:00
committed by GitHub
parent 867058bddd
commit b0598294a6
@@ -3,7 +3,7 @@ import type {
CredentialBackend, CredentialBackend,
} from "../../../types/index.js"; } from "../../../types/index.js";
import type { Request, RequestHandler, Response, Router } from "express"; import type { Request, RequestHandler, Response, Router } from "express";
import { eq } from "drizzle-orm"; import { and, eq } from "drizzle-orm";
import ssh2Pkg from "ssh2"; import ssh2Pkg from "ssh2";
import { db } from "../db/index.js"; import { db } from "../db/index.js";
import { hosts, sshCredentials } from "../db/schema.js"; import { hosts, sshCredentials } from "../db/schema.js";
@@ -432,7 +432,12 @@ export function registerCredentialDeployRoutes(
db db
.select() .select()
.from(sshCredentials) .from(sshCredentials)
.where(eq(sshCredentials.id, credentialId)) .where(
and(
eq(sshCredentials.id, credentialId),
eq(sshCredentials.userId, userId),
),
)
.limit(1), .limit(1),
"ssh_credentials", "ssh_credentials",
userId, userId,
@@ -462,7 +467,11 @@ export function registerCredentialDeployRoutes(
}); });
} }
const targetHost = await SimpleDBOps.select( const targetHost = await SimpleDBOps.select(
db.select().from(hosts).where(eq(hosts.id, targetHostId)).limit(1), db
.select()
.from(hosts)
.where(and(eq(hosts.id, targetHostId), eq(hosts.userId, userId)))
.limit(1),
"ssh_data", "ssh_data",
userId, userId,
); );