This commit is contained in:
jarek committed 2026-06-19 08:21:22 +02:00
1 parent efb634701c
commit ce12d7ae9f
17 files changed
+284 -203

No files matched your search

+5 -1
View File
@@ -166,7 +166,11 @@ RUN mkdir -p /home/dockhand/.dockhand/stacks /app/data \
EXPOSE 3000 EXPOSE 3000
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \ HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
CMD curl -f http://localhost:${PORT:-3000}/ || exit 1 CMD if [ "$(echo "${HTTPS_MODE:-off}" | tr '[:upper:]' '[:lower:]')" = "on" ]; then \
curl -fsk https://localhost:${PORT:-3000}/ || exit 1; \
else \
curl -fs http://localhost:${PORT:-3000}/ || exit 1; \
fi
ENTRYPOINT ["/sbin/tini", "--", "/usr/local/bin/docker-entrypoint.sh"] ENTRYPOINT ["/sbin/tini", "--", "/usr/local/bin/docker-entrypoint.sh"]
CMD [] CMD []
+1 -1
View File
@@ -1 +1 @@
v1.0.34 v1.0.35
+3 -3
View File
@@ -1,7 +1,7 @@
{ {
"name": "dockhand", "name": "dockhand",
"private": true, "private": true,
"version": "1.0.34", "version": "1.0.35",
"type": "module", "type": "module",
"scripts": { "scripts": {
"dev": "npx vite dev", "dev": "npx vite dev",
@@ -80,7 +80,7 @@
"devalue": "5.8.1", "devalue": "5.8.1",
"drizzle-orm": "0.45.2", "drizzle-orm": "0.45.2",
"fast-xml-parser": "5.7.3", "fast-xml-parser": "5.7.3",
"js-yaml": "4.1.1", "js-yaml": "4.2.0",
"ldapts": "8.1.3", "ldapts": "8.1.3",
"nodemailer": "8.0.9", "nodemailer": "8.0.9",
"otpauth": "9.4.1", "otpauth": "9.4.1",
@@ -88,7 +88,7 @@
"qrcode": "1.5.4", "qrcode": "1.5.4",
"rollup": "4.60.0", "rollup": "4.60.0",
"svelte-sonner": "1.0.7", "svelte-sonner": "1.0.7",
"undici": "7.24.5", "undici": "7.28.0",
"ws": "8.21.0" "ws": "8.21.0"
}, },
"devDependencies": { "devDependencies": {
+13
View File
@@ -1,4 +1,17 @@
[ [
{
"version": "1.0.35",
"date": "2026-06-19",
"changes": [
{ "type": "feature", "text": "image prune skips Dockhand's scanner images (grype, trivy), configurable (#625)" },
{ "type": "fix", "text": "\"No archive\" download format selection not persisted (#1180)" },
{ "type": "fix", "text": "regression: vulnerability scans on direct-TCP envs (#1195)" },
{ "type": "fix", "text": "Pangolin labels — recognise the real `public-resources` / `private-resources` namespaces (#2)" },
{ "type": "fix", "text": "healthcheck uses HTTPS probe when HTTPS_MODE=on (#1191)" },
{ "type": "fix", "text": "shell detection improved for containers with non-standard PATH or shell locations (#1189)" }
],
"imageTag": "fnsys/dockhand:v1.0.35"
},
{ {
"version": "1.0.34", "version": "1.0.34",
"date": "2026-06-17", "date": "2026-06-17",
+1 -1
View File
@@ -547,7 +547,7 @@
}, },
{ {
"name": "js-yaml", "name": "js-yaml",
"version": "4.1.1", "version": "4.2.0",
"license": "MIT", "license": "MIT",
"repository": "https://github.com/nodeca/js-yaml" "repository": "https://github.com/nodeca/js-yaml"
}, },
+64 -6
View File
@@ -13,7 +13,7 @@ import * as https from 'node:https';
import * as tls from 'node:tls'; import * as tls from 'node:tls';
import { createHash } from 'node:crypto'; import { createHash } from 'node:crypto';
import type { Environment } from './db'; import type { Environment } from './db';
import { getStackEnvVarsAsRecord } from './db'; import { getStackEnvVarsAsRecord, getSetting } from './db';
import { getAdditionalVolumeBinds } from './mount-dedupe'; import { getAdditionalVolumeBinds } from './mount-dedupe';
import { encodeRegistryAuth } from './registry-auth'; import { encodeRegistryAuth } from './registry-auth';
import { isSystemContainer } from './scheduler/tasks/update-utils'; import { isSystemContainer } from './scheduler/tasks/update-utils';
@@ -4271,11 +4271,69 @@ export async function pruneContainers(envId?: number | null) {
} }
export async function pruneImages(dangling = true, envId?: number | null) { export async function pruneImages(dangling = true, envId?: number | null) {
// dangling=true: only remove untagged images (default Docker behavior) // dangling=true: only remove untagged images. Pass straight through —
// dangling=false: remove ALL unused images including tagged ones // scanner images are always tagged so they can't be dangling anyway.
// Docker API quirk: to remove all unused, we pass dangling=false filter if (dangling) {
const filters = dangling ? '{"dangling":["true"]}' : '{"dangling":["false"]}'; return dockerJsonRequest(
return dockerJsonRequest(`/images/prune?filters=${encodeURIComponent(filters)}`, { method: 'POST' }, envId); `/images/prune?filters=${encodeURIComponent('{"dangling":["true"]}')}`,
{ method: 'POST' },
envId
);
}
// dangling=false: "prune all unused." When the scanner-protection setting
// is on, shield grype + trivy with stopped holder containers (Docker's
// "in use" check keeps them) then tear them down in a finally (#625).
const protect = (await getSetting('protect_scanner_images')) !== false;
if (!protect) {
return dockerJsonRequest(
`/images/prune?filters=${encodeURIComponent('{"dangling":["false"]}')}`,
{ method: 'POST' },
envId
);
}
const { DEFAULT_GRYPE_IMAGE, DEFAULT_TRIVY_IMAGE } = await import('./scanner');
const grypeImg = (await getSetting('default_grype_image')) ?? DEFAULT_GRYPE_IMAGE;
const trivyImg = (await getSetting('default_trivy_image')) ?? DEFAULT_TRIVY_IMAGE;
const holderIds: string[] = [];
for (const image of [grypeImg, trivyImg]) {
try {
const safeName = `dockhand-prune-keep-${image.replace(/[^a-z0-9]/gi, '-')}-${Date.now()}`;
const created = await dockerJsonRequest<{ Id: string }>(
`/containers/create?name=${encodeURIComponent(safeName)}`,
{
method: 'POST',
body: JSON.stringify({ Image: image, Cmd: ['/bin/true'] })
},
envId
);
holderIds.push(created.Id);
} catch {
// Image not present locally → nothing to protect → no-op
}
}
try {
return await dockerJsonRequest(
`/images/prune?filters=${encodeURIComponent('{"dangling":["false"]}')}`,
{ method: 'POST' },
envId
);
} finally {
for (const id of holderIds) {
try {
await dockerJsonRequest(
`/containers/${id}?force=true`,
{ method: 'DELETE' },
envId
);
} catch {
// Best-effort cleanup; orphan holders are visible but harmless
}
}
}
} }
export async function pruneVolumes(envId?: number | null) { export async function pruneVolumes(envId?: number | null) {
+2 -24
View File
@@ -669,31 +669,9 @@ async function runScannerContainerCore(
// detection failure — no regression for stock Docker hosts. // detection failure — no regression for stock Docker hosts.
hostSocketPath = await detectRemoteSocketPath(envId); hostSocketPath = await detectRemoteSocketPath(envId);
console.log(`[Scanner] Remote scan via Hawser (${connectionType}) - detected socket path: ${hostSocketPath}`); console.log(`[Scanner] Remote scan via Hawser (${connectionType}) - detected socket path: ${hostSocketPath}`);
} else if (connectionType === 'direct' && env?.host) {
// Direct TCP to a remote daemon (e.g. Docker over TCP, Podman over TCP).
// The scanner container is created on the REMOTE daemon, not on
// Dockhand's host. Binding "/var/run/docker.sock" from Dockhand's
// host into a remote-daemon container is nonsense — on remote Docker
// it silently creates an empty dir (scans fall back to registry); on
// rootless Podman it errors with "mkdir /var/run/docker.sock:
// permission denied" (#1076, #1011). Instead, tell the scanner to
// talk to the daemon over the same TCP endpoint Dockhand uses.
// `host.containers.internal` resolves to the daemon's host from
// inside the scanner container on both Docker (with `host-gateway`)
// and Podman (built-in).
scannerDockerHost = `tcp://host.containers.internal:${env.port}`;
// Add the host-gateway mapping so Docker honours the hostname.
// Podman recognises host.containers.internal natively; the extra
// mapping is harmless there.
scannerExtraHosts = [
...(scannerExtraHosts ?? []),
'host.containers.internal:host-gateway'
];
console.log(
`[Scanner] Direct TCP env (${env.protocol ?? 'http'}://${env.host}:${env.port}) - DOCKER_HOST=${scannerDockerHost} (#1076, #1011)`
);
} else { } else {
// Local socket — detect host socket path (handles rootless Docker) // Local socket — handles rootless Docker and direct-TCP envs
// (the latter via the same socket bind; see #1195, #1076).
hostSocketPath = getHostDockerSocket(); hostSocketPath = getHostDockerSocket();
console.log(`[Scanner] Local socket scan (${connectionType || 'default'}) - detected host Docker socket: ${hostSocketPath}`); console.log(`[Scanner] Local socket scan (${connectionType || 'default'}) - detected host Docker socket: ${hostSocketPath}`);
+22
View File
@@ -0,0 +1,22 @@
/**
* Filename gate for stack writes (#1196).
*
* Lives in its own file so unit tests can import the helper without pulling
* in stacks.ts (which transitively imports the DB layer and won't load
* under bun:test).
*
* v1.0.34 locked compose/env paths to a hardcoded set (docker-compose.yml,
* compose.yml, .env) which broke users who name their compose files after
* the service (e.g. `headscale.yml`). v1.0.35 relaxes to any .yml / .yaml
* file plus the `.env` family. The load-bearing security control is the
* containment + symlink-realpath + traversal checks in validateStackPath() —
* this gate is belt-and-suspenders to keep the write path producing
* stack-shaped files. Still blocks authorized_keys, evil.sh, /etc/cron.d/x.
*/
// Matches: foo.yml, foo.yaml, .env, foo.env, .env.local, prod.env.staging
export const STACK_FILENAME_RE = /\.ya?ml$|(^|\.)env(\.|$)/;
export function isAllowedStackFilename(filename: string): boolean {
return STACK_FILENAME_RE.test(filename);
}
+18 -95
View File
@@ -18,6 +18,7 @@ import {
type DeletionApplyResult, type DeletionApplyResult,
type DeletionSkipReason type DeletionSkipReason
} from './git-deletions'; } from './git-deletions';
import { isAllowedStackFilename } from './stack-filename';
import { import {
getEnvironment, getEnvironment,
getSecretEnvVarsAsRecord, getSecretEnvVarsAsRecord,
@@ -34,9 +35,7 @@ import {
removePendingContainerUpdate, removePendingContainerUpdate,
deleteAutoUpdateSchedule, deleteAutoUpdateSchedule,
getAutoUpdateSetting, getAutoUpdateSetting,
getStackSourceByComposePath, getStackSourceByComposePath
getExternalStackPaths,
addExternalStackPath
} from './db'; } from './db';
import { unregisterSchedule } from './scheduler'; import { unregisterSchedule } from './scheduler';
import { deleteGitStackFiles, parseEnvFileContent } from './git'; import { deleteGitStackFiles, parseEnvFileContent } from './git';
@@ -350,19 +349,6 @@ export async function getStackDir(stackName: string, envId?: number | null): Pro
return join(stacksDir, stackName); return join(stacksDir, stackName);
} }
/**
* Filenames a stack is allowed to write. Compose files in the conventional
* names + .env. Anything else is rejected even when the directory is in
* the allowlist, so this code path can only ever produce stack-shaped files.
*/
const ALLOWED_STACK_FILENAMES = new Set([
'docker-compose.yml',
'docker-compose.yaml',
'compose.yml',
'compose.yaml',
'.env'
]);
/** /**
* Resolve a path against the parent's realpath when the parent exists, so * Resolve a path against the parent's realpath when the parent exists, so
* symlinks resolve to their canonical location. We can't realpath the leaf * symlinks resolve to their canonical location. We can't realpath the leaf
@@ -381,13 +367,6 @@ function resolveStackPath(input: string): string {
return abs; return abs;
} }
function isInside(child: string, parent: string): boolean {
const c = pathNormalize(child);
const p = pathNormalize(parent);
if (c === p) return true;
return c.startsWith(p.endsWith(pathSep) ? p : p + pathSep);
}
export interface StackPathValidation { export interface StackPathValidation {
ok: boolean; ok: boolean;
error?: string; error?: string;
@@ -396,15 +375,10 @@ export interface StackPathValidation {
/** /**
* Validate that a custom compose or env file path is writable by this code * Validate that a custom compose or env file path is writable by this code
* path. A path is accepted when it lives inside getStacksDir() or any * path. A path is accepted when:
* directory in the external_stack_paths allowlist (admin-controlled, set * - filename matches the stack-filename gate (.yml/.yaml/.env family)
* in Settings → General), its filename is one of the conventional * - normalized form contains no .. segments (parent directory resolved
* compose/env names, and it does not contain .. segments. The parent is * via realpath so a symlinked component can't smuggle traversal in)
* resolved via realpath so a symlinked component inside an allowlisted dir
* cannot point elsewhere.
*
* Callers that need to grandfather an existing admin-configured path should
* call validateStackPathWithGrandfather() instead.
*/ */
export async function validateStackPath(input: string): Promise<StackPathValidation> { export async function validateStackPath(input: string): Promise<StackPathValidation> {
if (!input || typeof input !== 'string') { if (!input || typeof input !== 'string') {
@@ -420,53 +394,14 @@ export async function validateStackPath(input: string): Promise<StackPathValidat
} }
const filename = basename(resolvedPath); const filename = basename(resolvedPath);
if (!ALLOWED_STACK_FILENAMES.has(filename)) { if (!isAllowedStackFilename(filename)) {
return { return {
ok: false, ok: false,
error: `File "${filename}" is not an allowed stack filename (expected one of: ${[...ALLOWED_STACK_FILENAMES].join(', ')})` error: `File "${filename}" is not an allowed stack filename (must end in .yml, .yaml, or .env)`
}; };
} }
const stacksDir = getStacksDir(); return { ok: true, resolved: resolvedPath };
if (isInside(resolvedPath, stacksDir)) {
return { ok: true, resolved: resolvedPath };
}
const allowlist = await getExternalStackPaths();
for (const dir of allowlist) {
if (!dir) continue;
const dirResolved = resolve(dir);
if (isInside(resolvedPath, dirResolved)) {
return { ok: true, resolved: resolvedPath };
}
}
return {
ok: false,
error: `Path "${resolvedPath}" is not inside an allowed stack directory. Add its parent directory in Settings → General → External stack paths.`
};
}
/**
* Same as validateStackPath, but when the path comes from an existing
* stack source row (a stored custom path the admin set previously) and
* fails the allowlist check, add its parent dir to external_stack_paths
* and re-validate. Lets old custom-path configurations keep working
* without operator intervention.
*/
export async function validateStackPathWithGrandfather(
input: string,
isPreExisting: boolean
): Promise<StackPathValidation> {
const first = await validateStackPath(input);
if (first.ok || !isPreExisting) return first;
const parent = dirname(resolveStackPath(input));
const added = await addExternalStackPath(parent);
if (added) {
console.log(`[Stack] Grandfathered pre-existing custom path: ${parent}`);
}
return validateStackPath(input);
} }
/** /**
@@ -675,28 +610,16 @@ export async function saveStackComposeFile(
const source = await getStackSource(name, envId); const source = await getStackSource(name, envId);
const composePath = options?.composePath || source?.composePath; const composePath = options?.composePath || source?.composePath;
// Path-allowlist validation. Pre-existing stored paths grandfather into // Validate every caller-supplied or stored path before any disk write.
// the allowlist; new caller-supplied paths must already be inside it.
// See validateStackPath() docs. // See validateStackPath() docs.
if (composePath) { const pathsToCheck = [
const fromDb = !options?.composePath && !!source?.composePath; composePath,
const v = await validateStackPathWithGrandfather(composePath, fromDb); options?.envPath ?? source?.envPath,
if (!v.ok) return { success: false, error: v.error }; options?.oldComposePath,
} options?.oldEnvPath
if (options?.envPath) { ].filter((p): p is string => !!p);
const v = await validateStackPath(options.envPath); for (const path of pathsToCheck) {
if (!v.ok) return { success: false, error: v.error }; const v = await validateStackPath(path);
} else if (source?.envPath && !options?.envPath) {
// Grandfather a DB-stored env path that may have been configured before validation.
const v = await validateStackPathWithGrandfather(source.envPath, true);
if (!v.ok) return { success: false, error: v.error };
}
if (options?.oldComposePath) {
const v = await validateStackPathWithGrandfather(options.oldComposePath, true);
if (!v.ok) return { success: false, error: v.error };
}
if (options?.oldEnvPath) {
const v = await validateStackPathWithGrandfather(options.oldEnvPath, true);
if (!v.ok) return { success: false, error: v.error }; if (!v.ok) return { success: false, error: v.error };
} }
+13 -2
View File
@@ -41,6 +41,7 @@ export interface AppSettings {
labelFilterMode: LabelFilterMode; labelFilterMode: LabelFilterMode;
honorProxyLabels: boolean; honorProxyLabels: boolean;
showImageChangelogLinks: boolean; showImageChangelogLinks: boolean;
protectScannerImages: boolean;
} }
const DEFAULT_SETTINGS: AppSettings = { const DEFAULT_SETTINGS: AppSettings = {
@@ -76,6 +77,7 @@ const DEFAULT_SETTINGS: AppSettings = {
labelFilterMode: 'any', labelFilterMode: 'any',
honorProxyLabels: true, honorProxyLabels: true,
showImageChangelogLinks: true, showImageChangelogLinks: true,
protectScannerImages: true,
defaultComposeTemplate: `version: "3.8" defaultComposeTemplate: `version: "3.8"
services: services:
@@ -157,7 +159,8 @@ function createSettingsStore() {
defaultComposeTemplate: settings.defaultComposeTemplate ?? DEFAULT_SETTINGS.defaultComposeTemplate, defaultComposeTemplate: settings.defaultComposeTemplate ?? DEFAULT_SETTINGS.defaultComposeTemplate,
labelFilterMode: settings.labelFilterMode ?? DEFAULT_SETTINGS.labelFilterMode, labelFilterMode: settings.labelFilterMode ?? DEFAULT_SETTINGS.labelFilterMode,
honorProxyLabels: settings.honorProxyLabels ?? DEFAULT_SETTINGS.honorProxyLabels, honorProxyLabels: settings.honorProxyLabels ?? DEFAULT_SETTINGS.honorProxyLabels,
showImageChangelogLinks: settings.showImageChangelogLinks ?? DEFAULT_SETTINGS.showImageChangelogLinks showImageChangelogLinks: settings.showImageChangelogLinks ?? DEFAULT_SETTINGS.showImageChangelogLinks,
protectScannerImages: settings.protectScannerImages ?? DEFAULT_SETTINGS.protectScannerImages
}); });
} }
} catch { } catch {
@@ -210,7 +213,8 @@ function createSettingsStore() {
defaultComposeTemplate: updatedSettings.defaultComposeTemplate ?? DEFAULT_SETTINGS.defaultComposeTemplate, defaultComposeTemplate: updatedSettings.defaultComposeTemplate ?? DEFAULT_SETTINGS.defaultComposeTemplate,
labelFilterMode: updatedSettings.labelFilterMode ?? DEFAULT_SETTINGS.labelFilterMode, labelFilterMode: updatedSettings.labelFilterMode ?? DEFAULT_SETTINGS.labelFilterMode,
honorProxyLabels: updatedSettings.honorProxyLabels ?? DEFAULT_SETTINGS.honorProxyLabels, honorProxyLabels: updatedSettings.honorProxyLabels ?? DEFAULT_SETTINGS.honorProxyLabels,
showImageChangelogLinks: updatedSettings.showImageChangelogLinks ?? DEFAULT_SETTINGS.showImageChangelogLinks showImageChangelogLinks: updatedSettings.showImageChangelogLinks ?? DEFAULT_SETTINGS.showImageChangelogLinks,
protectScannerImages: updatedSettings.protectScannerImages ?? DEFAULT_SETTINGS.protectScannerImages
}); });
} }
} catch (error) { } catch (error) {
@@ -461,6 +465,13 @@ function createSettingsStore() {
return newSettings; return newSettings;
}); });
}, },
setProtectScannerImages: (value: boolean) => {
update((current) => {
const newSettings = { ...current, protectScannerImages: value };
saveSettings({ protectScannerImages: value });
return newSettings;
});
},
setShowImageChangelogLinks: (value: boolean) => { setShowImageChangelogLinks: (value: boolean) => {
update((current) => { update((current) => {
const newSettings = { ...current, showImageChangelogLinks: value }; const newSettings = { ...current, showImageChangelogLinks: value };
+26 -16
View File
@@ -2,16 +2,20 @@
* Pangolin label → public URL extraction (#2 follow-up). * Pangolin label → public URL extraction (#2 follow-up).
* *
* Pangolin Blueprints (https://docs.pangolin.net/manage/blueprints) annotates * Pangolin Blueprints (https://docs.pangolin.net/manage/blueprints) annotates
* a container with one or more proxy resources. The relevant labels for URL * a container with one or more resources, scoped public OR private. The
* extraction are: * relevant labels for URL extraction are:
* *
* pangolin.proxy-resources.<name>.name human-friendly label * pangolin.public-resources.<name>.name human-friendly label
* pangolin.proxy-resources.<name>.full-domain public hostname (mandatory) * pangolin.public-resources.<name>.full-domain public hostname (mandatory)
* pangolin.proxy-resources.<name>.protocol http | https (defaults to https) * pangolin.public-resources.<name>.protocol http | https (defaults to https)
* pangolin.private-resources.<name>.{name,full-domain,protocol} private equivalents
*
* Both scopes resolve to a URL the user can click. The scope (`public`/
* `private`) is preserved on the result so callers can label or filter.
* *
* The `targets[N].port` family is intentionally ignored — Pangolin terminates * The `targets[N].port` family is intentionally ignored — Pangolin terminates
* the public connection at full-domain; the internal target port is not part * the connection at full-domain; the internal target port is not part of the
* of the URL a user sees. * URL a user sees.
* *
* Returns one URL per resource that declares a full-domain. Multiple * Returns one URL per resource that declares a full-domain. Multiple
* resources on the same container yield multiple URLs. Identical URLs across * resources on the same container yield multiple URLs. Identical URLs across
@@ -24,32 +28,37 @@ export interface PangolinUrl {
url: string; url: string;
/** The Pangolin resource key (the `<name>` in the label key). */ /** The Pangolin resource key (the `<name>` in the label key). */
resource: string; resource: string;
/** Scope from the label namespace — public or private. */
scope: 'public' | 'private';
/** Optional human-friendly name from the `.name` label, if set. */ /** Optional human-friendly name from the `.name` label, if set. */
displayName?: string; displayName?: string;
} }
const RESOURCE_KEY_RE = const RESOURCE_KEY_RE =
/^pangolin\.proxy-resources\.([^.]+)\.(full-domain|protocol|name)$/; /^pangolin\.(public|private)-resources\.([^.]+)\.(full-domain|protocol|name)$/;
export function extractPangolinUrls( export function extractPangolinUrls(
labels: Record<string, string> | undefined | null labels: Record<string, string> | undefined | null
): PangolinUrl[] { ): PangolinUrl[] {
if (!labels) return []; if (!labels) return [];
// Group label values by resource key. // Group label values by (scope, resource) key. A single resource name can
// legitimately appear under both scopes (rare but allowed by Pangolin);
// they're treated as independent resources here.
const byResource = new Map< const byResource = new Map<
string, string,
{ fullDomain?: string; protocol?: string; name?: string } { scope: 'public' | 'private'; resource: string; fullDomain?: string; protocol?: string; name?: string }
>(); >();
for (const [key, value] of Object.entries(labels)) { for (const [key, value] of Object.entries(labels)) {
const m = key.match(RESOURCE_KEY_RE); const m = key.match(RESOURCE_KEY_RE);
if (!m) continue; if (!m) continue;
const [, resource, field] = m; const [, scope, resource, field] = m as unknown as [string, 'public' | 'private', string, string];
let entry = byResource.get(resource); const groupKey = `${scope}:${resource}`;
let entry = byResource.get(groupKey);
if (!entry) { if (!entry) {
entry = {}; entry = { scope, resource };
byResource.set(resource, entry); byResource.set(groupKey, entry);
} }
const v = (value ?? '').trim(); const v = (value ?? '').trim();
if (!v) continue; if (!v) continue;
@@ -61,7 +70,7 @@ export function extractPangolinUrls(
const out: PangolinUrl[] = []; const out: PangolinUrl[] = [];
const seen = new Set<string>(); const seen = new Set<string>();
for (const [resource, entry] of byResource) { for (const entry of byResource.values()) {
if (!entry.fullDomain) continue; if (!entry.fullDomain) continue;
const proto = const proto =
@@ -75,7 +84,8 @@ export function extractPangolinUrls(
out.push({ out.push({
url, url,
resource, resource: entry.resource,
scope: entry.scope,
displayName: entry.name displayName: entry.name
}); });
} }
+12 -4
View File
@@ -135,16 +135,24 @@ export async function detectShells(
/** /**
* Get the best available shell from the detection result * Get the best available shell from the detection result
* Returns the user's preferred shell if available, otherwise the default * Returns the user's preferred shell if available, otherwise the default
*
* Preference matching is by shell name (basename), not full path — so a
* preference of `/bin/bash` will still match when the server resolved bash
* to a non-standard path like `/usr/bin/bash` (issue #1189).
*/ */
export function getBestShell( export function getBestShell(
result: ShellDetectionResult, result: ShellDetectionResult,
preferredShell: string preferredShell: string
): string | null { ): string | null {
// If preferred shell is available, use it const exact = result.shells.find(s => s === preferredShell);
if (result.shells.includes(preferredShell)) { if (exact) return exact;
return preferredShell;
const preferredName = preferredShell.split('/').pop();
if (preferredName) {
const byName = result.shells.find(s => s.split('/').pop() === preferredName);
if (byName) return byName;
} }
// Otherwise use the default shell
return result.defaultShell; return result.defaultShell;
} }
@@ -33,47 +33,64 @@ export const GET: RequestHandler = async ({ params, url, cookies }) => {
try { try {
const containerId = params.id; const containerId = params.id;
const availableShells: string[] = []; const shellNames = SHELLS_TO_CHECK.map(s => s.path.split('/').pop()!);
const namedPaths = new Map<string, string>(); // name → resolved absolute path
// Check each shell by testing if the file exists and is executable // Resolve each shell through the container's own PATH using `command -v`,
// Use a single command to check all shells at once for efficiency // so that images with shells at non-standard locations (e.g. /usr/bin/sh
const checkCommand = SHELLS_TO_CHECK.map(s => // where /bin/sh isn't a symlink, or PATH ordering that shadows the
`test -x ${s.path} && echo "${s.path}"` // shell-builtin `test`) still report correctly. `exit 0` at the end
).join('; '); // keeps the exec exit code clean even when some shells are absent —
// otherwise execInContainer treats non-zero as a thrown error and the
// valid output is discarded (issue #1189).
const probe =
`for s in ${shellNames.join(' ')}; do ` +
`p=$(command -v $s 2>/dev/null) && [ -n "$p" ] && echo "$s:$p"; ` +
`done; exit 0`;
try { try {
const output = await execInContainer( const output = await execInContainer(
containerId, containerId,
['sh', '-c', checkCommand], ['sh', '-c', probe],
envIdNum envIdNum
); );
// Parse output - each line is an available shell path for (const line of output.trim().split('\n').filter(Boolean)) {
const lines = output.trim().split('\n').filter(Boolean); const colon = line.indexOf(':');
availableShells.push(...lines); if (colon < 0) continue;
const name = line.slice(0, colon);
const resolved = line.slice(colon + 1);
if (resolved.startsWith('/')) namedPaths.set(name, resolved);
}
} catch { } catch {
// If even sh fails, try checking with test commands individually // `sh` itself was not invocable. Fall back to probing the canonical
// This handles edge cases where sh might not be available // paths directly with a non-shell-resolved test — exec each one
// against its absolute path and rely on docker exec's own
// "executable not found" failure to indicate absence. This handles
// the rare image where there's no `sh` at all but bash exists.
for (const shell of SHELLS_TO_CHECK) { for (const shell of SHELLS_TO_CHECK) {
try { try {
await execInContainer( await execInContainer(
containerId, containerId,
['test', '-x', shell.path], [shell.path, '-c', 'exit 0'],
envIdNum envIdNum
); );
availableShells.push(shell.path); const name = shell.path.split('/').pop()!;
namedPaths.set(name, shell.path);
} catch { } catch {
// Shell not available, continue to next // Shell not available at this path; try the next.
} }
} }
} }
const availableShells = Array.from(namedPaths.values());
// Determine default shell - prefer bash, then sh, then first available // Determine default shell - prefer bash, then sh, then first available
let defaultShell: string | null = null; let defaultShell: string | null = null;
if (availableShells.includes('/bin/bash')) { if (namedPaths.has('bash')) {
defaultShell = '/bin/bash'; defaultShell = namedPaths.get('bash')!;
} else if (availableShells.includes('/bin/sh')) { } else if (namedPaths.has('sh')) {
defaultShell = '/bin/sh'; defaultShell = namedPaths.get('sh')!;
} else if (availableShells.length > 0) { } else if (availableShells.length > 0) {
defaultShell = availableShells[0]; defaultShell = availableShells[0];
} }
@@ -81,11 +98,15 @@ export const GET: RequestHandler = async ({ params, url, cookies }) => {
return json({ return json({
shells: availableShells, shells: availableShells,
defaultShell, defaultShell,
allShells: SHELLS_TO_CHECK.map(s => ({ allShells: SHELLS_TO_CHECK.map(s => {
path: s.path, const name = s.path.split('/').pop()!;
label: s.label, const resolved = namedPaths.get(name);
available: availableShells.includes(s.path) return {
})) path: resolved ?? s.path,
label: s.label,
available: namedPaths.has(name)
};
})
}); });
} catch (error) { } catch (error) {
console.error('Error detecting shells:', error); console.error('Error detecting shells:', error);
+22 -9
View File
@@ -38,7 +38,7 @@ import { DEFAULT_GRYPE_IMAGE, DEFAULT_TRIVY_IMAGE } from '$lib/server/scanner';
export type TimeFormat = '12h' | '24h'; export type TimeFormat = '12h' | '24h';
export type DateFormat = 'MM/DD/YYYY' | 'DD/MM/YYYY' | 'YYYY-MM-DD' | 'DD.MM.YYYY'; export type DateFormat = 'MM/DD/YYYY' | 'DD/MM/YYYY' | 'YYYY-MM-DD' | 'DD.MM.YYYY';
export type DownloadFormat = 'tar' | 'tar.gz'; export type DownloadFormat = 'tar' | 'tar.gz' | 'raw';
export type EventCollectionMode = 'stream' | 'poll'; export type EventCollectionMode = 'stream' | 'poll';
export interface GeneralSettings { export interface GeneralSettings {
@@ -91,7 +91,8 @@ export interface GeneralSettings {
// Label filter mode // Label filter mode
labelFilterMode: 'any' | 'all'; labelFilterMode: 'any' | 'all';
// Whether to surface URLs inferred from reverse-proxy labels — currently // Whether to surface URLs inferred from reverse-proxy labels — currently
// Traefik (traefik.http.routers.*) and Pangolin (pangolin.proxy-resources.*). // Traefik (traefik.http.routers.*) and Pangolin
// (pangolin.{public,private}-resources.*).
// When false both parsers are bypassed and no proxy-derived pills are rendered. // When false both parsers are bypassed and no proxy-derived pills are rendered.
honorProxyLabels: boolean; honorProxyLabels: boolean;
// Whether to surface a "view changelog" link next to the update badge. // Whether to surface a "view changelog" link next to the update badge.
@@ -99,6 +100,8 @@ export interface GeneralSettings {
showImageChangelogLinks: boolean; showImageChangelogLinks: boolean;
// Whether spinning icons (animate-spin etc.) are animated (#1169) // Whether spinning icons (animate-spin etc.) are animated (#1169)
animateIcons: boolean; animateIcons: boolean;
// Skip Dockhand's scanner images (grype, trivy) during 'prune all unused' (#625)
protectScannerImages: boolean;
} }
const DEFAULT_SETTINGS: Omit<GeneralSettings, 'scheduleRetentionDays' | 'eventRetentionDays' | 'scheduleCleanupCron' | 'eventCleanupCron' | 'scheduleCleanupEnabled' | 'eventCleanupEnabled' | 'scannerCleanupCron' | 'scannerCleanupEnabled'> = { const DEFAULT_SETTINGS: Omit<GeneralSettings, 'scheduleRetentionDays' | 'eventRetentionDays' | 'scheduleCleanupCron' | 'eventCleanupCron' | 'scheduleCleanupEnabled' | 'eventCleanupEnabled' | 'scannerCleanupCron' | 'scannerCleanupEnabled'> = {
@@ -134,6 +137,7 @@ const DEFAULT_SETTINGS: Omit<GeneralSettings, 'scheduleRetentionDays' | 'eventRe
honorProxyLabels: true, honorProxyLabels: true,
showImageChangelogLinks: true, showImageChangelogLinks: true,
animateIcons: true, animateIcons: true,
protectScannerImages: true,
defaultComposeTemplate: `version: "3.8" defaultComposeTemplate: `version: "3.8"
services: services:
@@ -214,7 +218,8 @@ export const GET: RequestHandler = async ({ cookies }) => {
labelFilterMode, labelFilterMode,
honorProxyLabels, honorProxyLabels,
showImageChangelogLinks, showImageChangelogLinks,
animateIcons animateIcons,
protectScannerImages
] = await Promise.all([ ] = await Promise.all([
getSetting('confirm_destructive'), getSetting('confirm_destructive'),
getSetting('show_stopped_containers'), getSetting('show_stopped_containers'),
@@ -256,7 +261,8 @@ export const GET: RequestHandler = async ({ cookies }) => {
getSetting('label_filter_mode'), getSetting('label_filter_mode'),
getSetting('honor_proxy_labels'), getSetting('honor_proxy_labels'),
getSetting('show_image_changelog_links'), getSetting('show_image_changelog_links'),
getSetting('animate_icons') getSetting('animate_icons'),
getSetting('protect_scanner_images')
]); ]);
const settings: GeneralSettings = { const settings: GeneralSettings = {
@@ -302,7 +308,8 @@ export const GET: RequestHandler = async ({ cookies }) => {
labelFilterMode: labelFilterMode ?? DEFAULT_SETTINGS.labelFilterMode, labelFilterMode: labelFilterMode ?? DEFAULT_SETTINGS.labelFilterMode,
honorProxyLabels: honorProxyLabels ?? DEFAULT_SETTINGS.honorProxyLabels, honorProxyLabels: honorProxyLabels ?? DEFAULT_SETTINGS.honorProxyLabels,
showImageChangelogLinks: showImageChangelogLinks ?? DEFAULT_SETTINGS.showImageChangelogLinks, showImageChangelogLinks: showImageChangelogLinks ?? DEFAULT_SETTINGS.showImageChangelogLinks,
animateIcons: animateIcons ?? DEFAULT_SETTINGS.animateIcons animateIcons: animateIcons ?? DEFAULT_SETTINGS.animateIcons,
protectScannerImages: protectScannerImages ?? DEFAULT_SETTINGS.protectScannerImages
}; };
return json(settings); return json(settings);
@@ -320,7 +327,7 @@ export const POST: RequestHandler = async ({ request, cookies }) => {
try { try {
const body = await request.json(); const body = await request.json();
const { confirmDestructive, showStoppedContainers, highlightUpdates, timeFormat, dateFormat, downloadFormat, defaultGrypeArgs, defaultTrivyArgs, scheduleRetentionDays, eventRetentionDays, scheduleCleanupCron, eventCleanupCron, scheduleCleanupEnabled, eventCleanupEnabled, scannerCleanupCron, scannerCleanupEnabled, logBufferSizeKb, logMaxLines, defaultTimezone, eventCollectionMode, eventPollInterval, metricsCollectionInterval, lightTheme, darkTheme, font, fontSize, gridFontSize, terminalFont, editorFont, compactPorts, showExposedPorts, formatLogTimestamps, externalStackPaths, primaryStackLocation, defaultGrypeImage, defaultTrivyImage, defaultComposeTemplate, labelFilterMode, honorProxyLabels, showImageChangelogLinks, animateIcons } = body; const { confirmDestructive, showStoppedContainers, highlightUpdates, timeFormat, dateFormat, downloadFormat, defaultGrypeArgs, defaultTrivyArgs, scheduleRetentionDays, eventRetentionDays, scheduleCleanupCron, eventCleanupCron, scheduleCleanupEnabled, eventCleanupEnabled, scannerCleanupCron, scannerCleanupEnabled, logBufferSizeKb, logMaxLines, defaultTimezone, eventCollectionMode, eventPollInterval, metricsCollectionInterval, lightTheme, darkTheme, font, fontSize, gridFontSize, terminalFont, editorFont, compactPorts, showExposedPorts, formatLogTimestamps, externalStackPaths, primaryStackLocation, defaultGrypeImage, defaultTrivyImage, defaultComposeTemplate, labelFilterMode, honorProxyLabels, showImageChangelogLinks, animateIcons, protectScannerImages } = body;
if (confirmDestructive !== undefined) { if (confirmDestructive !== undefined) {
await setSetting('confirm_destructive', confirmDestructive); await setSetting('confirm_destructive', confirmDestructive);
@@ -337,7 +344,7 @@ export const POST: RequestHandler = async ({ request, cookies }) => {
if (dateFormat !== undefined && VALID_DATE_FORMATS.includes(dateFormat)) { if (dateFormat !== undefined && VALID_DATE_FORMATS.includes(dateFormat)) {
await setSetting('date_format', dateFormat); await setSetting('date_format', dateFormat);
} }
if (downloadFormat !== undefined && (downloadFormat === 'tar' || downloadFormat === 'tar.gz')) { if (downloadFormat !== undefined && (downloadFormat === 'tar' || downloadFormat === 'tar.gz' || downloadFormat === 'raw')) {
await setSetting('download_format', downloadFormat); await setSetting('download_format', downloadFormat);
} }
if (defaultGrypeArgs !== undefined && typeof defaultGrypeArgs === 'string') { if (defaultGrypeArgs !== undefined && typeof defaultGrypeArgs === 'string') {
@@ -469,6 +476,9 @@ export const POST: RequestHandler = async ({ request, cookies }) => {
if (animateIcons !== undefined && typeof animateIcons === 'boolean') { if (animateIcons !== undefined && typeof animateIcons === 'boolean') {
await setSetting('animate_icons', animateIcons); await setSetting('animate_icons', animateIcons);
} }
if (protectScannerImages !== undefined && typeof protectScannerImages === 'boolean') {
await setSetting('protect_scanner_images', protectScannerImages);
}
// Fetch all settings in parallel for the response // Fetch all settings in parallel for the response
const [ const [
@@ -512,7 +522,8 @@ export const POST: RequestHandler = async ({ request, cookies }) => {
labelFilterModeVal, labelFilterModeVal,
honorProxyLabelsVal, honorProxyLabelsVal,
showImageChangelogLinksVal, showImageChangelogLinksVal,
animateIconsVal animateIconsVal,
protectScannerImagesVal
] = await Promise.all([ ] = await Promise.all([
getSetting('confirm_destructive'), getSetting('confirm_destructive'),
getSetting('show_stopped_containers'), getSetting('show_stopped_containers'),
@@ -554,7 +565,8 @@ export const POST: RequestHandler = async ({ request, cookies }) => {
getSetting('label_filter_mode'), getSetting('label_filter_mode'),
getSetting('honor_proxy_labels'), getSetting('honor_proxy_labels'),
getSetting('show_image_changelog_links'), getSetting('show_image_changelog_links'),
getSetting('animate_icons') getSetting('animate_icons'),
getSetting('protect_scanner_images')
]); ]);
const settings: GeneralSettings = { const settings: GeneralSettings = {
@@ -599,6 +611,7 @@ export const POST: RequestHandler = async ({ request, cookies }) => {
defaultComposeTemplate: defaultComposeTemplateVal ?? DEFAULT_SETTINGS.defaultComposeTemplate, defaultComposeTemplate: defaultComposeTemplateVal ?? DEFAULT_SETTINGS.defaultComposeTemplate,
labelFilterMode: labelFilterModeVal ?? DEFAULT_SETTINGS.labelFilterMode, labelFilterMode: labelFilterModeVal ?? DEFAULT_SETTINGS.labelFilterMode,
honorProxyLabels: honorProxyLabelsVal ?? DEFAULT_SETTINGS.honorProxyLabels, honorProxyLabels: honorProxyLabelsVal ?? DEFAULT_SETTINGS.honorProxyLabels,
protectScannerImages: protectScannerImagesVal ?? DEFAULT_SETTINGS.protectScannerImages,
showImageChangelogLinks: showImageChangelogLinksVal ?? DEFAULT_SETTINGS.showImageChangelogLinks, showImageChangelogLinks: showImageChangelogLinksVal ?? DEFAULT_SETTINGS.showImageChangelogLinks,
animateIcons: animateIconsVal ?? DEFAULT_SETTINGS.animateIcons animateIcons: animateIconsVal ?? DEFAULT_SETTINGS.animateIcons
}; };
+9 -9
View File
@@ -91,31 +91,31 @@
</Tabs.Trigger> </Tabs.Trigger>
</Tabs.List> </Tabs.List>
<Tabs.Content value="general" class="flex-1 min-h-0 overflow-y-auto"> <Tabs.Content value="general" class="flex-1 min-h-0 overflow-y-auto pr-3">
{#if activeTab === 'general'}<GeneralTab />{/if} {#if activeTab === 'general'}<GeneralTab />{/if}
</Tabs.Content> </Tabs.Content>
<Tabs.Content value="environments" class="flex-1 min-h-0 overflow-y-auto"> <Tabs.Content value="environments" class="flex-1 min-h-0 overflow-y-auto pr-3">
{#if activeTab === 'environments'}<EnvironmentsTab {editEnvId} {newEnv} />{/if} {#if activeTab === 'environments'}<EnvironmentsTab {editEnvId} {newEnv} />{/if}
</Tabs.Content> </Tabs.Content>
<Tabs.Content value="labels" class="flex-1 min-h-0 overflow-y-auto"> <Tabs.Content value="labels" class="flex-1 min-h-0 overflow-y-auto pr-3">
{#if activeTab === 'labels'}<LabelsTab />{/if} {#if activeTab === 'labels'}<LabelsTab />{/if}
</Tabs.Content> </Tabs.Content>
<Tabs.Content value="registries" class="flex-1 min-h-0 overflow-y-auto"> <Tabs.Content value="registries" class="flex-1 min-h-0 overflow-y-auto pr-3">
{#if activeTab === 'registries'}<RegistriesTab />{/if} {#if activeTab === 'registries'}<RegistriesTab />{/if}
</Tabs.Content> </Tabs.Content>
<Tabs.Content value="git" class="flex-1 min-h-0 overflow-y-auto"> <Tabs.Content value="git" class="flex-1 min-h-0 overflow-y-auto pr-3">
{#if activeTab === 'git'}<GitTab />{/if} {#if activeTab === 'git'}<GitTab />{/if}
</Tabs.Content> </Tabs.Content>
<Tabs.Content value="config-sets" class="flex-1 min-h-0 overflow-y-auto"> <Tabs.Content value="config-sets" class="flex-1 min-h-0 overflow-y-auto pr-3">
{#if activeTab === 'config-sets'}<ConfigSetsTab />{/if} {#if activeTab === 'config-sets'}<ConfigSetsTab />{/if}
</Tabs.Content> </Tabs.Content>
<Tabs.Content value="notifications" class="flex-1 min-h-0 overflow-y-auto"> <Tabs.Content value="notifications" class="flex-1 min-h-0 overflow-y-auto pr-3">
{#if activeTab === 'notifications'}<NotificationsTab />{/if} {#if activeTab === 'notifications'}<NotificationsTab />{/if}
</Tabs.Content> </Tabs.Content>
@@ -123,11 +123,11 @@
{#if activeTab === 'auth'}<AuthTab onTabChange={handleTabChange} />{/if} {#if activeTab === 'auth'}<AuthTab onTabChange={handleTabChange} />{/if}
</Tabs.Content> </Tabs.Content>
<Tabs.Content value="license" class="flex-1 min-h-0 overflow-y-auto"> <Tabs.Content value="license" class="flex-1 min-h-0 overflow-y-auto pr-3">
{#if activeTab === 'license'}<LicenseTab />{/if} {#if activeTab === 'license'}<LicenseTab />{/if}
</Tabs.Content> </Tabs.Content>
<Tabs.Content value="about" class="flex-1 min-h-0 overflow-y-auto"> <Tabs.Content value="about" class="flex-1 min-h-0 overflow-y-auto pr-3">
{#if activeTab === 'about'}<AboutTab />{/if} {#if activeTab === 'about'}<AboutTab />{/if}
</Tabs.Content> </Tabs.Content>
</Tabs.Root> </Tabs.Root>
@@ -1586,7 +1586,7 @@
</Tabs.Trigger> </Tabs.Trigger>
</Tabs.List> </Tabs.List>
<div class="overflow-y-auto py-4 h-[520px] [scrollbar-gutter:stable] pr-1"> <div class="overflow-y-auto py-4 h-[520px] [scrollbar-gutter:stable] pr-3">
<!-- General Tab (Connection Settings) --> <!-- General Tab (Connection Settings) -->
<Tabs.Content value="general" class="space-y-4 mt-0 h-full"> <Tabs.Content value="general" class="space-y-4 mt-0 h-full">
<!-- Name field --> <!-- Name field -->
+27 -7
View File
@@ -309,7 +309,7 @@ services:
<Tooltip.Trigger> <Tooltip.Trigger>
<HelpCircle class="w-3.5 h-3.5 text-muted-foreground" /> <HelpCircle class="w-3.5 h-3.5 text-muted-foreground" />
</Tooltip.Trigger> </Tooltip.Trigger>
<Tooltip.Content side="top" class="max-w-xs"> <Tooltip.Content side="top" class="w-96 max-w-[90vw]">
<p>Surface a release-notes link next to the image name on rows with updates available. The link is resolved from the image's <code>org.opencontainers.image.source</code> label, from the <code>ghcr.io</code> registry path, or from an explicit <code>dockhand.changelog.url</code> label override.</p> <p>Surface a release-notes link next to the image name on rows with updates available. The link is resolved from the image's <code>org.opencontainers.image.source</code> label, from the <code>ghcr.io</code> registry path, or from an explicit <code>dockhand.changelog.url</code> label override.</p>
</Tooltip.Content> </Tooltip.Content>
</Tooltip.Root> </Tooltip.Root>
@@ -345,7 +345,7 @@ services:
<Tooltip.Trigger> <Tooltip.Trigger>
<HelpCircle class="w-3.5 h-3.5 text-muted-foreground" /> <HelpCircle class="w-3.5 h-3.5 text-muted-foreground" />
</Tooltip.Trigger> </Tooltip.Trigger>
<Tooltip.Content side="top" class="max-w-xs"> <Tooltip.Content side="top" class="w-96 max-w-[90vw]">
<p>Shows internal container ports (from EXPOSE directives) that are not published to the host. These appear in the container list with an amber badge to distinguish them from published port mappings.</p> <p>Shows internal container ports (from EXPOSE directives) that are not published to the host. These appear in the container list with an amber badge to distinguish them from published port mappings.</p>
</Tooltip.Content> </Tooltip.Content>
</Tooltip.Root> </Tooltip.Root>
@@ -367,8 +367,8 @@ services:
<Tooltip.Trigger> <Tooltip.Trigger>
<HelpCircle class="w-3.5 h-3.5 text-muted-foreground" /> <HelpCircle class="w-3.5 h-3.5 text-muted-foreground" />
</Tooltip.Trigger> </Tooltip.Trigger>
<Tooltip.Content side="top" class="max-w-xs"> <Tooltip.Content side="top" class="w-96 max-w-[90vw]">
<p>Parse <code>traefik.http.routers.&lt;name&gt;.rule</code> and <code>pangolin.proxy-resources.&lt;name&gt;.full-domain</code> labels and surface the resulting URLs as clickable pills next to ports. When off, only explicit <code>dockhand.url</code> labels are shown.</p> <p>Parse <code>traefik.http.routers.&lt;name&gt;.rule</code>, <code>pangolin.public-resources.&lt;name&gt;.full-domain</code>, and <code>pangolin.private-resources.&lt;name&gt;.full-domain</code> labels and surface the resulting URLs as clickable pills next to ports. When off, only explicit <code>dockhand.url</code> labels are shown.</p>
</Tooltip.Content> </Tooltip.Content>
</Tooltip.Root> </Tooltip.Root>
<TogglePill <TogglePill
@@ -882,9 +882,6 @@ services:
onchange={handleScannerCleanupEnabledChange} onchange={handleScannerCleanupEnabledChange}
disabled={!$canAccess('settings', 'edit')} disabled={!$canAccess('settings', 'edit')}
/> />
</div>
<p class="text-xs text-muted-foreground">Remove cached vulnerability databases to reclaim disk space</p>
<div class="flex items-center gap-2 mt-2">
<div class="ml-auto"> <div class="ml-auto">
<CronEditor <CronEditor
value={scannerCleanupCron} value={scannerCleanupCron}
@@ -893,6 +890,29 @@ services:
/> />
</div> </div>
</div> </div>
<p class="text-xs text-muted-foreground">Remove cached vulnerability databases to reclaim disk space</p>
</div>
<div class="space-y-1 pt-2 border-t">
<div class="flex items-center gap-3">
<Label>Protect scanner images from prune</Label>
<Tooltip.Root>
<Tooltip.Trigger>
<HelpCircle class="w-3.5 h-3.5 text-muted-foreground" />
</Tooltip.Trigger>
<Tooltip.Content side="top" class="w-96 max-w-[90vw]">
<p>When ON, "Prune all unused" skips Dockhand's grype and trivy scanner images so the next scan doesn't have to re-pull them (and re-download the ~100MB vuln database). When OFF, prune behaves like vanilla Docker and may remove them.</p>
</Tooltip.Content>
</Tooltip.Root>
<TogglePill
checked={$appSettings.protectScannerImages}
onchange={(checked) => {
appSettings.setProtectScannerImages(checked);
toast.success(checked ? 'Scanner images will be skipped during prune' : 'Scanner images will be pruned with everything else');
}}
disabled={!$canAccess('settings', 'edit')}
/>
</div>
<p class="text-xs text-muted-foreground">Skip grype and trivy images during "Prune all unused"</p>
</div> </div>
</Card.Content> </Card.Content>
</Card.Root> </Card.Root>