Modern Docker Management, Designed for Everyone
Go composecontainer-managementcontainersdockerdocker-composedocker-managementgoself-hostedsveltekittypescriptweb-ui
refactor: allow choosing the registries for arcane-tools and trivy dbs (#3830)
Kyle Mendellb85caceeef0b
diff --git a/backend/internal/config/schema/schema_test.go b/backend/internal/config/schema/schema_test.goindex 5005c365f..a6493c2dd 100644--- a/backend/internal/config/schema/schema_test.go+++ b/backend/internal/config/schema/schema_test.go@@ -78,10 +78,6 @@ func TestGenerate_SettingEnvOverridesMatchModelMetadata(t *testing.T) {assert.Equal(t, "arcane-mobile://oidc-callback", oidcMobileRedirectURIs.DefaultValue)assert.Equal(t, "authentication", oidcMobileRedirectURIs.Category)- trivyImage, ok := entries["trivyImage"]- require.True(t, ok)- assert.Contains(t, trivyImage.Requires, "UI_CONFIGURATION_DISABLED=true")-assert.Empty(t, oidcSecret.DefaultValue)_, hasRuntimeDerived := entries["uiConfigDisabled"]@@ -360,12 +356,13 @@ var expectedSettingOverrideKeys = []string{"scheduledPruneInterval","swarmStackSourcesDirectory","templatesDirectory",+ "toolsImageRegistry","trivyConcurrentScanContainers","trivyConfig","trivyCpuLimit",+ "trivyDbRegistry","trivyIgnore","trivyIgnoreUnfixed",- "trivyImage","trivyMemoryLimitMb","trivyNetwork","trivyPrivileged",@@ -375,6 +372,7 @@ var expectedSettingOverrideKeys = []string{"trivyServerEnabled","trivyServerToken","trivyServerUrl",+ "updateCheckRegistry","volumeHelperIdleTimeout","vulnerabilityScanEnabled","vulnerabilityScanInterval",diff --git a/backend/internal/di/providers.go b/backend/internal/di/providers.goindex 429aed458..7eac7610c 100644--- a/backend/internal/di/providers.go+++ b/backend/internal/di/providers.go@@ -206,8 +206,8 @@ func provideDockerClientServiceInternal(ctx context.Context, lc fx.Lifecycle, acreturn service}-func provideVersionServiceInternal(httpClient *http.Client, cfg *config.Config, registry *registry.ContainerRegistryService, docker *docker.DockerClientService, imageUpdate *imageupdate.ImageUpdateService) *version.VersionService {- return version.NewVersionService(httpClient, cfg.UpdateCheckDisabled, config.Version, config.Revision, registry, docker, imageUpdate)+func provideVersionServiceInternal(httpClient *http.Client, cfg *config.Config, registry *registry.ContainerRegistryService, docker *docker.DockerClientService, imageUpdate *imageupdate.ImageUpdateService, settingsService *settings.SettingsService) *version.VersionService {+ return version.NewVersionService(httpClient, cfg.UpdateCheckDisabled, config.Version, config.Revision, registry, docker, imageUpdate, settingsService)}func provideGitRepositoryModuleInternal(db *database.DB, cfg *config.Config, eventService *event.EventService, settingsService *settings.SettingsService) *gitrepo.Module {diff --git a/backend/internal/project/project_update.go b/backend/internal/project/project_update.goindex 002e3a748..4f01afe22 100644--- a/backend/internal/project/project_update.go+++ b/backend/internal/project/project_update.go@@ -19,6 +19,7 @@ import (composetypes "github.com/compose-spec/compose-go/v2/types""github.com/docker/compose/v5/pkg/api""github.com/getarcaneapp/arcane/backend/v2/internal/common"+ "github.com/getarcaneapp/arcane/backend/v2/pkg/libarcane/volumehelper""github.com/getarcaneapp/arcane/backend/v2/pkg/libarcane/volumes""github.com/getarcaneapp/arcane/backend/v2/pkg/projects""github.com/getarcaneapp/arcane/backend/v2/pkg/utils"@@ -401,7 +402,12 @@ func (s *ProjectService) prepareProjectRenameVolumeMigrationInternal(ctx contextreturn nil, errors.WrapIf(err, "failed to connect to Docker for volume rename")}- return volumes.PlanMigration(ctx, dockerClient, composeProject, oldComposeName, newComposeName)+ registry := ""+ if s.settingsService != nil {+ registry = s.settingsService.GetSettingsConfig().ToolsImageRegistry.Value+ }++ return volumes.PlanMigration(ctx, dockerClient, composeProject, oldComposeName, newComposeName, volumehelper.ToolsImage(registry))}func projectRenameVolumeMigrationComposeNamesInternal(s *ProjectService, proj *Project, name *string) (string, string, bool) {diff --git a/backend/internal/settings/model.go b/backend/internal/settings/model.goindex 184a8fd49..d4e686b3b 100644--- a/backend/internal/settings/model.go+++ b/backend/internal/settings/model.go@@ -93,6 +93,8 @@ type Settings struct {MaxConcurrentActivities SettingVariable `key:"maxConcurrentActivities" meta:"label=Concurrent Activity Limit;type=number;keywords=activity,concurrency,limit,queue,parallel,bulk,background,tasks;category=activity;description=Maximum long-running activities per environment before new ones queue. Set 0 for unlimited."`AutoInjectEnv SettingVariable `key:"autoInjectEnv" meta:"label=Auto Inject Env Variables;type=boolean;keywords=auto,inject,env,environment,variables,interpolation;category=internal;description=Automatically inject project .env variables into all containers (default: false)"`DefaultDeployPullPolicy SettingVariable `key:"defaultDeployPullPolicy" meta:"label=Default Deploy Pull Policy;type=select;keywords=deploy,pull,policy,compose,up,missing,always;category=internal;description=Default image pull policy when deploying projects"`+ ToolsImageRegistry SettingVariable `key:"toolsImageRegistry,envOverride" meta:"label=Tools Image Registry;type=select;keywords=tools,image,registry,ghcr,docker,hub,helper,volume;category=internal;description=Container registry used to pull the Arcane tools helper image"`+ UpdateCheckRegistry SettingVariable `key:"updateCheckRegistry,envOverride" meta:"label=Update Check Registry;type=select;keywords=update,check,registry,ghcr,docker,hub,self,image,digest;category=internal;description=Registry queried when checking whether the Arcane image has a newer digest"`ScheduledPruneEnabled SettingVariable `key:"scheduledPruneEnabled" meta:"label=Scheduled Prune Enabled;type=boolean;keywords=prune,cleanup,maintenance,schedule,automatic;category=internal;description=Enable scheduled pruning of unused Docker resources"`ScheduledPruneInterval SettingVariable `key:"scheduledPruneInterval" meta:"label=Scheduled Prune Interval;type=cron;keywords=prune,cleanup,interval,minutes,schedule;category=internal;description=How often to run scheduled prunes (cron expression)"`PruneContainerMode SettingVariable `key:"pruneContainerMode" meta:"label=Prune Containers;type=select;keywords=prune,containers,cleanup,maintenance,mode,older,stopped;category=internal;description=Select how containers should be pruned when the scheduled prune job runs"`@@ -127,7 +129,7 @@ type Settings struct {AuthPasswordPolicy SettingVariable `key:"authPasswordPolicy" meta:"label=Password Policy;type=select;keywords=password,policy,strength,complexity,requirements,security,rules;category=authentication;description=Set password strength requirements"`VulnerabilityScanEnabled SettingVariable `key:"vulnerabilityScanEnabled" meta:"label=Scheduled Vulnerability Scan;type=boolean;keywords=vulnerability,scan,security,trivy,schedule,automatic,cve;category=security;description=Enable scheduled vulnerability scanning of all Docker images" catmeta:"id=security;title=Security;icon=shield;url=/settings/security;description=Configure vulnerability scanning and runtime security settings"`VulnerabilityScanInterval SettingVariable `key:"vulnerabilityScanInterval" meta:"label=Vulnerability Scan Interval;type=cron;keywords=vulnerability,scan,interval,schedule,frequency,trivy,cve;category=security;description=How often to run scheduled vulnerability scans (cron expression)"`- TrivyImage SettingVariable `key:"trivyImage" meta:"label=Arcane Tools Image;type=text;keywords=trivy,scanner,vulnerability,security,image,tools;category=security;description=Override the Arcane tools image used to run Trivy vulnerability scans"`+ TrivyDbRegistry SettingVariable `key:"trivyDbRegistry,envOverride" meta:"label=Trivy DB Registry;type=select;keywords=trivy,db,java-db,checks,registry,ghcr,docker,hub,vulnerability,security,scanner;category=security;description=Container registry used to pull the Trivy vulnerability database artifacts"`TrivyNetwork SettingVariable `key:"trivyNetwork,envOverride" meta:"label=Trivy Network;type=text;keywords=trivy,network,mode,bridge,host,none,scanner,vulnerability,security;category=security;description=Docker network mode/network name used for Trivy scan containers. Leave empty to inherit Arcane's network automatically."`TrivySecurityOpts SettingVariable `key:"trivySecurityOpts,envOverride" meta:"label=Trivy Security Options;type=textarea;keywords=trivy,security,opt,security_opt,selinux,labels,apparmor,scanner;category=security;description=Docker security options applied to Trivy scan containers. Use commas or new lines to separate entries (for example: label=disable)"`TrivyPrivileged SettingVariable `key:"trivyPrivileged,envOverride" meta:"label=Trivy Privileged;type=boolean;keywords=trivy,privileged,security,selinux,scanner;category=security;description=Run Trivy scan containers in privileged mode when required by the host security policy"`diff --git a/backend/internal/settings/service.go b/backend/internal/settings/service.goindex d458d9aad..0bb2c3808 100644--- a/backend/internal/settings/service.go+++ b/backend/internal/settings/service.go@@ -38,11 +38,6 @@ import (const (browserSessionSigningKeySize = 64-- // DefaultArcaneToolsImage is the shared Arcane toolbox image used for helper commands.- DefaultArcaneToolsImage = "ghcr.io/getarcaneapp/tools:latest"- // DefaultTrivyImage is the default vulnerability scanner image setting.- DefaultTrivyImage = DefaultArcaneToolsImage)type SettingsService struct {@@ -219,6 +214,8 @@ func DefaultSettingsConfig() *Settings {MaxConcurrentActivities: SettingVariable{Value: "5"},AutoInjectEnv: SettingVariable{Value: "false"},DefaultDeployPullPolicy: SettingVariable{Value: "missing"},+ ToolsImageRegistry: SettingVariable{Value: "ghcr.io"},+ UpdateCheckRegistry: SettingVariable{Value: "auto"},ScheduledPruneEnabled: SettingVariable{Value: "false"},ScheduledPruneInterval: SettingVariable{Value: "0 0 0 * * *"},PruneContainerMode: SettingVariable{Value: "stopped"},@@ -248,7 +245,7 @@ func DefaultSettingsConfig() *Settings {AuthPasswordPolicy: SettingVariable{Value: "strong"},VulnerabilityScanEnabled: SettingVariable{Value: "false"},VulnerabilityScanInterval: SettingVariable{Value: "0 0 0 * * *"},- TrivyImage: SettingVariable{Value: DefaultTrivyImage},+ TrivyDbRegistry: SettingVariable{Value: "ghcr.io"},TrivyNetwork: SettingVariable{Value: ""},TrivySecurityOpts: SettingVariable{Value: ""},TrivyPrivileged: SettingVariable{Value: "false"},@@ -735,10 +732,6 @@ func (s *SettingsService) EnsureDefaultSettings(ctx context.Context) error {}case err != nil:return errors.WrapIff(err, "failed to check for existing setting %s", defaultSetting.Key)- case defaultSetting.Key == "trivyImage" && existing.Value != defaultSetting.Value:- if err := tx.Model(&existing).Update("value", defaultSetting.Value).Error; err != nil {- return errors.WrapIff(err, "failed to enforce default setting %s", defaultSetting.Key)- }}}return nil@@ -835,10 +828,6 @@ func (s *SettingsService) shouldProcessField(key, attrs string, isEnvOnlyMode boreturn false}- if key == "trivyImage" {- return false- }-// If not in env-only mode, only persist if it's explicitly marked as envOverrideif !isEnvOnlyMode && !strings.Contains(attrs, "envOverride") {return falsediff --git a/backend/internal/settings/service_test.go b/backend/internal/settings/service_test.goindex 7747c44ea..e5e272dec 100644--- a/backend/internal/settings/service_test.go+++ b/backend/internal/settings/service_test.go@@ -97,7 +97,7 @@ func TestSettingsService_EnsureDefaultSettings_Idempotent(t *testing.T) {require.Equal(t, count1, count2)// Spot-check core and automation defaults exist with correct values- for _, key := range []string{"authLocalEnabled", "projectsDirectory", "followProjectSymlinks", "autoUpdateExcludedContainers", "imageEventWatcherEnabled", "vulnerabilityScanEnabled", "vulnerabilityScanInterval", "trivyImage", "trivyNetwork", "trivySecurityOpts", "trivyPrivileged", "trivyResourceLimitsEnabled", "trivyCpuLimit", "trivyMemoryLimitMb", "trivyConcurrentScanContainers", "gitSyncMaxFiles", "gitSyncMaxTotalSizeMb", "gitSyncMaxBinarySizeMb", "lifecycleDefaultRunnerImage"} {+ for _, key := range []string{"authLocalEnabled", "projectsDirectory", "followProjectSymlinks", "autoUpdateExcludedContainers", "imageEventWatcherEnabled", "vulnerabilityScanEnabled", "vulnerabilityScanInterval", "toolsImageRegistry", "updateCheckRegistry", "trivyDbRegistry", "trivyNetwork", "trivySecurityOpts", "trivyPrivileged", "trivyResourceLimitsEnabled", "trivyCpuLimit", "trivyMemoryLimitMb", "trivyConcurrentScanContainers", "gitSyncMaxFiles", "gitSyncMaxTotalSizeMb", "gitSyncMaxBinarySizeMb", "lifecycleDefaultRunnerImage"} {var sv SettingVariableerr := svc.db.WithContext(ctx).Where("key = ?", key).First(&sv).Errorrequire.NoErrorf(t, err, "missing default key %s", key)@@ -113,8 +113,12 @@ func TestSettingsService_EnsureDefaultSettings_Idempotent(t *testing.T) {require.Equal(t, "false", sv.Value)case "vulnerabilityScanInterval":require.Equal(t, "0 0 0 * * *", sv.Value)- case "trivyImage":- require.Equal(t, DefaultTrivyImage, sv.Value)+ case "toolsImageRegistry":+ require.Equal(t, "ghcr.io", sv.Value)+ case "updateCheckRegistry":+ require.Equal(t, "auto", sv.Value)+ case "trivyDbRegistry":+ require.Equal(t, "ghcr.io", sv.Value)case "lifecycleDefaultRunnerImage":require.Equal(t, "alpine:latest", sv.Value)case "trivyNetwork":@@ -158,20 +162,6 @@ func TestSettingsService_ImageEventWatcherSettingPersists(t *testing.T) {require.Equal(t, "true", stored.Value)}-func TestSettingsService_EnsureDefaultSettings_OverridesExistingTrivyImage(t *testing.T) {- ctx := context.Background()- db := setupSettingsTestDB(t)- svc, err := newSettingsServiceForTestInternal(t, ctx, db)- require.NoError(t, err)-- require.NoError(t, svc.UpdateSetting(ctx, "trivyImage", "ghcr.io/aquasecurity/trivy:latest"))- require.NoError(t, svc.EnsureDefaultSettings(ctx))-- var sv SettingVariable- require.NoError(t, svc.db.WithContext(ctx).Where("key = ?", "trivyImage").First(&sv).Error)- require.Equal(t, DefaultTrivyImage, sv.Value)-}-func TestSettingsService_GetSettings_UnknownKeysIgnored(t *testing.T) {ctx := context.Background()db := setupSettingsTestDB(t)@@ -822,23 +812,6 @@ func TestSettingsService_LoadDatabaseSettings_UIConfigurationDisabled_Env(t *tesrequire.Equal(t, "https://env.example", cfg.BaseServerURL.Value)}-func TestSettingsService_PersistEnvSettingsIfMissing_DoesNotOverrideForcedTrivyImage(t *testing.T) {- ctx := context.Background()- db := setupSettingsTestDB(t)- t.Setenv("TRIVY_IMAGE", "ghcr.io/aquasecurity/trivy:latest")-- svc, err := newSettingsServiceForTestInternal(t, ctx, db)- require.NoError(t, err)- require.NoError(t, svc.EnsureDefaultSettings(ctx))-- require.NoError(t, svc.PersistEnvSettingsIfMissing(ctx))-- var sv SettingVariable- require.NoError(t, svc.db.WithContext(ctx).Where("key = ?", "trivyImage").First(&sv).Error)- require.Equal(t, DefaultTrivyImage, sv.Value)- require.Equal(t, DefaultTrivyImage, svc.GetSettingsConfig().TrivyImage.Value)-}-func TestSettingsService_UpdateSettings_RefreshesCache(t *testing.T) {ctx := context.Background()db := setupSettingsTestDB(t)diff --git a/backend/internal/system/upgrade_update_all_test.go b/backend/internal/system/upgrade_update_all_test.goindex aa63a94cc..41ec3c786 100644--- a/backend/internal/system/upgrade_update_all_test.go+++ b/backend/internal/system/upgrade_update_all_test.go@@ -301,7 +301,7 @@ func TestResumeUpdateAllFinalizesManagerWithoutRerunningAgents(t *testing.T) {// disabled=true keeps GetAppVersionInfo offline; nil docker => empty current digest.// The reported version differs from ManagerVersionAtStart, so the manager upgrade// is judged successful.- versionSvc := version.NewVersionService(nil, true, "v9.9.9-new", "", nil, nil, nil)+ versionSvc := version.NewVersionService(nil, true, "v9.9.9-new", "", nil, nil, nil, nil)svc := NewSystemUpgradeService(db, nil, versionSvc, event.NewEventService(db, nil, nil), nil)job := &EnvironmentUpdateJob{diff --git a/backend/internal/version/service.go b/backend/internal/version/service.goindex 64dee726c..6007d8b42 100644--- a/backend/internal/version/service.go+++ b/backend/internal/version/service.go@@ -23,6 +23,7 @@ import ("github.com/getarcaneapp/arcane/backend/v2/internal/docker""github.com/getarcaneapp/arcane/backend/v2/internal/imageupdate""github.com/getarcaneapp/arcane/backend/v2/internal/registry"+ "github.com/getarcaneapp/arcane/backend/v2/internal/settings""github.com/getarcaneapp/arcane/backend/v2/pkg/libarcane""github.com/getarcaneapp/arcane/types/v2/version""github.com/samber/hot"@@ -50,9 +51,10 @@ type VersionService struct {containerRegistryService *registry.ContainerRegistryServicedockerService *docker.DockerClientServiceimageUpdateService *imageupdate.ImageUpdateService+ settingsService *settings.SettingsService}-func NewVersionService(httpClient *http.Client, disabled bool, version string, revision string, containerRegistryService *registry.ContainerRegistryService, dockerService *docker.DockerClientService, imageUpdateService *imageupdate.ImageUpdateService) *VersionService {+func NewVersionService(httpClient *http.Client, disabled bool, version string, revision string, containerRegistryService *registry.ContainerRegistryService, dockerService *docker.DockerClientService, imageUpdateService *imageupdate.ImageUpdateService, settingsService *settings.SettingsService) *VersionService {if httpClient == nil {httpClient = http.DefaultClient}@@ -64,6 +66,7 @@ func NewVersionService(httpClient *http.Client, disabled bool, version string, rcontainerRegistryService: containerRegistryService,dockerService: dockerService,imageUpdateService: imageUpdateService,+ settingsService: settingsService,}loader := func(_ []struct{}) (map[struct{}]latestRelease, error) {ctx, cancel := context.WithTimeout(context.Background(), defaultRequestTimeout)@@ -278,6 +281,37 @@ func (s *VersionService) getDisplayVersion() string {return versionValue}+// updateCheckImageRefInternal points the digest lookup at the configured registry; "auto" keeps the running reference.+func (s *VersionService) updateCheckImageRefInternal(currentImageRef string) string {+ if s.settingsService == nil {+ return currentImageRef+ }+ target := strings.TrimSpace(s.settingsService.GetSettingsConfig().UpdateCheckRegistry.Value)+ if target == "" || target == "auto" {+ return currentImageRef+ }++ named, err := ref.ParseNormalizedNamed(strings.TrimSpace(currentImageRef))+ if err != nil || !strings.HasPrefix(ref.Path(named), "getarcaneapp/") {+ return currentImageRef+ }++ host := libarcane.ArcaneRegistryHost(target)+ repoPath := ref.Path(named)+ if host == libarcane.DockerHubRegistryHost {+ switch repoPath {+ case "getarcaneapp/arcane":+ repoPath = "getarcaneapp/manager"+ case "getarcaneapp/arcane-headless":+ repoPath = "getarcaneapp/agent"+ }+ }+ if host == ref.Domain(named) && repoPath == ref.Path(named) {+ return currentImageRef+ }+ return host + "/" + repoPath+}+// GetAppVersionInfo returns application version information including display versionfunc (s *VersionService) GetAppVersionInfo(ctx context.Context) *version.Info {isSemver := s.isSemverVersion()@@ -308,14 +342,15 @@ func (s *VersionService) GetAppVersionInfo(ctx context.Context) *version.Info {return info}- digestUpdateAvailable, latestDigest := s.storedOrDigestBasedUpdateInternal(ctx, currentImageID, currentTag, currentDigest, currentImageRef)+ checkImageRef := s.updateCheckImageRefInternal(currentImageRef)+ digestUpdateAvailable, latestDigest := s.storedOrDigestBasedUpdateInternal(ctx, currentImageID, currentTag, currentDigest, currentImageRef, checkImageRef)if latestDigest != "" {info.NewestDigest = latestDigest}switch {case isSemver && s.isNextBuildInternal(currentTag):- nextVersion := s.resolveNextVersionInternal(ctx, currentImageRef, currentTag, latestDigest)+ nextVersion := s.resolveNextVersionInternal(ctx, checkImageRef, currentTag, latestDigest)if nextVersion != "" && semver.Compare(nextVersion, ver) >= 0 {info.NewestVersion = nextVersion}@@ -346,8 +381,9 @@ func (s *VersionService) GetAppVersionInfo(ctx context.Context) *version.Info {return info}-func (s *VersionService) storedOrDigestBasedUpdateInternal(ctx context.Context, currentImageID, currentTag, currentDigest, currentImageRef string) (bool, string) {- if s.imageUpdateService != nil && strings.TrimSpace(currentImageID) != "" {+// storedOrDigestBasedUpdateInternal uses the stored poller row only when the check targets the running reference.+func (s *VersionService) storedOrDigestBasedUpdateInternal(ctx context.Context, currentImageID, currentTag, currentDigest, currentImageRef, checkImageRef string) (bool, string) {+ if s.imageUpdateService != nil && strings.TrimSpace(currentImageID) != "" && checkImageRef == currentImageRef {record, found, err := s.imageUpdateService.StoredUpdateByImageID(ctx, currentImageID)if err != nil {slog.WarnContext(ctx, "Failed to read stored Arcane image update state", "imageID", currentImageID, "error", err)@@ -356,8 +392,8 @@ func (s *VersionService) storedOrDigestBasedUpdateInternal(ctx context.Context,}}- if currentTag != "" && currentDigest != "" && currentImageRef != "" && s.containerRegistryService != nil {- return s.checkDigestBasedUpdate(ctx, currentTag, currentDigest, currentImageRef)+ if currentTag != "" && currentDigest != "" && checkImageRef != "" && s.containerRegistryService != nil {+ return s.checkDigestBasedUpdate(ctx, currentTag, currentDigest, checkImageRef)}return false, ""diff --git a/backend/internal/version/service_test.go b/backend/internal/version/service_test.goindex 441634dd1..d0d236047 100644--- a/backend/internal/version/service_test.go+++ b/backend/internal/version/service_test.go@@ -121,7 +121,7 @@ func TestVersionService_GetAppVersionInfoDoesNotUseStoredDigestUpdateForSemverBu})}dockerService := docker.NewDockerClientService(t.Context(), nil, nil, nil).WithClient(newTestDockerClientInternal(t, server))imageUpdateService := imageupdate.NewImageUpdateService(db, nil, nil, dockerService, nil, nil, nil)- svc := NewVersionService(httpClient, false, "1.2.3", "revision", nil, dockerService, imageUpdateService)+ svc := NewVersionService(httpClient, false, "1.2.3", "revision", nil, dockerService, imageUpdateService, nil)info := svc.GetAppVersionInfo(ctx)@@ -133,7 +133,7 @@ func TestVersionService_GetAppVersionInfoDoesNotUseStoredDigestUpdateForSemverBu}func TestVersionService_GetAppVersionInfoDisplaysSemverNextVersion(t *testing.T) {- svc := NewVersionService(nil, true, "2.4.0-next.2", "2c3e44a10ddda540d7e19fc2a876c931fc33a426", nil, nil, nil)+ svc := NewVersionService(nil, true, "2.4.0-next.2", "2c3e44a10ddda540d7e19fc2a876c931fc33a426", nil, nil, nil, nil)info := svc.GetAppVersionInfo(context.Background())@@ -143,7 +143,7 @@ func TestVersionService_GetAppVersionInfoDisplaysSemverNextVersion(t *testing.T)}func TestVersionService_GetAppVersionInfoPreservesDevVersionInternal(t *testing.T) {- svc := NewVersionService(nil, true, "dev", "unknown", nil, nil, nil)+ svc := NewVersionService(nil, true, "dev", "unknown", nil, nil, nil, nil)info := svc.GetAppVersionInfo(context.Background())@@ -204,7 +204,7 @@ func TestVersionService_IsNextBuildInternal(t *testing.T) {}for _, tt := range tests {t.Run(tt.name, func(t *testing.T) {- svc := NewVersionService(nil, true, tt.version, "rev", nil, nil, nil)+ svc := NewVersionService(nil, true, tt.version, "rev", nil, nil, nil, nil)assert.Equal(t, tt.want, svc.isNextBuildInternal(tt.currentTag))})}@@ -311,7 +311,7 @@ func TestVersionService_GetAppVersionInfoNextChannelUsesImageLabelInternal(t *tedockerService := docker.NewDockerClientService(t.Context(), nil, nil, nil).WithClient(newTestDockerClientInternal(t, server))imageUpdateService := imageupdate.NewImageUpdateService(db, nil, nil, dockerService, nil, nil, nil)registrySvc := registry.NewContainerRegistryService(nil, nil, nil)- svc := NewVersionService(httpClient, false, "2.8.0-next.65", "revision", registrySvc, dockerService, imageUpdateService)+ svc := NewVersionService(httpClient, false, "2.8.0-next.65", "revision", registrySvc, dockerService, imageUpdateService, nil)info := svc.GetAppVersionInfo(ctx)@@ -355,7 +355,7 @@ func TestVersionService_GetAppVersionInfoNextChannelLabelFailureFallsBackToDigesdockerService := docker.NewDockerClientService(t.Context(), nil, nil, nil).WithClient(newTestDockerClientInternal(t, server))imageUpdateService := imageupdate.NewImageUpdateService(db, nil, nil, dockerService, nil, nil, nil)registrySvc := registry.NewContainerRegistryService(nil, nil, nil)- svc := NewVersionService(nil, false, "2.8.0-next.65", "revision", registrySvc, dockerService, imageUpdateService)+ svc := NewVersionService(nil, false, "2.8.0-next.65", "revision", registrySvc, dockerService, imageUpdateService, nil)info := svc.GetAppVersionInfo(ctx)@@ -376,7 +376,7 @@ func TestVersionService_GetAppVersionInfoSuppressesOlderStableForPrereleaseInter})}// An -rc. prerelease stays on the stable track; the downgrade guard must// still drop the older stable tag rather than showing a backwards arrow.- svc := NewVersionService(httpClient, false, "2.8.0-rc.1", "revision", nil, nil, nil)+ svc := NewVersionService(httpClient, false, "2.8.0-rc.1", "revision", nil, nil, nil, nil)info := svc.GetAppVersionInfo(context.Background())diff --git a/backend/internal/volume/backup.go b/backend/internal/volume/backup.goindex af9e5bf4c..5ca86b0c6 100644--- a/backend/internal/volume/backup.go+++ b/backend/internal/volume/backup.go@@ -1268,7 +1268,7 @@ func (s *VolumeService) downloadRusticBackupInternal(ctx context.Context, entryremoveScratch()return nil, 0, fmt.Errorf("failed to restore Rustic snapshot for download: %w", err)}- helperImage, err := getVolumeHelperImageInternal(ctx, s.dockerService, s.imageService, dockerClient)+ helperImage, err := s.getVolumeHelperImageInternal(ctx, dockerClient)if err != nil {removeScratch()return nil, 0, err@@ -1301,7 +1301,7 @@ func (s *VolumeService) createBackupTempContainerWithMountInternal(ctx context.C}if strings.TrimSpace(helperImage) == "" {- helperImage, err = getVolumeHelperImageInternal(ctx, s.dockerService, s.imageService, dockerClient)+ helperImage, err = s.getVolumeHelperImageInternal(ctx, dockerClient)if err != nil {return "", nil, err}@@ -1400,7 +1400,7 @@ func (s *VolumeService) restoreArchiveBackupInternal(ctx context.Context, dockerif err != nil {return err}- helperImage, err := getVolumeHelperImageInternal(ctx, s.dockerService, s.imageService, dockerClient)+ helperImage, err := s.getVolumeHelperImageInternal(ctx, dockerClient)if err != nil {return err}@@ -1530,7 +1530,7 @@ func (s *VolumeService) restoreArchiveBackupFilesInternal(ctx context.Context, dif err != nil {return err}- helperImage, err := getVolumeHelperImageInternal(ctx, s.dockerService, s.imageService, dockerClient)+ helperImage, err := s.getVolumeHelperImageInternal(ctx, dockerClient)if err != nil {return err}diff --git a/backend/internal/volume/helper_container.go b/backend/internal/volume/helper_container.goindex afda42d35..5d9bdaec7 100644--- a/backend/internal/volume/helper_container.go+++ b/backend/internal/volume/helper_container.go@@ -11,9 +11,6 @@ import ("strings""time"- "github.com/getarcaneapp/arcane/backend/v2/internal/docker"- "github.com/getarcaneapp/arcane/backend/v2/internal/image"-"emperror.dev/errors"dockerutil "github.com/getarcaneapp/arcane/backend/v2/pkg/dockerutil"@@ -66,7 +63,13 @@ func (s *VolumeService) requireVolumeHelperACFSInternal(ctx context.Context, volreturn nil}-const volumeHelperImage = volumehelper.DefaultToolsImage+func (s *VolumeService) toolsImageInternal() string {+ registry := ""+ if s.settingsService != nil {+ registry = s.settingsService.GetSettingsConfig().ToolsImageRegistry.Value+ }+ return volumehelper.ToolsImage(registry)+}func isUnlabeledVolumeHelperContainerInternal(c container.Summary) bool {if !libarcane.IsInternalContainer(c.Labels) {@@ -98,30 +101,32 @@ func isVolumeHelperContainerInternal(c container.Summary) bool {return strings.EqualFold(c.Labels[volumehelper.ContainerLabel], "true")}-func getVolumeHelperImageInternal(ctx context.Context, dockerService *docker.DockerClientService, imageService *image.ImageService, dockerClient *client.Client) (string, error) {+func (s *VolumeService) getVolumeHelperImageInternal(ctx context.Context, dockerClient *client.Client) (string, error) {slog.DebugContext(ctx, "volume service: resolve helper image")var err errorif dockerClient == nil {- if dockerService == nil {+ if s.dockerService == nil {return "", errors.New("docker service unavailable")}- dockerClient, err = dockerService.GetClient(ctx)+ dockerClient, err = s.dockerService.GetClient(ctx)if err != nil {return "", errors.WrapIf(err, "failed to get docker client")}}- if _, err := dockerClient.ImageInspect(ctx, volumeHelperImage); err == nil {- slog.InfoContext(ctx, "volume service: helper image strategy selected", "strategy", "tools-local", "image", volumeHelperImage)- return volumeHelperImage, nil+ toolsImage := s.toolsImageInternal()++ if _, err := dockerClient.ImageInspect(ctx, toolsImage); err == nil {+ slog.InfoContext(ctx, "volume service: helper image strategy selected", "strategy", "tools-local", "image", toolsImage)+ return toolsImage, nil}var pullErr error- if imageService != nil {- pullImageErr := imageService.PullImage(ctx, volumeHelperImage, io.Discard, common.SystemUser, nil)+ if s.imageService != nil {+ pullImageErr := s.imageService.PullImage(ctx, toolsImage, io.Discard, common.SystemUser, nil)if pullImageErr == nil {- slog.InfoContext(ctx, "volume service: helper image strategy selected", "strategy", "tools-pulled", "image", volumeHelperImage)- return volumeHelperImage, nil+ slog.InfoContext(ctx, "volume service: helper image strategy selected", "strategy", "tools-pulled", "image", toolsImage)+ return toolsImage, nil}pullErr = pullImageErrslog.WarnContext(ctx, "volume service: failed to pull tools helper image, attempting arcane fallback", "error", pullImageErr.Error())@@ -244,7 +249,7 @@ func (s *VolumeService) acquireHelperInternal(volumeName, containerID string) (f// returns a cleanup that removes it. Tracking of reusable helpers is// the caller's responsibility.func (s *VolumeService) startHelperContainerInternal(ctx context.Context, dockerClient *client.Client, volumeName string) (string, func(), error) {- helperImage, err := getVolumeHelperImageInternal(ctx, s.dockerService, s.imageService, dockerClient)+ helperImage, err := s.getVolumeHelperImageInternal(ctx, dockerClient)if err != nil {return "", nil, err}diff --git a/backend/internal/volume/rename.go b/backend/internal/volume/rename.goindex cceeadf28..c077199a6 100644--- a/backend/internal/volume/rename.go+++ b/backend/internal/volume/rename.go@@ -55,7 +55,7 @@ func (s *VolumeService) RenameVolume(ctx context.Context, oldName, newName strinslog.WarnContext(ctx, "could not stop volume browse helper before rename", "volume", oldName, "error", stopErr.Error())}- migration, err := volumeops.PlanRename(ctx, dockerClient, oldName, newName)+ migration, err := volumeops.PlanRename(ctx, dockerClient, oldName, newName, s.toolsImageInternal())if err != nil {s.logVolumeRenameErrorInternal(ctx, oldName, newName, user, "plan", err)return nil, errdiff --git a/backend/internal/volume/workspace.go b/backend/internal/volume/workspace.goindex 4df619c74..9203327d9 100644--- a/backend/internal/volume/workspace.go+++ b/backend/internal/volume/workspace.go@@ -1012,7 +1012,7 @@ func (s *VolumeService) createVolumeWorkspaceMutationContainerInternal(ctx conteif err != nil {return "", nil, err}- helperImage, err := getVolumeHelperImageInternal(ctx, s.dockerService, s.imageService, dockerClient)+ helperImage, err := s.getVolumeHelperImageInternal(ctx, dockerClient)if err != nil {return "", nil, err}diff --git a/backend/internal/volume/workspace_test.go b/backend/internal/volume/workspace_test.goindex bbdd8ebae..89a14ca04 100644--- a/backend/internal/volume/workspace_test.go+++ b/backend/internal/volume/workspace_test.go@@ -700,7 +700,7 @@ func TestVolumeWorkspaceScriptsAgainstToolsImage(t *testing.T) {}runInVolume := func(volumeName, outerScript string, args ...string) string {t.Helper()- dockerArgs := []string{"run", "--rm", "-v", volumeName + ":/volume", volumehelper.DefaultToolsImage, "sh", "-c", outerScript, "sh"}+ dockerArgs := []string{"run", "--rm", "-v", volumeName + ":/volume", volumehelper.ToolsImage(""), "sh", "-c", outerScript, "sh"}dockerArgs = append(dockerArgs, args...)return runDocker(dockerArgs...)}diff --git a/backend/internal/vulnerability/service_test.go b/backend/internal/vulnerability/service_test.goindex f9b86e0d7..544536434 100644--- a/backend/internal/vulnerability/service_test.go+++ b/backend/internal/vulnerability/service_test.go@@ -92,11 +92,11 @@ func TestBuildTrivyCommandArgs_IncludesDefaultRepositories(t *testing.T) {cmdArgs, _ := svc.buildTrivyCommandArgs(context.Background(), "alpine:3.20", "", "", "", "/tmp/out.json")require.Contains(t, cmdArgs, "--db-repository")- require.Contains(t, cmdArgs, vuln.DefaultDBRepository)+ require.Contains(t, cmdArgs, "ghcr.io/"+vuln.DBRepository)require.Contains(t, cmdArgs, "--java-db-repository")- require.Contains(t, cmdArgs, vuln.DefaultJavaDBRepository)+ require.Contains(t, cmdArgs, "ghcr.io/"+vuln.JavaDBRepository)require.Contains(t, cmdArgs, "--checks-bundle-repository")- require.Contains(t, cmdArgs, vuln.DefaultChecksBundleRepository)+ require.Contains(t, cmdArgs, "ghcr.io/"+vuln.ChecksBundleRepository)}func TestGetTrivySingleScanCacheDirForSlotInternal(t *testing.T) {diff --git a/backend/internal/vulnerability/vulnerability_scan.go b/backend/internal/vulnerability/vulnerability_scan.goindex fb04418d9..027822dfe 100644--- a/backend/internal/vulnerability/vulnerability_scan.go+++ b/backend/internal/vulnerability/vulnerability_scan.go@@ -211,7 +211,7 @@ func (s *VulnerabilityService) scanImageInBackgroundInternal(ctx context.Context"imageName", imageName,)- trivyImage, err := s.ensureTrivyImageInternal(ctx)+ scannerImage, err := s.ensureTrivyImageInternal(ctx)if err != nil {s.setScanPhaseInternal(imageID, vulnerability.ScanPhaseStoringResults)s.updateVulnerabilityScanActivityInternal(ctx, activityID, vulnerability.ScanPhaseStoringResults, 90, "Unable to prepare vulnerability scanner")@@ -240,7 +240,7 @@ func (s *VulnerabilityService) scanImageInBackgroundInternal(ctx context.Contexts.setScanPhaseInternal(imageID, vulnerability.ScanPhaseScanningImage)s.updateVulnerabilityScanActivityInternal(ctx, activityID, vulnerability.ScanPhaseScanningImage, 45, "Scanning image for vulnerabilities")startTime := time.Now()- result, err := s.runTrivyScan(ctx, trivyImage, imageName, imageID)+ result, err := s.runTrivyScan(ctx, scannerImage, imageName, imageID)duration := time.Since(startTime).Milliseconds()if err != nil {diff --git a/backend/internal/vulnerability/vulnerability_trivy.go b/backend/internal/vulnerability/vulnerability_trivy.goindex 249449b97..4762bcfd6 100644--- a/backend/internal/vulnerability/vulnerability_trivy.go+++ b/backend/internal/vulnerability/vulnerability_trivy.go@@ -23,6 +23,7 @@ import (dockerutils "github.com/getarcaneapp/arcane/backend/v2/pkg/dockerutil""github.com/getarcaneapp/arcane/backend/v2/pkg/libarcane""github.com/getarcaneapp/arcane/backend/v2/pkg/libarcane/timeouts"+ "github.com/getarcaneapp/arcane/backend/v2/pkg/libarcane/volumehelper""github.com/getarcaneapp/arcane/backend/v2/pkg/libarcane/vuln""github.com/getarcaneapp/arcane/backend/v2/pkg/projects""github.com/getarcaneapp/arcane/types/v2/vulnerability"@@ -134,7 +135,7 @@ func (s *VulnerabilityService) setupTrivyBatchContainersInternal(ctx context.Conreturn nil, nil, errors.WrapIf(err, "failed to connect to Docker")}- trivyImage, err := s.ensureTrivyImageInternal(ctx)+ scannerImage, err := s.ensureTrivyImageInternal(ctx)if err != nil {return nil, nil, errors.WrapIf(err, "trivy scanner not available")}@@ -156,7 +157,7 @@ func (s *VulnerabilityService) setupTrivyBatchContainersInternal(ctx context.Con}for range max(count, 1) {- containerID, createErr := s.createBatchTrivyContainer(ctx, trivyImage, cacheVolume)+ containerID, createErr := s.createBatchTrivyContainer(ctx, scannerImage, cacheVolume)if createErr != nil {cleanup()return nil, nil, errors.WrapIf(createErr, "failed to create batch trivy container")@@ -190,7 +191,7 @@ func (s *VulnerabilityService) scanSingleImage(// createBatchTrivyContainer creates a long-running Trivy container that stays// alive so we can exec individual scan commands into it. This avoids the// overhead of creating/starting/removing a container for every image.-func (s *VulnerabilityService) createBatchTrivyContainer(ctx context.Context, trivyImage, cacheVolume string) (string, error) {+func (s *VulnerabilityService) createBatchTrivyContainer(ctx context.Context, scannerImage, cacheVolume string) (string, error) {dockerClient, err := s.dockerService.GetClient(ctx)if err != nil {return "", errors.WrapIf(err, "failed to connect to Docker")@@ -210,7 +211,7 @@ func (s *VulnerabilityService) createBatchTrivyContainer(ctx context.Context, tr}config := &containertypes.Config{- Image: trivyImage,+ Image: scannerImage,Entrypoint: []string{"sh", "-c", "trap 'exit 0' TERM; while :; do sleep 1; done"},Env: env,Labels: map[string]string{@@ -262,7 +263,7 @@ func (s *VulnerabilityService) execTrivyScanInContainer(ctx context.Context, conserverURL, serverToken := s.getTrivyServerConfig()execCmd := make([]string, 0, 16)execCmd = append(execCmd, "trivy", "image", "--format", "json", "--quiet", "--output", outputPath, "--timeout", trivyTimeout)- execCmd = append(execCmd, vuln.ScanSourceArgs(serverURL)...)+ execCmd = append(execCmd, vuln.ScanSourceArgs(serverURL, s.getTrivyDbRegistryInternal())...)if serverURL == "" {execCmd = append(execCmd, "--cache-dir", s.getTrivySingleScanCacheDirForSlotInternal(slotID))}@@ -403,13 +404,13 @@ func (s *VulnerabilityService) GetTrivyVersion(ctx context.Context) string {return ""}- trivyImage, err := s.ensureTrivyImageInternal(ctx)+ scannerImage, err := s.ensureTrivyImageInternal(ctx)if err != nil {return ""}config := &containertypes.Config{- Image: trivyImage,+ Image: scannerImage,Entrypoint: []string{"trivy"},Cmd: []string{"--version"},Labels: map[string]string{@@ -491,7 +492,18 @@ func (s *VulnerabilityService) GetTrivyVersion(ctx context.Context) string {}func (s *VulnerabilityService) getTrivyImageRef() string {- return settings.DefaultTrivyImage+ registry := ""+ if s.settingsService != nil {+ registry = s.settingsService.GetSettingsConfig().ToolsImageRegistry.Value+ }+ return volumehelper.ToolsImage(registry)+}++func (s *VulnerabilityService) getTrivyDbRegistryInternal() string {+ if s.settingsService == nil {+ return ""+ }+ return s.settingsService.GetSettingsConfig().TrivyDbRegistry.Value}func (s *VulnerabilityService) getConfiguredTrivyNetworkModeInternal() string {@@ -621,9 +633,9 @@ func (s *VulnerabilityService) ensureTrivyImageInternal(ctx context.Context) (streturn "", errors.WrapIf(err, "failed to connect to Docker")}- trivyImage := s.getTrivyImageRef()- if _, err := dockerClient.ImageInspect(ctx, trivyImage); err == nil {- return trivyImage, nil+ scannerImage := s.getTrivyImageRef()+ if _, err := dockerClient.ImageInspect(ctx, scannerImage); err == nil {+ return scannerImage, nil}pullTimeoutSeconds := 0@@ -634,12 +646,12 @@ func (s *VulnerabilityService) ensureTrivyImageInternal(ctx context.Context) (stpullCtx, pullCancel := context.WithTimeout(ctx, timeouts.GetDuration(pullTimeoutSeconds, timeouts.DefaultDockerImagePull))defer pullCancel()- pullReader, err := dockerClient.ImagePull(pullCtx, trivyImage, client.ImagePullOptions{})+ pullReader, err := dockerClient.ImagePull(pullCtx, scannerImage, client.ImagePullOptions{})if err != nil {if errors.Is(pullCtx.Err(), context.DeadlineExceeded) {- return "", errors.Errorf("scanner image pull timed out for %s (increase DOCKER_IMAGE_PULL_TIMEOUT or setting)", trivyImage)+ return "", errors.Errorf("scanner image pull timed out for %s (increase DOCKER_IMAGE_PULL_TIMEOUT or setting)", scannerImage)}- return "", errors.WrapIff(err, "pull scanner image %s", trivyImage)+ return "", errors.WrapIff(err, "pull scanner image %s", scannerImage)}if err := dockerutils.RenderJSONMessageStream(pullReader, io.Discard); err != nil {_ = pullReader.Close()@@ -647,7 +659,7 @@ func (s *VulnerabilityService) ensureTrivyImageInternal(ctx context.Context) (st}_ = pullReader.Close()- return trivyImage, nil+ return scannerImage, nil}func (s *VulnerabilityService) ensureTrivyCacheVolumeInternal(ctx context.Context) (string, error) {@@ -759,7 +771,7 @@ func (s *VulnerabilityService) buildTrivyCommandArgs() ([]string, []string) {serverURL, _ := s.getTrivyServerConfig()cmdArgs := []string{"image", "--format", "json", "--quiet", "--timeout", s.getTrivyScanTimeoutArg()}- cmdArgs = append(cmdArgs, vuln.ScanSourceArgs(serverURL)...)+ cmdArgs = append(cmdArgs, vuln.ScanSourceArgs(serverURL, s.getTrivyDbRegistryInternal())...)cmdArgs = append(cmdArgs, vuln.IgnoreUnfixedArgs(s.getTrivyIgnoreUnfixed())...)var tempFiles []string@@ -1066,12 +1078,12 @@ func (s *VulnerabilityService) waitForTrivyContainer(return statusCode, nil}-func (s *VulnerabilityService) runTrivyScan(ctx context.Context, trivyImage string, imageName string, imageID string) (*vulnerability.ScanResult, error) {+func (s *VulnerabilityService) runTrivyScan(ctx context.Context, scannerImage string, imageName string, imageID string) (*vulnerability.ScanResult, error) {slog.DebugContext(ctx,"running trivy scan","imageId", imageID,"imageName", imageName,- "trivyImage", trivyImage,+ "scannerImage", scannerImage,)slotID, releaseSlot, err := s.acquireTrivyScanSlotInternal(ctx)@@ -1132,7 +1144,7 @@ func (s *VulnerabilityService) runTrivyScan(ctx context.Context, trivyImage strienv = append(env, vuln.ServerTokenEnv(serverToken)...)}- config := vuln.BuildContainerConfig(trivyImage, cmdArgs, env)+ config := vuln.BuildContainerConfig(scannerImage, cmdArgs, env)resources, cpuSet, applyLimits := s.getTrivyContainerResourceOptionsInternal(ctx, dockerClient)runtimeSecurity := s.getTrivyRuntimeSecurityInternal().OrEmpty()securityOpts, privileged := runtimeSecurity.securityOpts, runtimeSecurity.privilegeddiff --git a/backend/pkg/libarcane/settings.go b/backend/pkg/libarcane/settings.goindex dcc7294d9..dd7294ca5 100644--- a/backend/pkg/libarcane/settings.go+++ b/backend/pkg/libarcane/settings.go@@ -2,12 +2,26 @@ package libarcaneimport ("slices"+ "strings""github.com/robfig/cron/v3")const DepotTokenSettingKey = "depotToken"+const (+ GHCRRegistryHost = "ghcr.io"+ DockerHubRegistryHost = "docker.io"+)++// ArcaneRegistryHost normalizes a registry setting to a host that mirrors the getarcaneapp images, defaulting to GHCR.+func ArcaneRegistryHost(registry string) string {+ if strings.TrimSpace(registry) == DockerHubRegistryHost {+ return DockerHubRegistryHost+ }+ return GHCRRegistryHost+}+type SettingUpdate struct {Key string `json:"key"`Value string `json:"value"`diff --git a/backend/pkg/libarcane/volumehelper/helper.go b/backend/pkg/libarcane/volumehelper/helper.goindex e6b83161d..082365109 100644--- a/backend/pkg/libarcane/volumehelper/helper.go+++ b/backend/pkg/libarcane/volumehelper/helper.go@@ -8,6 +8,7 @@ import ("strings""emperror.dev/errors"+ ref "github.com/distribution/reference""github.com/getarcaneapp/arcane/backend/v2/pkg/libarcane""github.com/moby/moby/api/types/container"@@ -26,10 +27,15 @@ type RuntimeImage struct {}const (- DefaultToolsImage = "ghcr.io/getarcaneapp/tools:latest"- ContainerLabel = "com.getarcaneapp.volume-helper"+ toolsRepoPathInternal = "getarcaneapp/tools"+ ContainerLabel = "com.getarcaneapp.volume-helper")+// ToolsImage returns the shared Arcane tools image reference hosted on the given registry setting.+func ToolsImage(registry string) string {+ return libarcane.ArcaneRegistryHost(registry) + "/" + toolsRepoPathInternal + ":latest"+}+// Labels returns the labels used for temporary internal volume helper containers.func Labels() map[string]string {return map[string]string{@@ -62,16 +68,16 @@ func HostConfig(helperImage string, binds []string, mounts []mount.Mount) *conta// ResolveHelperImage returns an image suitable for temporary volume helper// containers, pulling the tools image when it is not already present.-func ResolveHelperImage(ctx context.Context, dockerClient *client.Client) (string, error) {+func ResolveHelperImage(ctx context.Context, dockerClient *client.Client, toolsImage string) (string, error) {if dockerClient == nil {return "", errors.New("docker service unavailable")}- if _, err := dockerClient.ImageInspect(ctx, DefaultToolsImage); err == nil {- return DefaultToolsImage, nil+ if _, err := dockerClient.ImageInspect(ctx, toolsImage); err == nil {+ return toolsImage, nil}- pullReader, pullErr := dockerClient.ImagePull(ctx, DefaultToolsImage, client.ImagePullOptions{})+ pullReader, pullErr := dockerClient.ImagePull(ctx, toolsImage, client.ImagePullOptions{})if pullErr == nil {if pullReader == nil {pullErr = errors.New("helper image pull returned no response body")@@ -80,7 +86,7 @@ func ResolveHelperImage(ctx context.Context, dockerClient *client.Client) (strinif _, err := io.Copy(io.Discard, pullReader); err != nil {pullErr = errors.WrapIf(err, "read helper image pull response")} else {- return DefaultToolsImage, nil+ return toolsImage, nil}}}@@ -156,5 +162,6 @@ func buildRuntimeImageInternal(image string, entrypoint []string, command []stri}func isArcaneFallbackImageInternal(helperImage string) bool {- return !strings.EqualFold(strings.TrimSpace(helperImage), DefaultToolsImage)+ named, err := ref.ParseNormalizedNamed(strings.TrimSpace(helperImage))+ return err != nil || ref.Path(named) != toolsRepoPathInternal}diff --git a/backend/pkg/libarcane/volumehelper/helper_test.go b/backend/pkg/libarcane/volumehelper/helper_test.goindex 79f973860..e39523d28 100644--- a/backend/pkg/libarcane/volumehelper/helper_test.go+++ b/backend/pkg/libarcane/volumehelper/helper_test.go@@ -42,10 +42,10 @@ func TestResolveHelperImage_UsesLocalToolsImage(t *testing.T) {}))t.Cleanup(server.Close)- image, err := ResolveHelperImage(context.Background(), newTestDockerClientInternal(t, server))+ image, err := ResolveHelperImage(context.Background(), newTestDockerClientInternal(t, server), ToolsImage(""))require.NoError(t, err)- require.Equal(t, DefaultToolsImage, image)+ require.Equal(t, ToolsImage(""), image)require.Zero(t, pullCalls.Load())}@@ -74,10 +74,10 @@ func TestResolveHelperImage_PullsToolsImageWhenMissing(t *testing.T) {}))t.Cleanup(server.Close)- image, err := ResolveHelperImage(context.Background(), newTestDockerClientInternal(t, server))+ image, err := ResolveHelperImage(context.Background(), newTestDockerClientInternal(t, server), ToolsImage(""))require.NoError(t, err)- require.Equal(t, DefaultToolsImage, image)+ require.Equal(t, ToolsImage(""), image)require.EqualValues(t, 1, pullCalls.Load())}@@ -111,7 +111,7 @@ func TestResolveHelperImage_FallsBackToArcaneRuntimeWhenToolsPullFails(t *testin}))t.Cleanup(server.Close)- image, err := ResolveHelperImage(context.Background(), newTestDockerClientInternal(t, server))+ image, err := ResolveHelperImage(context.Background(), newTestDockerClientInternal(t, server), ToolsImage(""))require.NoError(t, err)require.Equal(t, "arcane:local", image)@@ -135,7 +135,7 @@ func TestResolveHelperImage_ReturnsPullErrorWhenNoFallbackExists(t *testing.T) {}))t.Cleanup(server.Close)- image, err := ResolveHelperImage(context.Background(), newTestDockerClientInternal(t, server))+ image, err := ResolveHelperImage(context.Background(), newTestDockerClientInternal(t, server), ToolsImage(""))require.Error(t, err)require.Empty(t, image)diff --git a/backend/pkg/libarcane/volumes/volume_rename.go b/backend/pkg/libarcane/volumes/volume_rename.goindex 987fd2b5a..93f655e18 100644--- a/backend/pkg/libarcane/volumes/volume_rename.go+++ b/backend/pkg/libarcane/volumes/volume_rename.go@@ -53,6 +53,7 @@ type dockerProjectVolumeRenameMigrationInternal struct {removedOld []projectVolumeRenameEntryInternaloldComposeName stringnewComposeName string+ toolsImage string}type JournalVolume struct {@@ -72,7 +73,7 @@ const (projectVolumeCopyMountPathInternal = "/volume")-func PlanMigration(ctx context.Context, dockerClient *client.Client, composeProject *composetypes.Project, oldComposeName, newComposeName string) (Migration, error) {+func PlanMigration(ctx context.Context, dockerClient *client.Client, composeProject *composetypes.Project, oldComposeName, newComposeName string, toolsImage string) (Migration, error) {if dockerClient == nil {return nil, errors.New("docker service unavailable")}@@ -102,11 +103,12 @@ func PlanMigration(ctx context.Context, dockerClient *client.Client, composeProjentries: entries,oldComposeName: oldComposeName,newComposeName: newComposeName,+ toolsImage: toolsImage,}, nil}// PlanRename validates and prepares an unused Docker volume for a copy-based rename.-func PlanRename(ctx context.Context, dockerClient *client.Client, oldName, newName string) (Migration, error) {+func PlanRename(ctx context.Context, dockerClient *client.Client, oldName, newName string, toolsImage string) (Migration, error) {if dockerClient == nil {return nil, errors.New("docker service unavailable")}@@ -146,6 +148,7 @@ func PlanRename(ctx context.Context, dockerClient *client.Client, oldName, newNareturn &dockerProjectVolumeRenameMigrationInternal{dockerClient: dockerClient,entries: []projectVolumeRenameEntryInternal{entry},+ toolsImage: toolsImage,}, nil}@@ -208,7 +211,7 @@ func (m *dockerProjectVolumeRenameMigrationInternal) Apply(ctx context.Context)dockerClient := m.dockerClient- copyRuntime, err := getProjectVolumeCopyRuntimeInternal(ctx, dockerClient)+ copyRuntime, err := getProjectVolumeCopyRuntimeInternal(ctx, dockerClient, m.toolsImage)if err != nil {return err}@@ -562,12 +565,12 @@ func createProjectVolumeCopyHolderContainerInternal(ctx context.Context, dockerCreturn resp.ID, cleanup, nil}-func getProjectVolumeCopyRuntimeInternal(ctx context.Context, dockerClient *client.Client) (projectVolumeCopyRuntimeInternal, error) {+func getProjectVolumeCopyRuntimeInternal(ctx context.Context, dockerClient *client.Client, toolsImage string) (projectVolumeCopyRuntimeInternal, error) {if dockerClient == nil {return projectVolumeCopyRuntimeInternal{}, errors.New("docker service unavailable")}- image, err := volumehelper.ResolveHelperImage(ctx, dockerClient)+ image, err := volumehelper.ResolveHelperImage(ctx, dockerClient, toolsImage)if err != nil {return projectVolumeCopyRuntimeInternal{}, err}diff --git a/backend/pkg/libarcane/volumes/volume_rename_runtime_test.go b/backend/pkg/libarcane/volumes/volume_rename_runtime_test.goindex 825f49075..2eff6052c 100644--- a/backend/pkg/libarcane/volumes/volume_rename_runtime_test.go+++ b/backend/pkg/libarcane/volumes/volume_rename_runtime_test.go@@ -27,10 +27,10 @@ func TestGetProjectVolumeCopyRuntimeInternal_UsesToolsImageWhenAvailable(t *test}))t.Cleanup(server.Close)- copyRuntime, err := getProjectVolumeCopyRuntimeInternal(context.Background(), newTestDockerClient(t, server))+ copyRuntime, err := getProjectVolumeCopyRuntimeInternal(context.Background(), newTestDockerClient(t, server), volumehelper.ToolsImage(""))require.NoError(t, err)- require.Equal(t, volumehelper.DefaultToolsImage, copyRuntime.Image)+ require.Equal(t, volumehelper.ToolsImage(""), copyRuntime.Image)}func TestCreateProjectVolumeCopyHolderContainerInternal_UsesPassiveHolderCommand(t *testing.T) {diff --git a/backend/pkg/libarcane/volumes/volume_rename_safety_test.go b/backend/pkg/libarcane/volumes/volume_rename_safety_test.goindex 08597701e..68a4df063 100644--- a/backend/pkg/libarcane/volumes/volume_rename_safety_test.go+++ b/backend/pkg/libarcane/volumes/volume_rename_safety_test.go@@ -11,6 +11,7 @@ import ("syscall""testing"+ "github.com/getarcaneapp/arcane/backend/v2/pkg/libarcane/volumehelper""github.com/moby/moby/api/types/container""github.com/moby/moby/api/types/mount""github.com/stretchr/testify/assert"@@ -116,7 +117,7 @@ func TestGetProjectVolumeCopyRuntimeInternal_UsesArcaneAgentLabel(t *testing.T)}))t.Cleanup(server.Close)- copyRuntime, err := getProjectVolumeCopyRuntimeInternal(context.Background(), newTestDockerClient(t, server))+ copyRuntime, err := getProjectVolumeCopyRuntimeInternal(context.Background(), newTestDockerClient(t, server), volumehelper.ToolsImage(""))require.NoError(t, err)require.Equal(t, "arcane-agent:local", copyRuntime.Image)diff --git a/backend/pkg/libarcane/volumes/volume_rename_test.go b/backend/pkg/libarcane/volumes/volume_rename_test.goindex 6c7fdfd93..c3edbed72 100644--- a/backend/pkg/libarcane/volumes/volume_rename_test.go+++ b/backend/pkg/libarcane/volumes/volume_rename_test.go@@ -11,6 +11,7 @@ import (composetypes "github.com/compose-spec/compose-go/v2/types""github.com/docker/compose/v5/pkg/api""github.com/getarcaneapp/arcane/backend/v2/pkg/libarcane"+ "github.com/getarcaneapp/arcane/backend/v2/pkg/libarcane/volumehelper""github.com/moby/moby/api/types/container""github.com/moby/moby/api/types/volume""github.com/moby/moby/client"@@ -81,7 +82,7 @@ func TestPlanRenamePreservesStandaloneVolumeConfiguration(t *testing.T) {}))t.Cleanup(server.Close)- migration, err := PlanRename(t.Context(), newTestDockerClient(t, server), "source-data", "renamed-data")+ migration, err := PlanRename(t.Context(), newTestDockerClient(t, server), "source-data", "renamed-data", volumehelper.ToolsImage(""))require.NoError(t, err)planned, ok := migration.(*dockerProjectVolumeRenameMigrationInternal)diff --git a/backend/pkg/libarcane/vuln/trivy.go b/backend/pkg/libarcane/vuln/trivy.goindex c7b14e428..0c5d6d523 100644--- a/backend/pkg/libarcane/vuln/trivy.go+++ b/backend/pkg/libarcane/vuln/trivy.go@@ -22,11 +22,10 @@ const (// DefaultDockerHostURI is the fallback Docker endpoint used when none is configured.DefaultDockerHostURI = "unix:///var/run/docker.sock"- // DefaultDBRepository / DefaultJavaDBRepository / DefaultChecksBundleRepository are the- // Arcane-mirrored Trivy database locations passed to the scanner.- DefaultDBRepository = "ghcr.io/getarcaneapp/trivy-db:2"- DefaultJavaDBRepository = "ghcr.io/getarcaneapp/trivy-java-db:1"- DefaultChecksBundleRepository = "ghcr.io/getarcaneapp/trivy-checks:1"+ // DBRepository / JavaDBRepository / ChecksBundleRepository are the Arcane-mirrored Trivy database paths without a registry host.+ DBRepository = "getarcaneapp/trivy-db:2"+ JavaDBRepository = "getarcaneapp/trivy-java-db:1"+ ChecksBundleRepository = "getarcaneapp/trivy-checks:1")// ParseVersion extracts the version string from `trivy --version` output. It@@ -135,13 +134,13 @@ func ScanCacheBackendArgs() []string {return ScanCacheBackendArgsForArch(runtime.GOARCH)}-// DefaultRepositoryArgs returns the Trivy DB repository flags pointing at the-// Arcane-mirrored databases.-func DefaultRepositoryArgs() []string {+// RepositoryArgs returns the Trivy DB repository flags pointing at the Arcane-mirrored databases on the given registry.+func RepositoryArgs(registry string) []string {+ host := libarcane.ArcaneRegistryHost(registry)return []string{- "--db-repository", DefaultDBRepository,- "--java-db-repository", DefaultJavaDBRepository,- "--checks-bundle-repository", DefaultChecksBundleRepository,+ "--db-repository", host + "/" + DBRepository,+ "--java-db-repository", host + "/" + JavaDBRepository,+ "--checks-bundle-repository", host + "/" + ChecksBundleRepository,}}@@ -152,10 +151,10 @@ func DefaultRepositoryArgs() []string {// memory-mapped. With an empty serverURL it falls back to the standalone// local-database flags. The server token is passed via ServerTokenEnv rather than// a flag so it is not exposed in the process arguments.-func ScanSourceArgs(serverURL string) []string {+func ScanSourceArgs(serverURL string, registry string) []string {serverURL = strings.TrimSpace(serverURL)if serverURL == "" {- return append(ScanCacheBackendArgs(), DefaultRepositoryArgs()...)+ return append(ScanCacheBackendArgs(), RepositoryArgs(registry)...)}return []string{"--server", serverURL}@@ -216,9 +215,9 @@ func BuildDockerConfigJSON(authConfigs map[string]dockerregistry.AuthConfig) ([]}// BuildContainerConfig assembles the container.Config for a Trivy scan container.-func BuildContainerConfig(trivyImage string, cmdArgs []string, env []string) *containertypes.Config {+func BuildContainerConfig(scannerImage string, cmdArgs []string, env []string) *containertypes.Config {return &containertypes.Config{- Image: trivyImage,+ Image: scannerImage,Entrypoint: []string{"trivy"},Cmd: cmdArgs,Env: append([]string(nil), env...),diff --git a/backend/pkg/libarcane/vuln/trivy_test.go b/backend/pkg/libarcane/vuln/trivy_test.goindex 782565398..bb00c80c5 100644--- a/backend/pkg/libarcane/vuln/trivy_test.go+++ b/backend/pkg/libarcane/vuln/trivy_test.go@@ -112,37 +112,46 @@ func TestScanCacheBackendArgsForArch(t *testing.T) {}}-func TestDefaultRepositoryArgs(t *testing.T) {- args := DefaultRepositoryArgs()- require.Contains(t, args, "--db-repository")- require.Contains(t, args, DefaultDBRepository)- require.Contains(t, args, "--java-db-repository")- require.Contains(t, args, DefaultJavaDBRepository)- require.Contains(t, args, "--checks-bundle-repository")- require.Contains(t, args, DefaultChecksBundleRepository)+func TestRepositoryArgs(t *testing.T) {+ t.Run("default registry", func(t *testing.T) {+ args := RepositoryArgs("")+ require.Contains(t, args, "--db-repository")+ require.Contains(t, args, "ghcr.io/"+DBRepository)+ require.Contains(t, args, "--java-db-repository")+ require.Contains(t, args, "ghcr.io/"+JavaDBRepository)+ require.Contains(t, args, "--checks-bundle-repository")+ require.Contains(t, args, "ghcr.io/"+ChecksBundleRepository)+ })++ t.Run("docker hub registry", func(t *testing.T) {+ args := RepositoryArgs("docker.io")+ require.Contains(t, args, "docker.io/"+DBRepository)+ require.Contains(t, args, "docker.io/"+JavaDBRepository)+ require.Contains(t, args, "docker.io/"+ChecksBundleRepository)+ })}func TestScanSourceArgs(t *testing.T) {t.Run("standalone uses local db repositories", func(t *testing.T) {- args := ScanSourceArgs("")+ args := ScanSourceArgs("", "")require.Contains(t, args, "--db-repository")require.NotContains(t, args, "--server")})t.Run("blank server url falls back to standalone", func(t *testing.T) {- args := ScanSourceArgs(" ")+ args := ScanSourceArgs(" ", "")require.Contains(t, args, "--db-repository")require.NotContains(t, args, "--server")})t.Run("server url replaces local db flags", func(t *testing.T) {- args := ScanSourceArgs(" http://trivy.example.com:4954 ")+ args := ScanSourceArgs(" http://trivy.example.com:4954 ", "")require.Equal(t, []string{"--server", "http://trivy.example.com:4954"}, args)require.NotContains(t, args, "--db-repository")})t.Run("token never appears in args", func(t *testing.T) {- require.NotContains(t, ScanSourceArgs("http://trivy.example.com:4954"), "--token")+ require.NotContains(t, ScanSourceArgs("http://trivy.example.com:4954", ""), "--token")})}diff --git a/frontend/messages/en.json b/frontend/messages/en.jsonindex 4a08149bf..b2cf97ff2 100644--- a/frontend/messages/en.json+++ b/frontend/messages/en.json@@ -1522,9 +1522,8 @@"security_trivy_tab": "Trivy","security_lifecycle_tab": "Lifecycle","security_vulnerability_scanning_heading": "Vulnerability Scanning",- "security_trivy_image_label": "Arcane Tools Image",- "security_trivy_image_description": "Container image used to run Trivy vulnerability scans.",- "security_trivy_image_note": "Note: This must be an Arcane tools image that includes Trivy (for example, ghcr.io/getarcaneapp/tools:latest).",+ "trivy_db_registry_label": "Trivy DB Registry",+ "trivy_db_registry_description": "Registry used to pull the Trivy database artifacts.","security_trivy_network_label": "Trivy Network","security_trivy_network_description": "Docker network mode/network name used for Trivy scan containers.","security_trivy_network_help": "Leave this on Auto to inherit Arcane's network. Choose host, none, bridge, or a custom Docker network only when you need to override it.",@@ -1820,6 +1819,8 @@"registries_allow_insecure_label": "Allow Insecure Connection","registries_allow_insecure_description": "Allow HTTP connections","registry_docker_hub": "Docker Hub",+ "no_pull_limits": "No pull limits",+ "follows_running_image": "Follows the registry the running image was pulled from.","registry_github_container_registry": "GitHub Container Registry","registry_google_container_registry": "Google Container Registry","registry_quay_io": "Quay.io Registry",@@ -2929,6 +2930,10 @@"deploy_recreate_volumes": "Recreate changed volumes (data loss)","settings_default_deploy_pull_policy": "Default Deploy Pull Policy","settings_default_deploy_pull_policy_description": "Default image pull policy when deploying projects. A pull_policy set per service in the compose file takes precedence, including refresh windows (daily, weekly, every_N).",+ "tools_image_registry_label": "Tools Image Registry",+ "tools_image_registry_description": "Registry used to pull the Arcane tools helper image.",+ "update_check_registry_label": "Update Check Registry",+ "update_check_registry_description": "Registry queried when checking whether the Arcane image has a newer digest. Auto follows the registry the running image was pulled from.","authentication": "Authentication","authentication_description": "Configure authentication providers, password policy, and session behavior.","webhook_page_title": "Webhooks",diff --git a/frontend/src/lib/components/form/select-with-label.svelte b/frontend/src/lib/components/form/select-with-label.svelteindex 5b1094fb3..4a7dc15e9 100644--- a/frontend/src/lib/components/form/select-with-label.svelte+++ b/frontend/src/lib/components/form/select-with-label.svelte@@ -1,4 +1,5 @@<script lang="ts">+ import { Badge } from '#lib/components/ui/badge';import { Label } from '#lib/components/ui/label';import * as Select from '#lib/components/ui/select/index.js';import { m } from '#lib/paraglide/messages';@@ -27,7 +28,7 @@error?: string | null;disabled?: boolean;placeholder?: string;- options: { label: string; value: string; description?: string }[];+ options: { label: string; value: string; description?: string; badge?: string }[];groupLabel?: string;hideLabel?: boolean;triggerClass?: string;@@ -35,14 +36,19 @@onValueChange?: (value: string) => void;} = $props();- const selectedLabel = $derived(options.find((o) => o.value === value)?.label ?? placeholder);+ const selected = $derived(options.find((o) => o.value === value));</script>{#snippet optionItems()}{#each options as option (option.value)}<Select.Item value={option.value}><div class="flex flex-col items-start gap-1">- <span class="font-medium">{option.label}</span>+ <span class="flex items-center gap-2 font-medium">+ {option.label}+ {#if option.badge}+ <Badge variant="purple" size="sm" class="relative -top-px px-1.5 py-0 text-[10px] leading-4">{option.badge}</Badge>+ {/if}+ </span>{#if option.description}<span class="text-xs text-muted-foreground">{option.description}</span>{/if}@@ -69,7 +75,12 @@<Select.Root type="single" bind:value {name} {disabled} onValueChange={(v) => onValueChange?.(v)}><Select.Trigger size={triggerSize} class="{triggerClass} {error ? 'border-destructive' : ''}" {id}>- <span>{selectedLabel}</span>+ <span class="flex items-center gap-2">+ {selected?.label ?? placeholder}+ {#if selected?.badge}+ <Badge variant="purple" size="sm" class="relative -top-px px-1.5 py-0 text-[10px] leading-4">{selected.badge}</Badge>+ {/if}+ </span></Select.Trigger><Select.Content>diff --git a/frontend/src/lib/components/settings/trivy-security-settings.svelte b/frontend/src/lib/components/settings/trivy-security-settings.svelteindex ff55df466..aa391e9fe 100644--- a/frontend/src/lib/components/settings/trivy-security-settings.svelte+++ b/frontend/src/lib/components/settings/trivy-security-settings.svelte@@ -3,6 +3,7 @@import { Textarea } from '#lib/components/ui/textarea/index.js';import * as Alert from '#lib/components/ui/alert';import SearchableSelect from '#lib/components/form/searchable-select.svelte';+ import SelectWithLabel from '#lib/components/form/select-with-label.svelte';import TextInputWithLabel from '#lib/components/form/text-input-with-label.svelte';import SettingsRow from '#lib/components/settings/settings-row.svelte';import { SecurityIcon, InfoIcon } from '#lib/icons';@@ -13,10 +14,11 @@import type { Settings } from '#lib/types/settings';import type { Readable } from 'svelte/store';import SectionCard from '#lib/components/section-card.svelte';+ import { arcaneImageRegistryOptions, arcaneTrivyDbImages } from '#lib/utils/registry';type TrivySecurityFormValues = Pick<Settings,- | 'trivyImage'+ | 'trivyDbRegistry'| 'trivyNetwork'| 'trivySecurityOpts'| 'trivyPrivileged'@@ -156,16 +158,20 @@contentClass="divide-y divide-border/40 lg:p-6 lg:pt-0 [&>*]:py-5 [&>*:first-child]:pt-0 [&>*:last-child]:pb-0"><div class="max-w-xl">- <TextInputWithLabel- bind:value={$formInputs.trivyImage.value}- error={$formInputs.trivyImage.error}- disabled={true}- label={m.security_trivy_image_label()}- description={m.security_trivy_image_description()}- helpText={m.security_trivy_image_note()}- placeholder="ghcr.io/getarcaneapp/tools:latest"- type="text"+ <SelectWithLabel+ id="trivyDbRegistry"+ name="trivyDbRegistry"+ bind:value={$formInputs.trivyDbRegistry.value}+ label={m.trivy_db_registry_label()}+ description={m.trivy_db_registry_description()}+ options={arcaneImageRegistryOptions()}+ onValueChange={(v) => ($formInputs.trivyDbRegistry.value = v as 'ghcr.io' | 'docker.io')}/>+ <ul class="mt-2 space-y-0.5 font-mono text-xs text-muted-foreground">+ {#each arcaneTrivyDbImages($formInputs.trivyDbRegistry.value) as image (image)}+ <li>{image}</li>+ {/each}+ </ul></div><SettingsRowdiff --git a/frontend/src/lib/types/settings.ts b/frontend/src/lib/types/settings.tsindex 20fe469a3..120f54430 100644--- a/frontend/src/lib/types/settings.ts+++ b/frontend/src/lib/types/settings.ts@@ -67,7 +67,9 @@ export type Settings = {authLocalEnabled: boolean;authSessionTimeout: number;authPasswordPolicy: 'basic' | 'standard' | 'strong';- trivyImage: string;+ toolsImageRegistry: 'ghcr.io' | 'docker.io';+ updateCheckRegistry: 'auto' | 'ghcr.io' | 'docker.io';+ trivyDbRegistry: 'ghcr.io' | 'docker.io';trivyNetwork: string;trivySecurityOpts: string;trivyPrivileged: boolean;diff --git a/frontend/src/lib/utils/registry.ts b/frontend/src/lib/utils/registry.tsindex 3e9dde8f3..d6d5a616b 100644--- a/frontend/src/lib/utils/registry.ts+++ b/frontend/src/lib/utils/registry.ts@@ -14,6 +14,32 @@ export function getRegistryDisplayName(registry: RegistryIdentity): string {return url;}+/** Select options for the registries that mirror the getarcaneapp images. */+export function arcaneImageRegistryOptions() {+ return [+ { value: 'ghcr.io', label: m.registry_github_container_registry() },+ { value: 'docker.io', label: m.registry_docker_hub(), badge: m.no_pull_limits() }+ ];+}++function arcaneRegistryHost(registry: string): string {+ return registry === 'docker.io' ? 'docker.io' : 'ghcr.io';+}++export function arcaneToolsImage(registry: string): string {+ return `${arcaneRegistryHost(registry)}/getarcaneapp/tools:latest`;+}++export function arcaneTrivyDbImages(registry: string): string[] {+ const host = arcaneRegistryHost(registry);+ return [`${host}/getarcaneapp/trivy-db:2`, `${host}/getarcaneapp/trivy-java-db:1`, `${host}/getarcaneapp/trivy-checks:1`];+}++export function arcaneUpdateCheckImage(registry: string, isLocalEnvironment: boolean): string | null {+ if (registry === 'auto') return null;+ return `${arcaneRegistryHost(registry)}/getarcaneapp/${isLocalEnvironment ? 'manager' : 'agent'}`;+}+/** Strips the scheme and trailing slashes so a registry URL can be used as an image host. */function normalizeRegistryHost(url: string): string {return url.replace(/^https?:\/\//, '').replace(/\/+$/, '');diff --git a/frontend/src/routes/(app)/environments/[id]/+page.svelte b/frontend/src/routes/(app)/environments/[id]/+page.svelteindex dc60f185f..1e13984d7 100644--- a/frontend/src/routes/(app)/environments/[id]/+page.svelte+++ b/frontend/src/routes/(app)/environments/[id]/+page.svelte@@ -279,7 +279,9 @@pruneBuildCacheMode: settings?.pruneBuildCacheMode ?? 'none',pruneBuildCacheUntil: settings?.pruneBuildCacheUntil ?? '',vulnerabilityScanEnabled: settings?.vulnerabilityScanEnabled ?? false,- trivyImage: settings?.trivyImage || '',+ toolsImageRegistry: settings?.toolsImageRegistry ?? 'ghcr.io',+ updateCheckRegistry: settings?.updateCheckRegistry ?? 'auto',+ trivyDbRegistry: settings?.trivyDbRegistry ?? 'ghcr.io',trivyNetwork: settings?.trivyNetwork || '',trivySecurityOpts: settings?.trivySecurityOpts || '',trivyPrivileged: settings?.trivyPrivileged ?? false,@@ -344,7 +346,9 @@pruneBuildCacheMode: formData.pruneBuildCacheMode,pruneBuildCacheUntil: formData.pruneBuildCacheUntil,vulnerabilityScanEnabled: formData.vulnerabilityScanEnabled,- trivyImage: formData.trivyImage,+ toolsImageRegistry: formData.toolsImageRegistry,+ updateCheckRegistry: formData.updateCheckRegistry,+ trivyDbRegistry: formData.trivyDbRegistry,trivyNetwork: formData.trivyNetwork,trivySecurityOpts: formData.trivySecurityOpts,trivyPrivileged: formData.trivyPrivileged,@@ -749,7 +753,7 @@</Tabs.Content><Tabs.Content value="docker">- <DockerTab {formInputs} {shellSelectValue} {handleShellSelectChange} {shellOptions} />+ <DockerTab {formInputs} environmentId={environment.id} {shellSelectValue} {handleShellSelectChange} {shellOptions} /></Tabs.Content><Tabs.Content value="security">diff --git a/frontend/src/routes/(app)/environments/[id]/components/DockerTab.svelte b/frontend/src/routes/(app)/environments/[id]/components/DockerTab.svelteindex c70415cf8..22033b948 100644--- a/frontend/src/routes/(app)/environments/[id]/components/DockerTab.svelte+++ b/frontend/src/routes/(app)/environments/[id]/components/DockerTab.svelte@@ -8,8 +8,9 @@import { m } from '#lib/paraglide/messages';import { DockerBrandIcon } from '#lib/icons';import type { DockerTabProps } from './tab-props';+ import { arcaneImageRegistryOptions, arcaneToolsImage, arcaneUpdateCheckImage } from '#lib/utils/registry';- let { formInputs, shellSelectValue, handleShellSelectChange, shellOptions }: DockerTabProps = $props();+ let { formInputs, environmentId, shellSelectValue, handleShellSelectChange, shellOptions }: DockerTabProps = $props();const deployPullPolicyOptions = [{ value: 'missing', label: 'Missing', description: m.deploy_pull_policy_missing() },@@ -17,6 +18,9 @@{ value: 'never', label: m.common_never(), description: m.deploy_pull_policy_never() }];+ const registryOptions = arcaneImageRegistryOptions();+ const updateCheckImage = $derived(arcaneUpdateCheckImage($formInputs.updateCheckRegistry.value, environmentId === '0'));+const pruneContainerModes = [{ value: 'none', label: m.none() },{ value: 'stopped', label: m.prune_stopped_containers() },@@ -95,6 +99,34 @@/></div>+ <div class="space-y-2">+ <SelectWithLabel+ id="toolsImageRegistry"+ name="toolsImageRegistry"+ bind:value={$formInputs.toolsImageRegistry.value}+ label={m.tools_image_registry_label()}+ description={m.tools_image_registry_description()}+ options={registryOptions}+ onValueChange={(v) => ($formInputs.toolsImageRegistry.value = v as 'ghcr.io' | 'docker.io')}+ />+ <p class="font-mono text-xs text-muted-foreground">{arcaneToolsImage($formInputs.toolsImageRegistry.value)}</p>+ </div>++ <div class="space-y-2">+ <SelectWithLabel+ id="updateCheckRegistry"+ name="updateCheckRegistry"+ bind:value={$formInputs.updateCheckRegistry.value}+ label={m.update_check_registry_label()}+ description={m.update_check_registry_description()}+ options={[{ value: 'auto', label: m.auto() }, ...registryOptions]}+ onValueChange={(v) => ($formInputs.updateCheckRegistry.value = v as 'auto' | 'ghcr.io' | 'docker.io')}+ />+ <p class="text-xs text-muted-foreground {updateCheckImage ? 'font-mono' : ''}">+ {updateCheckImage ?? m.follows_running_image()}+ </p>+ </div>+<TextInputWithLabelid="base-server-url"label={m.general_base_url_label()}diff --git a/frontend/src/routes/(app)/environments/[id]/components/environment-form-schema.ts b/frontend/src/routes/(app)/environments/[id]/components/environment-form-schema.tsindex 5361b9fe0..a40b9f024 100644--- a/frontend/src/routes/(app)/environments/[id]/components/environment-form-schema.ts+++ b/frontend/src/routes/(app)/environments/[id]/components/environment-form-schema.ts@@ -33,7 +33,9 @@ export const environmentFormSchema = zpruneBuildCacheMode: z.enum(['none', 'unused', 'all', 'olderThan']),pruneBuildCacheUntil: z.string(),vulnerabilityScanEnabled: z.boolean(),- trivyImage: z.string(),+ toolsImageRegistry: z.enum(['ghcr.io', 'docker.io']),+ updateCheckRegistry: z.enum(['auto', 'ghcr.io', 'docker.io']),+ trivyDbRegistry: z.enum(['ghcr.io', 'docker.io']),trivyNetwork: z.string(),trivySecurityOpts: z.string(),trivyPrivileged: z.boolean(),diff --git a/frontend/src/routes/(app)/environments/[id]/components/tab-props.ts b/frontend/src/routes/(app)/environments/[id]/components/tab-props.tsindex 176f9ca39..09e9a2355 100644--- a/frontend/src/routes/(app)/environments/[id]/components/tab-props.ts+++ b/frontend/src/routes/(app)/environments/[id]/components/tab-props.ts@@ -19,6 +19,7 @@ export interface StorageTabProps {export interface DockerTabProps {formInputs: EnvironmentFormInputs;+ environmentId: string;shellSelectValue: string;handleShellSelectChange: (value: string) => void;shellOptions: { value: string; label: string; description?: string }[];diff --git a/types/settings/settings.go b/types/settings/settings.goindex 8c64e7117..dffe04aa5 100644--- a/types/settings/settings.go+++ b/types/settings/settings.go@@ -119,6 +119,18 @@ type Update struct {// Required: falseDefaultDeployPullPolicy *string `json:"defaultDeployPullPolicy,omitzero" binding:"omitempty,oneof=missing always never"`+ // ToolsImageRegistry is the container registry used to pull the Arcane tools helper image.+ //+ // Required: false+ ToolsImageRegistry *string `json:"toolsImageRegistry,omitzero" binding:"omitempty,oneof=ghcr.io docker.io"`++ // UpdateCheckRegistry is the registry queried when checking whether the+ // running Arcane image has a newer digest. "auto" follows the registry the+ // running image was pulled from.+ //+ // Required: false+ UpdateCheckRegistry *string `json:"updateCheckRegistry,omitzero" binding:"omitempty,oneof=auto ghcr.io docker.io"`+// ScheduledPruneEnabled indicates if scheduled pruning is enabled.//// Required: false@@ -278,10 +290,10 @@ type Update struct {// Required: falseAuthPasswordPolicy *string `json:"authPasswordPolicy,omitzero"`- // TrivyImage overrides the container image used for vulnerability scans.+ // TrivyDbRegistry is the container registry used to pull the Trivy vulnerability database artifacts.//// Required: false- TrivyImage *string `json:"trivyImage,omitzero"`+ TrivyDbRegistry *string `json:"trivyDbRegistry,omitzero" binding:"omitempty,oneof=ghcr.io docker.io"`// TrivyNetwork sets the Docker network mode/network name for Trivy scan containers.// Leave empty to inherit Arcane's network automatically, with bridge as the final fallback.