Documentation
¶
Index ¶
- Constants
- func ValidateFile(path string) error
- type AIConfig
- type APIConfig
- type APIDocsConfig
- type AttestationConfig
- type AuditConfig
- type AuthConfig
- type BackupConfig
- type BlobDeletionConfig
- type BootstrapConfig
- type Config
- type DocsConfig
- type ExploitConfig
- type FederationConfig
- type GPGConfig
- type GrypeScanner
- type LoggerConfig
- type MCPConfig
- type OSVMirrorConfig
- type ProjectsConfig
- type QuayAPIConfig
- type RecoveryConfig
- type RecoveryJournalConfig
- type ScannersConfig
- type ServerConfig
- type TieringConfig
- type TrashConfig
- type TrivyScanner
- type WorkersConfig
Constants ¶
const ( // RoleAll serves HTTP and runs every background worker: the single-process // deployment, and the default. RoleAll = "all" // RoleWeb serves HTTP and starts no background worker or scheduler; what // the workers would do for a request is queued in the database for a // RoleWorker (or RoleAll) process. RoleWeb = "web" // RoleWorker runs the background workers and serves only /health, /ready // and /metrics. RoleWorker = "worker" )
The process roles of server.role (OPENARTIFACT_ROLE).
const ( // InstallNone leaves the binary to the operator (PATH or the configured path). InstallNone = "none" // InstallAuto downloads the pinned release into the cache directory when // the binary is neither configured nor on PATH. InstallAuto = "auto" )
Install modes of a scanner binary.
const DefaultScannerDownloadBaseURL = "https://github.com"
DefaultScannerDownloadBaseURL serves the pinned scanner release archives.
Variables ¶
This section is empty.
Functions ¶
func ValidateFile ¶
ValidateFile validates a config file without loading it into the application.
Types ¶
type AIConfig ¶
type AIConfig struct {
// Enabled turns AI-assisted artifact analysis on (metadata tagging,
// license check, security notes).
Enabled bool `yaml:"enabled"`
// AutoAnalyze analyses every upload without being asked. Off: analyses
// start only on request (UI, API or MCP). Needs enabled.
AutoAnalyze bool `yaml:"autoAnalyze"`
// Provider is the LLM backend: openai, azure, ollama or custom (any
// OpenAI-compatible endpoint; needs baseUrl).
Provider string `yaml:"provider"`
// BaseURL overrides the API base URL (Azure OpenAI, Ollama or a custom
// endpoint).
BaseURL string `yaml:"baseUrl"`
// APIKey authenticates to the provider; required for openai and azure,
// leave it empty for a local ollama.
APIKey string `yaml:"apiKey"`
// Model is the model to use, for example gpt-4o-mini or llama3; it must be
// available on the configured provider.
Model string `yaml:"model"`
// MaxTokens caps the completion tokens of one analysis request.
MaxTokens int `yaml:"maxTokens"`
// TimeoutSecs is the HTTP timeout of an AI API call, in seconds.
TimeoutSecs int `yaml:"timeoutSecs"`
// SystemPrompt overrides the built-in system prompt; empty uses it.
SystemPrompt string `yaml:"systemPrompt"`
}
AIConfig contains AI analysis configuration.
type APIConfig ¶ added in v0.11.0
type APIConfig struct {
// Docs configures the interactive API reference.
Docs APIDocsConfig `yaml:"docs"`
}
APIConfig configures the REST API surface that is not the API itself.
type APIDocsConfig ¶ added in v0.11.0
type APIDocsConfig struct {
// Enabled serves the interactive API reference at /api/reference (the old
// /swagger paths redirect to it) and links it from the About dialog. When
// false both answer 404. The OpenAPI spec at /api/v1/openapi.json and
// /api/v1/openapi.yaml is always served: the web client and tooling use it.
Enabled bool `yaml:"enabled"`
}
APIDocsConfig configures the interactive API reference served at /api/reference.
type AttestationConfig ¶ added in v0.8.0
type AttestationConfig struct {
// KeyPath is an unencrypted PKCS#8 or SEC1 PEM private key (ECDSA or Ed25519).
// Empty: a P-256 key is generated on first use and stored encrypted in the
// database; that needs OPENARTIFACT_SECRET_KEY (without it no key is generated).
KeyPath string `yaml:"keyPath"`
}
AttestationConfig configures the signing key of SBOM and VEX attestations.
type AuditConfig ¶ added in v0.10.0
type AuditConfig struct {
// RetentionDays is how many days audit entries are kept before the
// retention worker deletes them in batches. 0 keeps them forever (the
// default): export them with `oa audit export` before enabling a limit.
RetentionDays int `yaml:"retentionDays"`
// PurgeInterval is the pause between retention passes. Only used when
// RetentionDays is positive.
PurgeInterval time.Duration `yaml:"purgeInterval"`
// PurgeBatchSize is how many entries one delete statement removes; a pass
// repeats it, paced, until nothing older than the retention is left.
PurgeBatchSize int `yaml:"purgeBatchSize"`
}
AuditConfig tunes the retention of the audit log (see docs/operations/audit-retention.md).
type AuthConfig ¶
type AuthConfig struct {
// AllowAnonymousRead lets anonymous clients read private repositories (via
// the "anonymous-read" permission target). Repositories flagged public are
// always anonymously readable, never writable, whatever this says.
AllowAnonymousRead bool `yaml:"allowAnonymousRead"`
// LegacyAPIKeyEnabled accepts the deprecated server.apiKey on write
// endpoints.
LegacyAPIKeyEnabled bool `yaml:"legacyApiKeyEnabled"`
// SessionDurationHours is the lifetime of a web session, in hours.
SessionDurationHours int `yaml:"sessionDurationHours"`
// HMACKey signs OIDC and SAML login state. Unset: a random key is
// generated once and persisted in system_settings (shared by replicas); a
// configured value wins.
HMACKey string `yaml:"hmacKey"`
// SAMLSPCertPEM is the PEM certificate of the SAML service provider. Unset:
// a self-signed pair is generated once and persisted encrypted in
// system_settings (shared by replicas); regenerating it means
// re-registering the certificate at the identity provider.
SAMLSPCertPEM string `yaml:"samlSpCert"`
// SAMLSPKeyPEM is the PEM private key of the SAML service provider. Unset
// together with the certificate: a self-signed pair is generated (see
// samlSpCert). Stored unencrypted while OPENARTIFACT_SECRET_KEY is unset.
SAMLSPKeyPEM string `yaml:"samlSpKey"`
// Argon2MaxConcurrent caps the password hashes and verifications running at
// once, each of which holds 64 MiB until it ends; further logins wait. 0
// (default): the CPU count clamped to 2..4 (256 MiB at most).
Argon2MaxConcurrent int `yaml:"argon2MaxConcurrent"`
// OIDCServiceAccountTokenFile is the projected Kubernetes service account
// token OpenArtifact presents as bearer when a CI OIDC trust policy with the
// serviceaccount discovery mode reads its issuer. It is read for every
// request (the kubelet rotates it).
OIDCServiceAccountTokenFile string `yaml:"oidcServiceAccountTokenFile"`
// OIDCServiceAccountCAFile is the PEM CA bundle, in addition to the system
// roots, trusted for that read (the cluster CA of the API server).
OIDCServiceAccountCAFile string `yaml:"oidcServiceAccountCaFile"`
}
type BackupConfig ¶
type BackupConfig struct {
// BackupDir is the directory backup files are written to.
BackupDir string `yaml:"backupDir"`
// LeaseTTL is how long a running backup's hold on deleted blob bytes
// survives without a heartbeat. A running backup renews it every third of
// this; a crashed backup stops holding deletions back once it expires.
LeaseTTL time.Duration `yaml:"leaseTtl"`
}
BackupConfig contains backup configuration.
type BlobDeletionConfig ¶ added in v0.7.0
type BlobDeletionConfig struct {
// Grace is how long the bytes of a deleted blob are kept before they may be
// removed. During it a re-upload of the same content reuses them. Zero
// removes them as soon as no running backup needs them.
Grace time.Duration `yaml:"grace"`
// SweepInterval is the pause between sweeper passes. Zero or negative
// disables the schedule (the queue then only grows).
SweepInterval time.Duration `yaml:"sweepInterval"`
// SweepBatch is how many queued deletions a sweeper claims at a time.
SweepBatch int `yaml:"sweepBatch"`
}
BlobDeletionConfig tunes the deferred deletion of blob bytes (see docs/operations/storage.md). Deleting a blob (or retiring a tier copy) removes its database row at once but queues its bytes, which a sweeper removes after the grace period and once no running backup can still need them; storage is freed then, not at the delete.
type BootstrapConfig ¶ added in v0.11.0
type BootstrapConfig struct {
// AdminPasswordFile is a file holding the initial admin password (a
// trailing newline is trimmed). Preferred over AdminPassword.
AdminPasswordFile string `yaml:"adminPasswordFile"`
// AdminPassword is the initial admin password itself (compose
// convenience; AdminPasswordFile wins when both are set).
AdminPassword string `yaml:"adminPassword"`
// ForcePasswordChange forces a password change at the first login of a
// supplied password. A generated password always forces it.
ForcePasswordChange bool `yaml:"forcePasswordChange"`
// AdminTokenFile is a file holding an admin API token secret
// (oa_pat_ followed by 32 to 128 characters from A-Za-z0-9_-), created as
// the access token "bootstrap" of the admin user.
AdminTokenFile string `yaml:"adminTokenFile"`
// AdminTokenTTL is the lifetime of the bootstrap token; 0 means none.
AdminTokenTTL time.Duration `yaml:"adminTokenTtl"`
// GeneratedPasswordTTL is how long a generated (printed) admin password
// stays valid for login; 0 means it never expires.
GeneratedPasswordTTL time.Duration `yaml:"generatedPasswordTtl"`
}
BootstrapConfig controls how the first admin account is provisioned. It only applies to an empty instance: an existing admin is never reset.
type Config ¶
type Config struct {
// Server configures the HTTP listener, TLS, timeouts and request limits.
Server ServerConfig `yaml:"server"`
// Database configures the PostgreSQL connection and its pool.
Database database.DatabaseConfig `yaml:"database"`
// Storage selects and configures the blob store (see
// docs/operations/storage.md). Its replica block adds an asynchronous
// second copy of every blob (see docs/operations/replication.md).
Storage storage.StorageConfig `yaml:"storage"`
// Logger configures the log level, format and destination.
Logger LoggerConfig `yaml:"log"`
// GPG configures the key file that signs APT and RPM metadata and release
// bundle manifests (see docs/security/signing.md).
GPG GPGConfig `yaml:"gpg"`
// Attest configures the signing key of SBOM and VEX attestations (see
// docs/security/sbom.md).
Attest AttestationConfig `yaml:"attestation"`
// Auth configures sessions, anonymous reads and the login-state and SAML
// service provider keys (see docs/security/authentication.md).
Auth AuthConfig `yaml:"auth"`
// Bootstrap configures the first admin account and API token created on an
// empty instance (see docs/getting-started/installation.md).
Bootstrap BootstrapConfig `yaml:"bootstrap"`
// Backup configures where backups are written and how long a running
// backup holds back blob deletions (see docs/operations/backup.md).
Backup BackupConfig `yaml:"backup"`
// AI configures AI-assisted package analysis (see docs/integrations/ai-analysis.md).
AI AIConfig `yaml:"ai"`
// MCP configures the embedded Model Context Protocol server (see docs/integrations/mcp.md).
MCP MCPConfig `yaml:"mcp"`
// Workers tunes the background workers: metadata regeneration, Docker
// registry garbage collection and upload staging, webhook retention.
Workers WorkersConfig `yaml:"workers"`
Trash TrashConfig `yaml:"trash"`
// Audit tunes the retention of the audit log (see docs/operations/audit-retention.md).
Audit AuditConfig `yaml:"audit"`
// Docs configures the links from the web UI to the published documentation.
Docs DocsConfig `yaml:"docs"`
// API configures the REST API explorer (see docs/integrations/api.md).
API APIConfig `yaml:"api"`
// Branding white-labels the UI: product name, logos, favicon, colour, login
// message and support/source links (see docs/operations/branding.md).
// Administrators can override every value at runtime.
Branding branding.Config `yaml:"branding"`
// BlobDeletion tunes the deferred deletion of blob bytes (see
// docs/operations/storage.md).
BlobDeletion BlobDeletionConfig `yaml:"blobDeletion"`
Tiering TieringConfig `yaml:"tiering"`
// Recovery groups the disaster-recovery settings.
Recovery RecoveryConfig `yaml:"recovery"`
Projects ProjectsConfig `yaml:"projects"`
Federation FederationConfig `yaml:"federation"`
// Telemetry configures OpenTelemetry export (off by default), see
// docs/operations/monitoring.md.
Telemetry telemetry.Config `yaml:"telemetry"`
Scanners ScannersConfig `yaml:"scanners"`
// Exploit configures the KEV and EPSS feeds behind the exploitation
// signals of vulnerability findings.
Exploit ExploitConfig `yaml:"exploit"`
// QuayAPI configures the Quay-compatible API facade for the Konflux
// image-controller (see docs/integrations/konflux-image-controller.md).
QuayAPI QuayAPIConfig `yaml:"quayApi"`
// OSVMirror configures the local OSV vulnerability mirror (see docs/security/osv-mirror.md).
OSVMirror OSVMirrorConfig `yaml:"osvMirror"`
// BaseURL is the public URL of the server. SSO callbacks, SAML metadata,
// webhook sources and anything else sent outside a client's own request
// always use it. Package-client URLs (npm tarballs, the Cargo config.json,
// NuGet resources, Composer dists, ...) are derived from the request when
// it is unset (see internal/publicurl) and use it as an override when set.
BaseURL string `yaml:"baseUrl"`
// BaseURLSet reports that the operator configured BaseURL (YAML or env);
// false means BaseURL holds the localhost default.
BaseURLSet bool `yaml:"-"`
// StorageReplica is the optional blob replica: an asynchronous second copy
// of every blob on another backend (see docs/operations/replication.md).
StorageReplica storage.ReplicaConfig `yaml:"-"`
}
func Defaults ¶ added in v0.9.0
func Defaults() *Config
Defaults returns the built-in default configuration, the starting point of Load before the YAML file and the environment are applied.
func Load ¶
Load loads configuration from YAML file (if provided) and environment variables. Precedence: defaults < YAML file < environment variables.
func (*Config) ClientBaseURL ¶ added in v0.15.0
ClientBaseURL is the operator's BASE_URL as an explicit override for the URLs handed to package clients, or "" when it was not set and those URLs are derived from each request (internal/publicurl).
type DocsConfig ¶ added in v0.9.0
type DocsConfig struct {
// BaseURL is the root of the published documentation site; the web UI
// links to the version matching the server (release builds) or to the
// latest docs (development builds). Point it at an internal mirror for
// air-gapped installs; empty hides every documentation link.
BaseURL string `yaml:"baseUrl"`
}
DocsConfig configures the documentation links shown in the web UI.
type ExploitConfig ¶ added in v0.14.0
type ExploitConfig struct {
// Enabled turns the daily import on. Off, findings carry no KEV or EPSS data
// and their priority is their severity.
Enabled bool `yaml:"enabled"`
// KEVURL is the KEV catalog JSON (known_exploited_vulnerabilities.json);
// point it at a mirror in an air-gapped network.
KEVURL string `yaml:"kevUrl"`
// EPSSURL is the EPSS score file (epss_scores-current.csv.gz); a mirror
// serves the same gzip CSV.
EPSSURL string `yaml:"epssUrl"`
// Interval is the pause between imports, at least 1h.
Interval time.Duration `yaml:"interval"`
// EPSSThreshold is the EPSS score (0..1) from which a finding that is not
// in KEV is prioritised above its severity.
EPSSThreshold float64 `yaml:"epssThreshold"`
}
ExploitConfig configures the exploitation signals of vulnerability findings: the daily import of the CISA KEV catalog and the FIRST EPSS scores and the priority derived from them (docs/security/exploit-signals.md).
type FederationConfig ¶ added in v0.9.0
type FederationConfig struct {
// Enabled starts the pull workers and mounts the /federation/v1 peer
// endpoints. Off by default.
Enabled bool `yaml:"enabled"`
// PollInterval is the pause between pulls of one peer that is caught up.
PollInterval time.Duration `yaml:"pollInterval"`
// BatchSize is how many log entries one pull page carries.
BatchSize int `yaml:"batchSize"`
// MaxBackoff caps the retry delay of an unreachable or failing peer.
MaxBackoff time.Duration `yaml:"maxBackoff"`
// RequestTimeout bounds one request to a peer (blob transfers are bounded
// by it per request, not in total).
RequestTimeout time.Duration `yaml:"requestTimeout"`
// TombstoneRetention is how long the tombstone of a deleted unit is kept
// in the log; a member that stays offline longer must be resynced.
TombstoneRetention time.Duration `yaml:"tombstoneRetention"`
// SpoolDir is where blobs pulled from peers are downloaded to. An
// interrupted download stays there and the next pull resumes it with a
// Range request. Empty uses a directory under the OS temp dir; set it to a
// persistent volume to resume across restarts, and give every instance
// its own.
SpoolDir string `yaml:"spoolDir"`
// MaxPartialBytes caps the total size of the interrupted downloads kept in
// the spool; the least recently written are removed first.
MaxPartialBytes int64 `yaml:"maxPartialBytes"`
// MaxPartialAge removes an interrupted download that was not written to for
// this long.
MaxPartialAge time.Duration `yaml:"maxPartialAge"`
// MaxClockSkew is how far ahead of this instance's clock the stamp of a
// peer's change may be. The change of a peer whose clock runs further ahead
// is set aside and applied once the local clock catches up, instead of moving
// the repository's logical clock to that time for good.
MaxClockSkew time.Duration `yaml:"maxClockSkew"`
}
FederationConfig tunes federated repositories (see docs/operations/federation.md). Repositories are federated individually through the admin API; this only switches the pull workers and the peer endpoints on and tunes them.
type GPGConfig ¶
type GPGConfig struct {
// Enabled loads the file key at keyPath. Keys managed through the admin
// API sign regardless.
Enabled bool `yaml:"enabled"`
// KeyPath is the private key file (the read-only fallback key).
KeyPath string `yaml:"keyPath"`
// Passphrase unlocks the key at keyPath.
Passphrase string `yaml:"passphrase"`
// AutoGenerate generates an RSA-4096 global signing key at startup when
// no key exists yet. It needs OPENARTIFACT_SECRET_KEY and is replica-safe.
AutoGenerate bool `yaml:"autoGenerate"`
// BundleSigners lets users other than administrators seal release bundles
// with a stored key: each entry is "<key id or fingerprint>=<username>".
// Administrators (global manage) may use any stored key; the key at
// keyPath never signs bundles (see docs/security/signing.md).
BundleSigners []string `yaml:"bundleSigners"`
}
type GrypeScanner ¶ added in v0.7.0
type GrypeScanner struct {
// Path is the binary: a command name looked up on PATH, or an absolute
// path. Empty means "grype".
Path string `yaml:"path"`
// Install is "none" (default) or "auto": download the pinned grype release
// into the cache directory when path is empty and grype is not on PATH.
Install string `yaml:"install"`
// DBURL is the database listing URL of a mirror (GRYPE_DB_UPDATE_URL).
// Empty is the upstream default.
DBURL string `yaml:"dbUrl"`
}
GrypeScanner configures the grype binary and its database source.
type LoggerConfig ¶
type LoggerConfig struct {
// Level is the minimum severity logged: debug, info, warn or error.
// Unknown values fall back to info.
Level string `yaml:"level"`
// Format is json or text; any other value gives console text.
Format string `yaml:"format"`
// OutputPath is stdout, stderr or a file path (appended to).
OutputPath string `yaml:"output"`
}
LoggerConfig contains logging configuration.
type MCPConfig ¶
type MCPConfig struct {
// Enabled mounts the MCP server on the main HTTP listener.
Enabled bool `yaml:"enabled"`
// Transport must be http (the only supported transport; stdio is
// rejected). The endpoint requires an "Authorization: Bearer" token.
Transport string `yaml:"transport"`
// HTTPPath is the mount path of the HTTP endpoint.
HTTPPath string `yaml:"httpPath"`
// AllowedOrigins are the browser origins (scheme://host[:port]) accepted in
// the Origin header of MCP requests, besides the origin of baseUrl. A request
// with any other Origin is refused with 403; requests without an Origin
// header (non-browser clients) are unaffected.
AllowedOrigins []string `yaml:"allowedOrigins"`
// MaxBodyBytes caps one MCP request body (default 1 MiB).
MaxBodyBytes int64 `yaml:"maxBodyBytes"`
// RateLimitPerMinute caps MCP requests per authenticated principal per
// minute (default 600; 0 disables the limit).
RateLimitPerMinute int `yaml:"rateLimitPerMinute"`
// AITriggerPerMinute caps trigger_ai_analysis calls per principal per
// minute, since each one can cost an LLM call (default 10; 0 disables).
AITriggerPerMinute int `yaml:"aiTriggerPerMinute"`
}
MCPConfig contains MCP server configuration.
type OSVMirrorConfig ¶ added in v0.14.0
type OSVMirrorConfig struct {
// Enabled turns the mirror, its worker and the local matching on. Off by
// default: the osv scanner then queries api.osv.dev.
Enabled bool `yaml:"enabled"`
// BaseURL is where the exports are fetched from ("<baseUrl>/<Ecosystem>/all.zip").
// Point it at an internal mirror of the OSV bucket for air-gapped installs;
// the host may be on a private network. http or https, no credentials.
BaseURL string `yaml:"baseUrl"`
// Ecosystems are the OSV ecosystems to mirror. The supported ones are
// listed in docs/security/osv-mirror.md; the others keep using api.osv.dev.
Ecosystems []string `yaml:"ecosystems"`
// Interval is the pause between imports, at least 1h.
Interval time.Duration `yaml:"interval"`
// TempDir holds the downloaded archive while it is imported (absolute).
// Empty means the system temporary directory.
TempDir string `yaml:"tempDir"`
// MaxArchiveBytes caps the size of one downloaded archive.
MaxArchiveBytes int64 `yaml:"maxArchiveBytes"`
}
OSVMirrorConfig configures the local OSV mirror (see docs/security/osv-mirror.md): a background worker imports the OSV export of each ecosystem into the database, the osv scanner matches against it, and every import re-matches the stored packages. OSV data is licensed CC-BY 4.0 (https://osv.dev).
type ProjectsConfig ¶ added in v0.6.0
type ProjectsConfig struct {
// SelfCreate lets any authenticated human user create a project and become
// its owner. Off by default: only global admins create projects. An
// administrator can change it at runtime (system setting projects.self_create),
// which then takes precedence over this default.
SelfCreate bool `yaml:"selfCreate"`
}
ProjectsConfig tunes project self-service (see docs/security/projects.md).
type QuayAPIConfig ¶ added in v0.21.0
type QuayAPIConfig struct {
// Enabled mounts the facade at /quay/api/v1. Off by default: it hands out
// registry credentials to a token with global manage permission.
Enabled bool `yaml:"enabled"`
// Organizations lists the hosted docker repositories a Quay client may use
// as its organization. Empty allows every hosted docker repository.
Organizations []string `yaml:"organizations"`
}
QuayAPIConfig configures the Quay-compatible API facade (docs/integrations/konflux-image-controller.md): the Konflux image-controller onboards components through it as if OpenArtifact were a Quay registry.
type RecoveryConfig ¶ added in v0.9.0
type RecoveryConfig struct {
Journal RecoveryJournalConfig `yaml:"journal"`
}
RecoveryConfig groups the disaster-recovery settings.
type RecoveryJournalConfig ¶ added in v0.9.0
type RecoveryJournalConfig struct {
// Enabled switches the journal on: the database triggers mark changed rows
// and the worker writes their sidecar blobs. Off, nothing is captured and
// `openartifact rebuild` cannot restore rows created while it was off.
Enabled bool `yaml:"enabled"`
// Interval is the pause between worker passes that drain the dirty queue.
Interval time.Duration `yaml:"interval"`
// Batch is how many dirty rows one drain step claims.
Batch int `yaml:"batch"`
// Concurrency is how many sidecar blobs are written or deleted at once.
Concurrency int `yaml:"concurrency"`
// ReconcileInterval is how often every journaled table is re-checked for
// rows without a sidecar (backfill) and sidecars without a row. Zero
// disables periodic reconciles after the first complete one.
ReconcileInterval time.Duration `yaml:"reconcileInterval"`
}
RecoveryJournalConfig tunes the row journal that mirrors package metadata as sidecar blobs in the blob store (see docs/operations/rebuild-from-storage.md).
type ScannersConfig ¶ added in v0.7.0
type ScannersConfig struct {
// CacheDir is where the scanners keep their vulnerability databases
// (<cacheDir>/trivy, <cacheDir>/grype). It must be writable unless offline
// is set. Empty means a directory under the user cache dir; the container
// image sets /var/cache/openartifact/scanners.
CacheDir string `yaml:"cacheDir"`
// UpdateInterval is the pause between database refreshes. 0 downloads only
// when the server starts and never again; otherwise at least 1h.
UpdateInterval time.Duration `yaml:"updateInterval"`
// Offline stops the server from downloading databases: scans use what
// cacheDir already holds and fail while it holds none.
Offline bool `yaml:"offline"`
// DownloadBaseURL is the https origin the pinned release archives are
// downloaded from when a scanner's install mode is "auto". A mirror must
// serve GitHub's release paths (/<owner>/<repo>/releases/download/<tag>/<file>).
DownloadBaseURL string `yaml:"downloadBaseUrl"`
Trivy TrivyScanner `yaml:"trivy"`
Grype GrypeScanner `yaml:"grype"`
}
ScannersConfig configures the external vulnerability scanners (trivy, grype) used by on-demand scans (see docs/security/scanner-setup.md). OSV needs none of it.
func (ScannersConfig) VulnOptions ¶ added in v0.7.0
func (s ScannersConfig) VulnOptions() vuln.Options
VulnOptions converts the settings to the scanner subsystem's options.
type ServerConfig ¶
type ServerConfig struct {
// Host is the listen address.
Host string `yaml:"host"`
// Port is the listen port.
Port int `yaml:"port"`
// Role selects what this process does: "all" (the default) serves HTTP and
// runs every background worker; "web" only serves HTTP, handing metadata
// regeneration, scans and the like to a "worker" process through the
// database; "worker" runs the background workers and serves only /health,
// /ready and /metrics. See docs/operations/scaling.md.
Role string `yaml:"role"`
// ReadTimeout bounds an entire request (headers + body), in seconds. 0
// (the default) means no limit so large artifact uploads are never
// truncated; slowloris protection instead comes from readHeaderTimeout.
ReadTimeout int `yaml:"readTimeout"`
// WriteTimeout bounds writing the response, in seconds. 0 (the default)
// means no limit: large artifact downloads and streams rely on per-handler
// deadlines instead of one server-wide cutoff.
WriteTimeout int `yaml:"writeTimeout"`
// ReadHeaderTimeout bounds only the time to read request headers, in
// seconds. It stays short regardless of readTimeout to still mitigate
// slowloris-style attacks even when body reads are unbounded.
ReadHeaderTimeout int `yaml:"readHeaderTimeout"`
// IdleTimeout is how many seconds an idle keep-alive connection is kept
// open before the server closes it. 0 disables the limit.
IdleTimeout int `yaml:"idleTimeout"`
// MaxHeaderBytes caps the size of request headers in bytes. 0 uses the Go
// default (1 MiB).
MaxHeaderBytes int `yaml:"maxHeaderBytes"`
// MaxBodyBytes caps the body of every request (http.MaxBytesReader), a
// last line of defence behind the per-handler limits so no endpoint can be
// made to spool or buffer an unbounded body. 0 disables the cap.
MaxBodyBytes int64 `yaml:"maxBodyBytes"`
// ShutdownTimeout is how many seconds in-flight requests get to finish
// during a graceful shutdown. Must be at least 1: 0 would leave them no time.
ShutdownTimeout int `yaml:"shutdownTimeout"`
// ShutdownDelay is how many seconds the server keeps serving, reporting
// not ready on /ready, after a shutdown signal and before it stops
// accepting connections, so load balancers stop routing to it first. A
// second signal skips the delay. 0 disables it.
ShutdownDelay int `yaml:"shutdownDelay"`
// TLSEnabled serves HTTPS and sends HSTS; it requires tlsCert and tlsKey.
TLSEnabled bool `yaml:"tlsEnabled"`
// TLSCert is the path of the PEM certificate file.
TLSCert string `yaml:"tlsCert"`
// TLSKey is the path of the PEM private key file.
TLSKey string `yaml:"tlsKey"`
// APIKey is a deprecated static key accepted on write endpoints while
// auth.legacyApiKeyEnabled is true. It authenticates as
// system/legacy-api-key and logs a warning on each use; empty disables it.
APIKey string `yaml:"apiKey"`
// CORSOrigins lists the browser origins allowed by CORS; none by default.
CORSOrigins []string `yaml:"corsOrigins"`
// InstanceID names this instance in HA deployments; /health reports it
// (omitted when empty, the hostname is never disclosed).
InstanceID string `yaml:"instanceId"`
// IPAllowlist lists the CIDR blocks allowed to connect; empty allows all.
IPAllowlist []string `yaml:"ipAllowlist"`
// RateLimitRPS caps requests per second per client IP; 0 disables the limit.
RateLimitRPS int `yaml:"rateLimitRps"`
// TrustedProxies lists CIDR blocks of reverse proxies allowed to set
// X-Forwarded-For/X-Real-IP. Empty (default) means no proxy is trusted —
// the immediate TCP peer is always used as the client IP,
// so a client can never spoof its own IP via those headers.
TrustedProxies []string `yaml:"trustedProxies"`
// PprofEnabled mounts Go's runtime profiler under /api/v1/admin/pprof/
// (admin "manage" permission required). Off by default: profiles expose
// internals and CPU profiling costs cycles. Sets non-zero mutex and block
// profile rates while enabled.
PprofEnabled bool `yaml:"pprofEnabled"`
}
ServerConfig contains HTTP server configuration.
func (ServerConfig) EffectiveRole ¶ added in v0.15.0
func (s ServerConfig) EffectiveRole() string
EffectiveRole is the role with an empty value read as RoleAll.
func (ServerConfig) RunsWorkers ¶ added in v0.15.0
func (s ServerConfig) RunsWorkers() bool
RunsWorkers reports whether the process runs the background workers and schedulers (roles all and worker).
func (ServerConfig) ServesAPI ¶ added in v0.15.0
func (s ServerConfig) ServesAPI() bool
ServesAPI reports whether the process serves the web UI, the REST API and the package-format routes (roles all and web).
type TieringConfig ¶ added in v0.7.0
type TieringConfig struct {
// Enabled switches the background mover on. Reads from every tier work
// regardless; only the movement of blobs between tiers depends on it.
Enabled bool `yaml:"enabled"`
// Interval is the pause between mover passes. Zero or negative disables the
// schedule; an admin can still start a pass by hand.
Interval time.Duration `yaml:"interval"`
// Batch caps how many blobs one pass moves; the rest wait for the next pass.
Batch int `yaml:"batch"`
// Concurrency is how many blobs are copied at once.
Concurrency int `yaml:"concurrency"`
// MaxBytesPerSecond caps the mover's total copy bandwidth (all concurrent
// copies together). Zero is unlimited.
MaxBytesPerSecond int64 `yaml:"maxBytesPerSecond"`
// VerifyReadback re-reads each copied blob from the target tier and
// compares its sha256 before the placement flips, on top of the size check.
VerifyReadback bool `yaml:"verifyReadback"`
// AccessFlushInterval is how often recorded blob downloads (used by
// "idle for N days" policies and promote-on-read) are written to the database.
AccessFlushInterval time.Duration `yaml:"accessFlushInterval"`
// RefreshInterval is how often each replica reloads the tier list, so a tier
// created on one replica is used by the others.
RefreshInterval time.Duration `yaml:"refreshInterval"`
}
TieringConfig tunes the storage tier mover (see docs/operations/storage-tiering.md). Tiers and policies themselves are managed through the admin API; with no tier besides the primary store configured none of this has any effect.
type TrashConfig ¶ added in v0.5.0
type TrashConfig struct {
// RetentionDays is how many days a deleted artifact, version or
// repository stays restorable before the purge worker removes it for good.
// It applies to repositories without their own trash_retention_days;
// 0 disables the trash (deletes are immediate and permanent).
RetentionDays int `yaml:"retentionDays"`
// PurgeInterval is the pause between purge passes. Zero or negative
// disables the schedule: nothing expires until an admin purges by hand.
PurgeInterval time.Duration `yaml:"purgeInterval"`
}
TrashConfig tunes soft delete (see docs/operations/trash.md).
type TrivyScanner ¶ added in v0.7.0
type TrivyScanner struct {
// Path is the binary: a command name looked up on PATH, or an absolute
// path. Empty means "trivy".
Path string `yaml:"path"`
// Install is "none" (default) or "auto": download the pinned trivy release
// into the cache directory when path is empty and trivy is not on PATH.
Install string `yaml:"install"`
// DBRepository is an OCI repository mirroring ghcr.io/aquasecurity/trivy-db.
// Empty is the upstream default.
DBRepository string `yaml:"dbRepository"`
// JavaDBRepository is an OCI repository mirroring
// ghcr.io/aquasecurity/trivy-java-db. Empty does not download the Java
// database (several hundred MB; only JAR scanning needs it).
JavaDBRepository string `yaml:"javaDbRepository"`
}
TrivyScanner configures the trivy binary and its database sources.
type WorkersConfig ¶ added in v0.4.0
type WorkersConfig struct {
// MetadataRegenConcurrency caps how many metadata regenerations (deb,
// maven, npm, rpm together) run at once. Each pins up to two database
// connections, so keep it well below database.maxOpenConns.
MetadataRegenConcurrency int `yaml:"metadataRegenConcurrency"`
// DockerGCInterval is the pause between scheduled Docker registry garbage
// collection passes (untagged manifests and the blobs only they used).
// Zero or negative disables the schedule; the admin API can still run it.
DockerGCInterval time.Duration `yaml:"dockerGcInterval"`
// DockerGCGracePeriod is how long an untagged manifest, or an unreferenced
// blob, must have been idle before registry GC may delete it. It must
// outlast the slowest push: layers are uploaded before the manifest that
// references them.
DockerGCGracePeriod time.Duration `yaml:"dockerGcGracePeriod"`
// RepoStatsInterval is the pause between passes of the worker that
// recomputes the per-repository figures of the repository list (package
// count, newest publication, security counts) for the repositories that
// changed. The list can lag the data by about this long. It must be
// positive.
RepoStatsInterval time.Duration `yaml:"repoStatsInterval"`
// ProxyDockerDigestTTL is how long a docker proxy keeps a manifest or blob
// addressed by digest after its last pull. Such content never changes, so
// this only bounds the cache's size: the proxy cache worker evicts what has
// not been pulled for this long, and the next pull fetches it again. Zero
// keeps it until an admin purge or the repository's removal.
ProxyDockerDigestTTL time.Duration `yaml:"proxyDockerDigestTtl"`
// ProxyUpstreamStallTimeout is how long a proxy upstream response body may
// deliver no data before the fetch fails and its flight is released. It
// is reset on every read, so slow but steady downloads are unaffected.
// Zero disables the check.
ProxyUpstreamStallTimeout time.Duration `yaml:"proxyUpstreamStallTimeout"`
// ProxyGoSumdbHosts lists the Go checksum databases that Go proxy and group
// repositories relay under /sumdb/<host>/ (the GOPROXY sumdb protocol). A
// request for any other host is 404. Each entry is a bare host name (with
// an optional port); the relay always uses https. Empty turns the relay
// off.
ProxyGoSumdbHosts []string `yaml:"proxyGoSumdbHosts"`
// DockerUploadTTL is how long a blob upload session may sit idle before
// the sweeper deletes it and its data. Zero or negative disables the
// sweeper.
DockerUploadTTL time.Duration `yaml:"dockerUploadTtl"`
// DockerUploadDir is where uploads are kept when the blob store
// cannot hold them (the oci backend); other backends keep them in the
// blob store. Empty means /tmp/openartifact/docker-uploads.
DockerUploadDir string `yaml:"dockerUploadDir"`
// WebhookDeliveryRetentionDays is how many days finished (success or
// failed) webhook delivery records are kept before the hourly purge deletes
// them. 0 keeps them forever. Pending deliveries are never purged.
WebhookDeliveryRetentionDays int `yaml:"webhookDeliveryRetentionDays"`
}
WorkersConfig contains background worker tuning.