Skip to content

Modern Docker Management, Designed for Everyone

feat: allow use of remote trivy server, and only show fixable cves (#2999)

Kyle Mendell29c7335b4017
diff --git a/backend/internal/configschema/schema_test.go b/backend/internal/configschema/schema_test.go
index 043f2eff2..7d6dd73f5 100644
--- a/backend/internal/configschema/schema_test.go
+++ b/backend/internal/configschema/schema_test.go
@@ -348,6 +348,7 @@ var expectedSettingOverrideKeys = []string{
"trivyConfig",
"trivyCpuLimit",
"trivyIgnore",
+ "trivyIgnoreUnfixed",
"trivyImage",
"trivyMemoryLimitMb",
"trivyNetwork",
@@ -356,6 +357,9 @@ var expectedSettingOverrideKeys = []string{
"trivyResourceLimitsEnabled",
"trivyScanTimeout",
"trivySecurityOpts",
+ "trivyServerEnabled",
+ "trivyServerToken",
+ "trivyServerUrl",
"volumeBrowserHelperIdleTimeout",
"vulnerabilityScanEnabled",
"vulnerabilityScanInterval",
diff --git a/backend/internal/models/settings.go b/backend/internal/models/settings.go
index 1c9b4b69b..656d95f79 100644
--- a/backend/internal/models/settings.go
+++ b/backend/internal/models/settings.go
@@ -139,6 +139,10 @@ type Settings struct {
TrivyConcurrentScanContainers SettingVariable `key:"trivyConcurrentScanContainers,envOverride" meta:"label=Trivy Concurrent Scan Containers;type=number;keywords=trivy,concurrent,scan,containers,parallel,workers,limit,security;category=security;description=Maximum number of concurrent Trivy scan containers for manual and scheduled scans. Minimum 1"`
TrivyConfig SettingVariable `key:"trivyConfig" meta:"label=Trivy Config (YAML);type=textarea;keywords=trivy,config,yaml,configuration,scanner,settings;category=security;description=Trivy configuration file content in YAML format"`
TrivyIgnore SettingVariable `key:"trivyIgnore" meta:"label=.trivyignore;type=textarea;keywords=trivy,ignore,ignorefile,vulnerabilities,exceptions,exclusions;category=security;description=Trivy ignore file content - one vulnerability ID per line"`
+ TrivyServerEnabled SettingVariable `key:"trivyServerEnabled,envOverride" meta:"label=Trivy Client/Server Mode;type=boolean;keywords=trivy,server,client,remote,scanner,vulnerability,security,armv7,32bit;category=security;description=Scan against a remote Trivy server instead of downloading the vulnerability database locally. Recommended for 32-bit hosts (arm/v7) where the local DB cannot be memory-mapped."`
+ TrivyServerUrl SettingVariable `key:"trivyServerUrl,envOverride" meta:"label=Trivy Server URL;type=text;keywords=trivy,server,url,remote,scanner,vulnerability,security;category=security;description=URL of the remote Trivy server (e.g. http://trivy.example.com:4954). Used when client/server mode is enabled."`
+ TrivyServerToken SettingVariable `key:"trivyServerToken,envOverride,sensitive" meta:"label=Trivy Server Token;type=password;keywords=trivy,server,token,auth,remote,scanner,security;category=security;description=Optional authentication token sent to the remote Trivy server. Leave empty if the server requires no token."`
+ TrivyIgnoreUnfixed SettingVariable `key:"trivyIgnoreUnfixed,envOverride" meta:"label=Only Report Fixable Vulnerabilities;type=boolean;keywords=trivy,fixable,unfixed,ignore,vulnerability,security,noise,fixes;category=security;description=Only report vulnerabilities that have a known fix available. Reduces noise from vulnerabilities you cannot act on."`
OidcEnabled SettingVariable `key:"oidcEnabled,public,envOverride" meta:"label=OIDC Authentication;type=boolean;keywords=oidc,openid,connect,sso,oauth,external,provider,federation;category=authentication;description=Enable OpenID Connect (OIDC) authentication"`
OidcClientId SettingVariable `key:"oidcClientId,authrequired,envOverride" meta:"label=OIDC Client ID;type=text;keywords=oidc,client,id,oauth,openid;category=authentication;description=OIDC provider client ID"`
OidcClientSecret SettingVariable `key:"oidcClientSecret,sensitive,envOverride" meta:"label=OIDC Client Secret;type=password;keywords=oidc,client,secret,oauth,openid;category=authentication;description=OIDC provider client secret"`
diff --git a/backend/internal/services/settings_service.go b/backend/internal/services/settings_service.go
index 0c93fbf23..d9dddfb8c 100644
--- a/backend/internal/services/settings_service.go
+++ b/backend/internal/services/settings_service.go
@@ -160,6 +160,10 @@ func DefaultSettingsConfig() *models.Settings {
TrivyCpuLimit: models.SettingVariable{Value: "1"},
TrivyMemoryLimitMb: models.SettingVariable{Value: "0"},
TrivyConcurrentScanContainers: models.SettingVariable{Value: "1"},
+ TrivyServerEnabled: models.SettingVariable{Value: "false"},
+ TrivyServerUrl: models.SettingVariable{Value: ""},
+ TrivyServerToken: models.SettingVariable{Value: ""},
+ TrivyIgnoreUnfixed: models.SettingVariable{Value: "true"},
OidcEnabled: models.SettingVariable{Value: "false"},
OidcClientId: models.SettingVariable{Value: ""},
OidcClientSecret: models.SettingVariable{Value: ""},
diff --git a/backend/internal/services/vulnerability_service.go b/backend/internal/services/vulnerability_service.go
index f295b4ab2..ab23cfb10 100644
--- a/backend/internal/services/vulnerability_service.go
+++ b/backend/internal/services/vulnerability_service.go
@@ -1516,14 +1516,16 @@ func (s *VulnerabilityService) execTrivyScanInContainer(ctx context.Context, con
outputPath := newTrivyOutputPathInternal()
defer cleanupTrivyOutputFileInContainerInternal(ctx, dockerClient, containerID, outputPath)
+ serverURL, serverToken := s.getTrivyServerConfig()
execCmd := make([]string, 0, 16)
execCmd = append(execCmd, "trivy", "image", "--format", "json", "--quiet", "--output", outputPath, "--timeout", trivyTimeout)
- execCmd = append(execCmd, vuln.ScanCacheBackendArgs()...)
- execCmd = append(execCmd, vuln.DefaultRepositoryArgs()...)
+ execCmd = append(execCmd, vuln.ScanSourceArgs(serverURL)...)
+ execCmd = append(execCmd, vuln.IgnoreUnfixedArgs(s.getTrivyIgnoreUnfixed())...)
execCmd = append(execCmd, imageName)
execCfg := client.ExecCreateOptions{
Cmd: execCmd,
+ Env: vuln.ServerTokenEnv(serverToken),
AttachStdout: true,
AttachStderr: true,
}
@@ -2113,6 +2115,32 @@ func (s *VulnerabilityService) getTrivyConfigFiles() (configContent, ignoreConte
return cfg.TrivyConfig.Value, cfg.TrivyIgnore.Value
}
+// getTrivyServerConfig returns the remote Trivy server URL and optional token when
+// client/server mode is enabled, or empty strings for standalone (local DB) scanning.
+func (s *VulnerabilityService) getTrivyServerConfig() (serverURL, token string) {
+ if s.settingsService == nil {
+ return "", ""
+ }
+
+ cfg := s.settingsService.GetSettingsConfig()
+ if cfg == nil || !cfg.TrivyServerEnabled.IsTrue() {
+ return "", ""
+ }
+
+ return strings.TrimSpace(cfg.TrivyServerUrl.Value), strings.TrimSpace(cfg.TrivyServerToken.Value)
+}
+
+// getTrivyIgnoreUnfixed reports whether scans should only return vulnerabilities
+// that have a known fix (--ignore-unfixed).
+func (s *VulnerabilityService) getTrivyIgnoreUnfixed() bool {
+ if s.settingsService == nil {
+ return false
+ }
+
+ cfg := s.settingsService.GetSettingsConfig()
+ return cfg != nil && cfg.TrivyIgnoreUnfixed.IsTrue()
+}
+
func (s *VulnerabilityService) createTrivyConfigTempFile(ctx context.Context, content string) (string, bool) {
configFile, err := os.CreateTemp("", "trivy-config-*.yaml")
if err != nil {
@@ -2163,9 +2191,10 @@ func (s *VulnerabilityService) buildTrivyCommandArgs(
cacheDir string,
outputPath string,
) ([]string, []string) {
+ serverURL, _ := s.getTrivyServerConfig()
cmdArgs := []string{"image", "--format", "json", "--quiet", "--timeout", s.getTrivyScanTimeoutArg()}
- cmdArgs = append(cmdArgs, vuln.ScanCacheBackendArgs()...)
- cmdArgs = append(cmdArgs, vuln.DefaultRepositoryArgs()...)
+ cmdArgs = append(cmdArgs, vuln.ScanSourceArgs(serverURL)...)
+ cmdArgs = append(cmdArgs, vuln.IgnoreUnfixedArgs(s.getTrivyIgnoreUnfixed())...)
var tempFiles []string
if strings.TrimSpace(configContent) != "" {
@@ -3289,6 +3318,9 @@ func (s *VulnerabilityService) runTrivyScan(ctx context.Context, trivyImage stri
if len(registryConfigJSON) > 0 {
env = append(env, "DOCKER_CONFIG="+trivyRegistryConfigDir)
}
+ if _, serverToken := s.getTrivyServerConfig(); serverToken != "" {
+ env = append(env, vuln.ServerTokenEnv(serverToken)...)
+ }
config := vuln.BuildContainerConfig(trivyImage, cmdArgs, env)
resources, cpuSet, applyLimits := s.getTrivyContainerResourceOptionsInternal(ctx, dockerClient)
diff --git a/backend/pkg/libarcane/vuln/trivy.go b/backend/pkg/libarcane/vuln/trivy.go
index 787508d1a..2be709bfc 100644
--- a/backend/pkg/libarcane/vuln/trivy.go
+++ b/backend/pkg/libarcane/vuln/trivy.go
@@ -148,6 +148,43 @@ func DefaultRepositoryArgs() []string {
}
}
+// ScanSourceArgs returns the Trivy flags selecting where vulnerability data comes
+// from. In client/server mode (serverURL set) the client never opens the local
+// BoltDB, so --server replaces the cache-backend and DB-repository flags. This is
+// the supported path on 32-bit hosts (arm/v7) where the local DB cannot be
+// 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 {
+ serverURL = strings.TrimSpace(serverURL)
+ if serverURL == "" {
+ return append(ScanCacheBackendArgs(), DefaultRepositoryArgs()...)
+ }
+
+ return []string{"--server", serverURL}
+}
+
+// ServerTokenEnv returns the TRIVY_TOKEN environment entry for a non-empty Trivy
+// server token. Passing the token through the environment instead of a --token CLI
+// flag keeps it out of the container's process arguments (/proc/<pid>/cmdline, ps).
+func ServerTokenEnv(token string) []string {
+ token = strings.TrimSpace(token)
+ if token == "" {
+ return nil
+ }
+
+ return []string{"TRIVY_TOKEN=" + token}
+}
+
+// IgnoreUnfixedArgs returns --ignore-unfixed when enabled so Trivy only reports
+// vulnerabilities that have a known fix.
+func IgnoreUnfixedArgs(enabled bool) []string {
+ if enabled {
+ return []string{"--ignore-unfixed"}
+ }
+ return nil
+}
+
// BuildDockerConfigJSON encodes registry auth configs into a docker config.json
// payload (base64 user:password under each host). It returns (nil, nil) when there
// are no usable credentials.
diff --git a/backend/pkg/libarcane/vuln/trivy_test.go b/backend/pkg/libarcane/vuln/trivy_test.go
index b0739a6a7..57ef920f0 100644
--- a/backend/pkg/libarcane/vuln/trivy_test.go
+++ b/backend/pkg/libarcane/vuln/trivy_test.go
@@ -122,6 +122,41 @@ func TestDefaultRepositoryArgs(t *testing.T) {
require.Contains(t, args, DefaultChecksBundleRepository)
}
+func TestScanSourceArgs(t *testing.T) {
+ t.Run("standalone uses local db repositories", func(t *testing.T) {
+ 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(" ")
+ 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 ")
+ 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")
+ })
+}
+
+func TestServerTokenEnv(t *testing.T) {
+ require.Nil(t, ServerTokenEnv(""))
+ require.Nil(t, ServerTokenEnv(" "))
+ require.Equal(t, []string{"TRIVY_TOKEN=secret"}, ServerTokenEnv(" secret "))
+}
+
+func TestIgnoreUnfixedArgs(t *testing.T) {
+ require.Equal(t, []string{"--ignore-unfixed"}, IgnoreUnfixedArgs(true))
+ require.Nil(t, IgnoreUnfixedArgs(false))
+}
+
func TestBuildContainerConfig_IncludesEnv(t *testing.T) {
config := BuildContainerConfig(
"ghcr.io/getarcaneapp/tools:latest",
diff --git a/frontend/messages/en.json b/frontend/messages/en.json
index 30452e7fc..0275766e8 100644
--- a/frontend/messages/en.json
+++ b/frontend/messages/en.json
@@ -1498,6 +1498,17 @@
"security_trivy_concurrent_scan_containers_label": "Concurrent Scan Containers",
"security_trivy_concurrent_scan_containers_help": "Maximum number of Trivy scan containers that can run at the same time across manual and scheduled scans.",
"security_trivy_concurrent_scan_containers_min": "Must be at least 1",
+ "security_trivy_ignore_unfixed_label": "Only Report Fixable Vulnerabilities",
+ "security_trivy_ignore_unfixed_description": "Only report vulnerabilities that have a known fix available. Reduces noise from vulnerabilities you cannot act on.",
+ "security_trivy_server_enabled_label": "Use Remote Trivy Server",
+ "security_trivy_server_enabled_description": "Scan against a remote Trivy server instead of downloading the vulnerability database locally. Recommended for 32-bit hosts (arm/v7) where the local database cannot be loaded.",
+ "security_trivy_server_url_label": "Trivy Server URL",
+ "security_trivy_server_url_description": "Address of the remote Trivy server to scan against.",
+ "security_trivy_server_url_placeholder": "http://trivy.example.com:4954",
+ "security_trivy_server_url_required": "Server URL is required when client/server mode is enabled.",
+ "security_trivy_server_token_label": "Trivy Server Token",
+ "security_trivy_server_token_description": "Optional authentication token sent to the remote Trivy server. Leave empty if the server requires no token.",
+ "security_trivy_server_note": "In client/server mode, scan containers must be able to reach the server URL. The Trivy Network setting above controls their network.",
"security_enable_one_provider": "Enable at least one authentication provider.",
"security_enable_one_provider_error": "At least one authentication provider must be enabled.",
"security_form_validation_error": "Please check the form for errors.",
diff --git a/frontend/src/lib/components/settings/trivy-security-settings.svelte b/frontend/src/lib/components/settings/trivy-security-settings.svelte
index 99d64d56d..4cbcef52e 100644
--- a/frontend/src/lib/components/settings/trivy-security-settings.svelte
+++ b/frontend/src/lib/components/settings/trivy-security-settings.svelte
@@ -23,6 +23,10 @@
trivyCpuLimit: number;
trivyMemoryLimitMb: number;
trivyConcurrentScanContainers: number;
+ trivyServerEnabled: boolean;
+ trivyServerUrl: string;
+ trivyServerToken: string;
+ trivyIgnoreUnfixed: boolean;
};
type FormField<T> = {
@@ -166,6 +170,14 @@
/>
</div>
+ <SettingsRow
+ label={m.security_trivy_ignore_unfixed_label()}
+ description={m.security_trivy_ignore_unfixed_description()}
+ layout="inline"
+ >
+ <Switch id="trivyIgnoreUnfixedSwitch" bind:checked={$formInputs.trivyIgnoreUnfixed.value} />
+ </SettingsRow>
+
<SettingsRow
label={m.security_trivy_network_label()}
description={m.security_trivy_network_description()}
@@ -189,6 +201,41 @@
{/if}
</SettingsRow>
+ <div class="space-y-4">
+ <SettingsRow
+ label={m.security_trivy_server_enabled_label()}
+ description={m.security_trivy_server_enabled_description()}
+ layout="inline"
+ >
+ <Switch id="trivyServerEnabledSwitch" bind:checked={$formInputs.trivyServerEnabled.value} />
+ </SettingsRow>
+ {#if $formInputs.trivyServerEnabled.value}
+ <div class="border-border/60 space-y-4 border-l-2 pl-5">
+ <TextInputWithLabel
+ bind:value={$formInputs.trivyServerUrl.value}
+ error={$formInputs.trivyServerUrl.error}
+ label={m.security_trivy_server_url_label()}
+ description={m.security_trivy_server_url_description()}
+ placeholder={m.security_trivy_server_url_placeholder()}
+ type="url"
+ />
+ <TextInputWithLabel
+ bind:value={$formInputs.trivyServerToken.value}
+ error={$formInputs.trivyServerToken.error}
+ label={m.security_trivy_server_token_label()}
+ description={m.security_trivy_server_token_description()}
+ type="password"
+ />
+ <Alert.Root variant="default" class="border-amber-200 bg-amber-50 dark:border-amber-800 dark:bg-amber-950">
+ <InfoIcon class="h-4 w-4 text-amber-900 dark:text-amber-100" />
+ <Alert.Description class="text-amber-800 dark:text-amber-200">
+ {m.security_trivy_server_note()}
+ </Alert.Description>
+ </Alert.Root>
+ </div>
+ {/if}
+ </div>
+
<SettingsRow
label={m.security_trivy_security_opts_label()}
description={m.security_trivy_security_opts_description()}
diff --git a/frontend/src/lib/types/settings.ts b/frontend/src/lib/types/settings.ts
index 1b9126895..78497beb1 100644
--- a/frontend/src/lib/types/settings.ts
+++ b/frontend/src/lib/types/settings.ts
@@ -73,6 +73,10 @@ export type Settings = {
trivyCpuLimit: number;
trivyMemoryLimitMb: number;
trivyConcurrentScanContainers: number;
+ trivyServerEnabled: boolean;
+ trivyServerUrl: string;
+ trivyServerToken: string;
+ trivyIgnoreUnfixed: boolean;
oidcEnabled: boolean;
oidcClientId: string;
oidcClientSecret?: string;
diff --git a/frontend/src/routes/(app)/environments/[id]/+page.svelte b/frontend/src/routes/(app)/environments/[id]/+page.svelte
index 70716b17b..75d06cc9e 100644
--- a/frontend/src/routes/(app)/environments/[id]/+page.svelte
+++ b/frontend/src/routes/(app)/environments/[id]/+page.svelte
@@ -248,6 +248,10 @@
trivyCpuLimit: settings?.trivyCpuLimit ?? 1,
trivyMemoryLimitMb: settings?.trivyMemoryLimitMb ?? 0,
trivyConcurrentScanContainers: settings?.trivyConcurrentScanContainers ?? 1,
+ trivyServerEnabled: settings?.trivyServerEnabled ?? false,
+ trivyServerUrl: settings?.trivyServerUrl || '',
+ trivyServerToken: settings?.trivyServerToken || '',
+ trivyIgnoreUnfixed: settings?.trivyIgnoreUnfixed ?? true,
autoUpdateExcludedContainers: settings?.autoUpdateExcludedContainers || '',
autoHealEnabled: settings?.autoHealEnabled ?? false,
autoHealExcludedContainers: settings?.autoHealExcludedContainers || '',
@@ -302,6 +306,10 @@
trivyCpuLimit: formData.trivyResourceLimitsEnabled ? formData.trivyCpuLimit : 0,
trivyMemoryLimitMb: formData.trivyResourceLimitsEnabled ? formData.trivyMemoryLimitMb : 0,
trivyConcurrentScanContainers: formData.trivyConcurrentScanContainers,
+ trivyServerEnabled: formData.trivyServerEnabled,
+ trivyServerUrl: formData.trivyServerUrl,
+ trivyServerToken: formData.trivyServerToken,
+ trivyIgnoreUnfixed: formData.trivyIgnoreUnfixed,
autoUpdateExcludedContainers: formData.autoUpdateExcludedContainers,
autoHealEnabled: formData.autoHealEnabled,
autoHealExcludedContainers: formData.autoHealExcludedContainers,
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.ts
index dde8abb52..bf701bce1 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
@@ -1,50 +1,64 @@
import { z } from 'zod/v4';
import { m } from '$lib/paraglide/messages';
-export const environmentFormSchema = z.object({
- name: z.string().min(1),
- enabled: z.boolean(),
- apiUrl: z.string(),
- pollingEnabled: z.boolean(),
- autoUpdate: z.boolean(),
- autoInjectEnv: z.boolean(),
- followProjectSymlinks: z.boolean(),
- defaultDeployPullPolicy: z.enum(['missing', 'always', 'never']),
- defaultShell: z.string(),
- projectsDirectory: z.string(),
- templatesDirectory: z.string(),
- swarmStackSourcesDirectory: z.string(),
- diskUsagePath: z.string(),
- maxImageUploadSize: z.coerce.number(),
- gitSyncMaxFiles: z.coerce.number().int().nonnegative(),
- gitSyncMaxTotalSizeMb: z.coerce.number().int().nonnegative(),
- gitSyncMaxBinarySizeMb: z.coerce.number().int().nonnegative(),
- baseServerUrl: z.string(),
- scheduledPruneEnabled: z.boolean(),
- pruneContainerMode: z.enum(['none', 'stopped', 'olderThan']),
- pruneContainerUntil: z.string(),
- pruneImageMode: z.enum(['none', 'dangling', 'all', 'olderThan']),
- pruneImageUntil: z.string(),
- pruneVolumeMode: z.enum(['none', 'anonymous', 'all']),
- pruneNetworkMode: z.enum(['none', 'unused', 'olderThan']),
- pruneNetworkUntil: z.string(),
- pruneBuildCacheMode: z.enum(['none', 'unused', 'all', 'olderThan']),
- pruneBuildCacheUntil: z.string(),
- vulnerabilityScanEnabled: z.boolean(),
- trivyImage: z.string(),
- trivyNetwork: z.string(),
- trivySecurityOpts: z.string(),
- trivyPrivileged: z.boolean(),
- trivyPreserveCacheOnVolumePrune: z.boolean(),
- trivyResourceLimitsEnabled: z.boolean(),
- trivyCpuLimit: z.coerce.number().int(m.security_session_timeout_integer()).nonnegative(),
- trivyMemoryLimitMb: z.coerce.number().int().nonnegative(),
- trivyConcurrentScanContainers: z.coerce.number().int().min(1, m.security_trivy_concurrent_scan_containers_min()),
- autoUpdateExcludedContainers: z.string().optional(),
- autoHealEnabled: z.boolean(),
- autoHealExcludedContainers: z.string(),
- autoHealMaxRestarts: z.coerce.number().int().min(1),
- autoHealRestartWindow: z.coerce.number().int().min(1)
-});
+export const environmentFormSchema = z
+ .object({
+ name: z.string().min(1),
+ enabled: z.boolean(),
+ apiUrl: z.string(),
+ pollingEnabled: z.boolean(),
+ autoUpdate: z.boolean(),
+ autoInjectEnv: z.boolean(),
+ followProjectSymlinks: z.boolean(),
+ defaultDeployPullPolicy: z.enum(['missing', 'always', 'never']),
+ defaultShell: z.string(),
+ projectsDirectory: z.string(),
+ templatesDirectory: z.string(),
+ swarmStackSourcesDirectory: z.string(),
+ diskUsagePath: z.string(),
+ maxImageUploadSize: z.coerce.number(),
+ gitSyncMaxFiles: z.coerce.number().int().nonnegative(),
+ gitSyncMaxTotalSizeMb: z.coerce.number().int().nonnegative(),
+ gitSyncMaxBinarySizeMb: z.coerce.number().int().nonnegative(),
+ baseServerUrl: z.string(),
+ scheduledPruneEnabled: z.boolean(),
+ pruneContainerMode: z.enum(['none', 'stopped', 'olderThan']),
+ pruneContainerUntil: z.string(),
+ pruneImageMode: z.enum(['none', 'dangling', 'all', 'olderThan']),
+ pruneImageUntil: z.string(),
+ pruneVolumeMode: z.enum(['none', 'anonymous', 'all']),
+ pruneNetworkMode: z.enum(['none', 'unused', 'olderThan']),
+ pruneNetworkUntil: z.string(),
+ pruneBuildCacheMode: z.enum(['none', 'unused', 'all', 'olderThan']),
+ pruneBuildCacheUntil: z.string(),
+ vulnerabilityScanEnabled: z.boolean(),
+ trivyImage: z.string(),
+ trivyNetwork: z.string(),
+ trivySecurityOpts: z.string(),
+ trivyPrivileged: z.boolean(),
+ trivyPreserveCacheOnVolumePrune: z.boolean(),
+ trivyResourceLimitsEnabled: z.boolean(),
+ trivyCpuLimit: z.coerce.number().int(m.security_session_timeout_integer()).nonnegative(),
+ trivyMemoryLimitMb: z.coerce.number().int().nonnegative(),
+ trivyConcurrentScanContainers: z.coerce.number().int().min(1, m.security_trivy_concurrent_scan_containers_min()),
+ trivyServerEnabled: z.boolean(),
+ trivyServerUrl: z.string(),
+ trivyServerToken: z.string(),
+ trivyIgnoreUnfixed: z.boolean(),
+ autoUpdateExcludedContainers: z.string().optional(),
+ autoHealEnabled: z.boolean(),
+ autoHealExcludedContainers: z.string(),
+ autoHealMaxRestarts: z.coerce.number().int().min(1),
+ autoHealRestartWindow: z.coerce.number().int().min(1)
+ })
+ .superRefine((data, ctx) => {
+ if (data.trivyServerEnabled && !data.trivyServerUrl.trim()) {
+ ctx.addIssue({
+ code: 'custom',
+ message: m.security_trivy_server_url_required(),
+ path: ['trivyServerUrl']
+ });
+ }
+ });
export type EnvironmentFormValues = z.infer<typeof environmentFormSchema>;
diff --git a/types/settings/settings.go b/types/settings/settings.go
index 5d7d9549d..cb6d66fb4 100644
--- a/types/settings/settings.go
+++ b/types/settings/settings.go
@@ -307,6 +307,27 @@ type Update struct {
// Required: false
TrivyConcurrentScanContainers *string `json:"trivyConcurrentScanContainers,omitempty"`
+ // TrivyServerEnabled enables Trivy client/server mode, scanning against a remote
+ // Trivy server instead of opening a local vulnerability database.
+ //
+ // Required: false
+ TrivyServerEnabled *string `json:"trivyServerEnabled,omitempty"`
+
+ // TrivyServerUrl is the URL of the remote Trivy server used in client/server mode.
+ //
+ // Required: false
+ TrivyServerUrl *string `json:"trivyServerUrl,omitempty"`
+
+ // TrivyServerToken is the optional authentication token sent to the remote Trivy server.
+ //
+ // Required: false
+ TrivyServerToken *string `json:"trivyServerToken,omitempty"`
+
+ // TrivyIgnoreUnfixed restricts scan results to vulnerabilities that have a known fix.
+ //
+ // Required: false
+ TrivyIgnoreUnfixed *string `json:"trivyIgnoreUnfixed,omitempty"`
+
// OidcClientId is the OIDC client identifier.
//
// Required: false