Skip to content

Modern Docker Management, Designed for Everyone

fix: bulk remove doing nothing on non-HTTPS deployments (#3498)

Kyle Mendell1a1d392a2ff4
diff --git a/frontend/messages/en.json b/frontend/messages/en.json
index 20bdb51ae..f78f4369f 100644
--- a/frontend/messages/en.json
+++ b/frontend/messages/en.json
@@ -866,6 +866,7 @@
"completed": "Completed",
"vuln_clean": "Clean",
"vuln_click_to_scan": "Click scan to check for vulnerabilities",
+ "unexpected_error": "An unexpected error occurred",
"volumes_subtitle": "Manage your Docker volumes",
"volumes_stat_total": "Total Volumes",
"unused_volumes": "Unused Volumes",
diff --git a/frontend/src/lib/components/confirm-dialog/confirm-dialog.svelte b/frontend/src/lib/components/confirm-dialog/confirm-dialog.svelte
index 917d6cccd..36dad00e0 100644
--- a/frontend/src/lib/components/confirm-dialog/confirm-dialog.svelte
+++ b/frontend/src/lib/components/confirm-dialog/confirm-dialog.svelte
@@ -6,6 +6,7 @@
import { Label } from '#lib/components/ui/label';
import Checkbox from '../ui/checkbox/checkbox.svelte';
import { m } from '#lib/paraglide/messages';
+ import { toast } from 'svelte-sonner';
let checkboxStates = $state<Record<string, boolean>>({});
@@ -25,7 +26,15 @@
const action = $confirmDialogStore.confirm.action;
const states = $state.snapshot(checkboxStates);
$confirmDialogStore.open = false;
- action(states);
+ // The dialog is already closed, so a throwing action would otherwise be an
+ // unhandled rejection the user never sees — surface it instead. Invoke
+ // inside the chain so synchronous throws also land in the catch.
+ Promise.resolve()
+ .then(() => action(states))
+ .catch((error) => {
+ console.error('Confirm action failed:', error);
+ toast.error(m.unexpected_error());
+ });
}
</script>
diff --git a/frontend/src/lib/components/confirm-dialog/store.ts b/frontend/src/lib/components/confirm-dialog/store.ts
index d5376ef6f..82b0e326e 100644
--- a/frontend/src/lib/components/confirm-dialog/store.ts
+++ b/frontend/src/lib/components/confirm-dialog/store.ts
@@ -11,7 +11,7 @@ interface ConfirmDialogStore {
destructive?: boolean;
/** ArcaneButton action variant for the confirm button; overrides the destructive/remove default. */
button?: Action;
- action: (checkboxStates: Record<string, boolean>) => void;
+ action: (checkboxStates: Record<string, boolean>) => void | Promise<void>;
};
checkboxes?: Array<{
id: string;
@@ -43,7 +43,7 @@ export function openConfirmDialog({
label?: string;
destructive?: boolean;
button?: Action;
- action: (checkboxStates: Record<string, boolean>) => void;
+ action: (checkboxStates: Record<string, boolean>) => void | Promise<void>;
};
checkboxes?: Array<{
id: string;
diff --git a/frontend/src/lib/services/image-service.ts b/frontend/src/lib/services/image-service.ts
index 44442c836..e417cf6d1 100644
--- a/frontend/src/lib/services/image-service.ts
+++ b/frontend/src/lib/services/image-service.ts
@@ -1,5 +1,5 @@
import BaseAPIService from './api-service';
-import { environmentStore } from '#lib/stores/environment.store.svelte';
+import { environmentStore, LOCAL_DOCKER_ENVIRONMENT_ID } from '#lib/stores/environment.store.svelte';
import type {
ImageSummaryDto,
ImageUsageCounts,
@@ -145,7 +145,11 @@ class ImageService extends BaseAPIService {
}
async deleteImage(imageId: string, options?: { force?: boolean; noprune?: boolean }): Promise<any> {
- const envId = await environmentStore.getCurrentEnvironmentId();
+ // Resolve the env id synchronously when possible so bulk deletes start
+ // their request inside the runWithActivityBatchId scope (see api-service).
+ const envId = environmentStore.isInitialized()
+ ? (environmentStore.selected?.id ?? LOCAL_DOCKER_ENVIRONMENT_ID)
+ : await environmentStore.getCurrentEnvironmentId();
return this.handleResponse(this.api.delete(`/environments/${envId}/images/${imageId}`, { params: options }));
}
diff --git a/frontend/src/lib/services/volume-service.ts b/frontend/src/lib/services/volume-service.ts
index d3718c328..f0dd72674 100644
--- a/frontend/src/lib/services/volume-service.ts
+++ b/frontend/src/lib/services/volume-service.ts
@@ -1,5 +1,5 @@
import BaseAPIService from './api-service';
-import { environmentStore } from '#lib/stores/environment.store.svelte';
+import { environmentStore, LOCAL_DOCKER_ENVIRONMENT_ID } from '#lib/stores/environment.store.svelte';
import type {
VolumeSummaryDto,
VolumeDetailDto,
@@ -63,7 +63,11 @@ class VolumeService extends BaseAPIService {
}
async deleteVolume(volumeName: string): Promise<any> {
- const envId = await environmentStore.getCurrentEnvironmentId();
+ // Resolve the env id synchronously when possible so bulk deletes start
+ // their request inside the runWithActivityBatchId scope (see api-service).
+ const envId = environmentStore.isInitialized()
+ ? (environmentStore.selected?.id ?? LOCAL_DOCKER_ENVIRONMENT_ID)
+ : await environmentStore.getCurrentEnvironmentId();
return this.handleResponse(this.api.delete(`/environments/${envId}/volumes/${volumeName}`));
}
}
diff --git a/frontend/src/lib/utils/bulk-actions.ts b/frontend/src/lib/utils/bulk-actions.ts
index ade192578..2e4c4e974 100644
--- a/frontend/src/lib/utils/bulk-actions.ts
+++ b/frontend/src/lib/utils/bulk-actions.ts
@@ -1,5 +1,6 @@
import { toast } from 'svelte-sonner';
import { openConfirmDialog } from '#lib/components/confirm-dialog';
+import { streamCacheBuster } from '#lib/utils/streaming';
import { markActivityToastShown } from '#lib/components/activity/activity-completion-toasts';
import { runWithActivityBatchId } from '#lib/services/api-service';
import { handleApiResultWithCallbacks, tryCatch, type Result } from '#lib/utils/api';
@@ -84,7 +85,10 @@ async function runBulkOperation<T>({
// Multi-item runs share a batch id so the Activity Center renders one
// batch row. Each request is STARTED inside the synchronous batch scope
// (awaited outside it), so concurrent unrelated actions never inherit it.
- const batchId = total > 1 ? crypto.randomUUID() : null;
+ // streamCacheBuster instead of bare crypto.randomUUID: the latter is
+ // secure-context-only (throws on plain-HTTP deployments), and the fallback
+ // format matches the backend batch-id pattern ^[A-Za-z0-9_-]{1,64}$.
+ const batchId = total > 1 ? streamCacheBuster() : null;
const startRun = (id: string) => (batchId ? runWithActivityBatchId(batchId, () => tryCatch(run(id))) : tryCatch(run(id)));
if (sequential) {
for (const id of ids) {
diff --git a/frontend/src/routes/(app)/images/image-table.svelte b/frontend/src/routes/(app)/images/image-table.svelte
index 0d8668da2..38127c0ea 100644
--- a/frontend/src/routes/(app)/images/image-table.svelte
+++ b/frontend/src/routes/(app)/images/image-table.svelte
@@ -27,6 +27,7 @@
import { isLikelyStaleFailedSummary, isVulnerabilityScanInProgress } from '#lib/utils/docker';
import { environmentStore } from '#lib/stores/environment.store.svelte';
import { hasPermission } from '#lib/utils/auth';
+ import userStore from '#lib/stores/user-store';
import { activityToastOptions, extractActivityId } from '#lib/utils/activity-toast';
import { bulkConfirmAndRun } from '#lib/utils/bulk-actions';
import InUseStatus from '#lib/components/arcane-table/cells/in-use-status.svelte';
@@ -67,11 +68,28 @@
});
const currentEnvId = $derived(environmentStore.selected?.id || '0');
- const canDeleteImage = $derived(hasPermission('images:delete', currentEnvId));
- const canPullImage = $derived(hasPermission('images:pull', currentEnvId));
- const canScanImage = $derived(hasPermission('vulnerabilities:scan', currentEnvId));
- const canTagImage = $derived(hasPermission('images:tag', currentEnvId));
- const canReadImage = $derived(hasPermission('images:read', currentEnvId));
+ // Track the user store: hasPermission reads it non-reactively, so without
+ // this the deriveds would cache pre-hydration falses forever.
+ const canDeleteImage = $derived.by(() => {
+ $userStore;
+ return hasPermission('images:delete', currentEnvId);
+ });
+ const canPullImage = $derived.by(() => {
+ $userStore;
+ return hasPermission('images:pull', currentEnvId);
+ });
+ const canScanImage = $derived.by(() => {
+ $userStore;
+ return hasPermission('vulnerabilities:scan', currentEnvId);
+ });
+ const canTagImage = $derived.by(() => {
+ $userStore;
+ return hasPermission('images:tag', currentEnvId);
+ });
+ const canReadImage = $derived.by(() => {
+ $userStore;
+ return hasPermission('images:read', currentEnvId);
+ });
let isPullingInline = $state<Record<string, boolean>>({});
let isScanningInline = $state<Record<string, boolean>>({});
diff --git a/frontend/src/routes/(app)/volumes/volume-table.svelte b/frontend/src/routes/(app)/volumes/volume-table.svelte
index c979f49ca..28b33a5e2 100644
--- a/frontend/src/routes/(app)/volumes/volume-table.svelte
+++ b/frontend/src/routes/(app)/volumes/volume-table.svelte
@@ -25,6 +25,7 @@
import type { ColumnVisibilityState } from '@tanstack/table-core';
import { environmentStore } from '#lib/stores/environment.store.svelte';
import { hasPermission } from '#lib/utils/auth';
+ import userStore from '#lib/stores/user-store';
import { activityToastOptions, extractActivityId } from '#lib/utils/activity-toast';
import { bulkConfirmAndRun } from '#lib/utils/bulk-actions';
@@ -45,7 +46,12 @@
});
const currentEnvId = $derived(environmentStore.selected?.id || '0');
- const canDeleteVolume = $derived(hasPermission('volumes:delete', currentEnvId));
+ // Track the user store: hasPermission reads it non-reactively, so without
+ // this the derived would cache a pre-hydration false forever.
+ const canDeleteVolume = $derived.by(() => {
+ $userStore;
+ return hasPermission('volumes:delete', currentEnvId);
+ });
let customSettings = $state<Record<string, unknown>>({});
let showInternal = $derived.by(() => {
return (customSettings['showInternalVolumes'] as boolean) ?? false;
@@ -155,8 +161,10 @@
}
function handleDeleteSelected(ids: string[]) {
- const idToName = new Map(volumes.data.map((v) => [v.id, v.name] as const));
- const idsToDelete = ids.filter((id) => !isBackupVolumeName(idToName.get(id)));
+ // A volume's id IS its name (backend sets ID: v.Name), so ids can be
+ // passed to the delete endpoint directly — no per-page name lookup, which
+ // would break for selections carried across pages.
+ const idsToDelete = ids.filter((id) => !isBackupVolumeName(id));
bulkConfirmAndRun({
ids: idsToDelete,
@@ -164,7 +172,7 @@
message: m.volumes_remove_selected_message({ count: idsToDelete.length }),
confirmLabel: m.common_remove(),
destructive: true,
- run: (id) => volumeService.deleteVolume(idToName.get(id)?.trim() || m.common_unknown()),
+ run: (id) => volumeService.deleteVolume(id),
messages: {
success: (count) => m.common_bulk_remove_success({ count, resource: m.resource_volumes_cap() }),
partial: (success, total, failed) =>
@@ -196,10 +204,8 @@
{ id: 'driver', label: m.common_driver(), defaultVisible: true }
];
- const deletableSelectedIds = $derived.by(() => {
- const idToName = new Map(volumes.data.map((v) => [v.id, v.name] as const));
- return (selectedIds ?? []).filter((id) => !isBackupVolumeName(idToName.get(id)));
- });
+ // Volume id === name, so the backup-volume filter works on the id directly.
+ const deletableSelectedIds = $derived((selectedIds ?? []).filter((id) => !isBackupVolumeName(id)));
const bulkActions = $derived.by<BulkAction[]>(() => [
{