fix(jump-host): Filter SSH connection targets to managed hosts only v1.17.2
Pull Request Tests / Run Tests (20.x) (push) Failing after 1m4s
Pull Request Tests / Run Tests (22.x) (push) Failing after 1m3s
Pull Request Tests / Test Summary (push) Failing after 4s

This commit is contained in:
2026-08-03 13:57:11 -04:00
parent c56bfe21e5
commit 36e7dbf8aa
2 changed files with 13 additions and 3 deletions
+12 -2
View File
@@ -46,9 +46,19 @@ if (conf.standalone && conf.standalone.enabled) {
// Every host in the inventory, unfiltered — for admins (the web UI's own
// account is already gated by requireAdmin before this is ever called).
function isManagedHost(r) {
if (!r || r.kind !== 'host') return false;
// If managed attribute is present, require it to be true/truthy
if (r.metadata && r.metadata.managed !== undefined) {
return r.metadata.managed === true || r.metadata.managed === 'true';
}
// Default to true for manually created hosts that lack explicit managed metadata
return true;
}
async function allHosts({ fetchImpl = fetch } = {}) {
const resources = await directoryClient({ fetchImpl }).getResourcesByGroup(undefined, { kind: 'host' });
return resources.filter(r => r.kind === 'host');
return resources.filter(isManagedHost);
}
async function accessibleHosts(user, { fetchImpl = fetch } = {}) {
@@ -62,7 +72,7 @@ if (conf.standalone && conf.standalone.enabled) {
console.error(`[access] ${error.message}`);
}
const hosts = resources.filter(r => r.kind === 'host');
const hosts = resources.filter(isManagedHost);
cache.set(user.uid, { at: Date.now(), hosts });
return hosts;
}