mirror of
https://github.com/Termix-SSH/Termix.git
synced 2026-10-29 22:55:24 +00:00
fix: honor shared credentials on shared hosts (#1730)
* fix: honor shared credentials on shared hosts and in personal SSH auth * fix: snapshot shared SSH auth from a credential shared with the host owner
This commit is contained in:
1 parent
3173f45e7e
commit
ffe757f91d
6 files changed
+133
-23
No files matched your search
@@ -12,6 +12,7 @@ import type {
|
||||
} from "../database/repositories/host-resolution-repository.js";
|
||||
import { getSshAuthProvider } from "../hosts/connect/auth-provider-registry.js";
|
||||
import { ensureCoreSshAuthProviders } from "../hosts/connect/core-providers.js";
|
||||
import { findUsableCredential } from "../hosts/usable-credential.js";
|
||||
import {
|
||||
SharedHostSecretsManager,
|
||||
type SharedSecretData,
|
||||
@@ -80,10 +81,7 @@ export async function resolveRecipientSharedHostAuthentication(
|
||||
}
|
||||
|
||||
if (overrideCredentialId) {
|
||||
const credential = await repository.findCredentialByIdForUser(
|
||||
overrideCredentialId,
|
||||
userId,
|
||||
);
|
||||
const credential = await findUsableCredential(overrideCredentialId, userId);
|
||||
if (credential) {
|
||||
return {
|
||||
source: "personal-override",
|
||||
@@ -145,6 +143,17 @@ export async function resolveRecipientSharedHostAuthentication(
|
||||
}
|
||||
}
|
||||
|
||||
if (protocol === "ssh" && host.credentialId) {
|
||||
const credential = await findUsableCredential(host.credentialId, userId);
|
||||
if (credential) {
|
||||
return {
|
||||
source: "personal-override",
|
||||
credentialId: host.credentialId,
|
||||
credential,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
return requiresPersonalHostAuthentication(host, protocol)
|
||||
? { source: "required" }
|
||||
: { source: "secretless" };
|
||||
|
||||
Reference in new issue
Block a user