models

package
v0.26.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 27, 2026 License: AGPL-3.0 Imports: 9 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	AttestationKindSignature   = "signature"
	AttestationKindAttestation = "attestation"
	AttestationKindSBOM        = "sbom"
)

Attestation kinds of OCIAttestation.Kind.

View Source
const (
	UserKindHuman          = "human"
	UserKindService        = "service"
	UserKindServiceAccount = "service_account"
)

User kinds.

View Source
const (
	// OIDCDiscoveryAnonymous reads the discovery document and the key set
	// without credentials: the default, and what public issuers (GitHub Actions,
	// GitLab, managed Kubernetes) need.
	OIDCDiscoveryAnonymous = "anonymous"
	// OIDCDiscoveryStatic verifies against the key set stored on the policy;
	// nothing is fetched.
	OIDCDiscoveryStatic = "static"
	// OIDCDiscoveryServiceAccount reads the discovery document and the key set
	// with OpenArtifact's own Kubernetes service account token, for clusters
	// whose issuer is not anonymously readable.
	OIDCDiscoveryServiceAccount = "serviceaccount"
)

How the signing keys of the issuer of an OIDCTrustPolicy are found (OIDCDiscovery.Mode).

View Source
const (
	CondaExtTarBz2 = ".tar.bz2"
	CondaExtConda  = ".conda"
)

Conda package file extensions.

View Source
const (
	DTrackPushQueued  = "queued"
	DTrackPushRunning = "running"
	DTrackPushDone    = "done"
	DTrackPushSkipped = "skipped"
	DTrackPushFailed  = "failed"
)

Dependency-Track push states.

View Source
const (
	ExploitFeedKEV  = "kev"
	ExploitFeedEPSS = "epss"
)

Names of the exploitation-signal feeds (exploit_feeds.name).

View Source
const (
	GPGKeySourceImported  = "imported"
	GPGKeySourceGenerated = "generated"
	GPGKeySourceAuto      = "auto"
)

GPG key sources: how a database-managed signing key came to exist.

View Source
const (
	// LicenseSourceArtifact: read from the package file itself.
	LicenseSourceArtifact = "artifact"
	// LicenseSourceClientDeclared: only what a client declared (license
	// properties); the package file declared no license or cannot be read.
	LicenseSourceClientDeclared = "client_declared"
)

Sources of the licenses of a LicenseScanResult.

View Source
const (
	// PacmanSigUploader marks a signature the publisher uploaded.
	PacmanSigUploader = "uploader"
	// PacmanSigServer marks a signature made with the repository signing key.
	PacmanSigServer = "server"
)

Signature sources of a PacmanPackage.

View Source
const (
	ProjectRoleViewer     = "viewer"
	ProjectRoleDeveloper  = "developer"
	ProjectRoleMaintainer = "maintainer"
	ProjectRoleOwner      = "owner"
)

Project member roles, lowest to highest. Groups may hold every role except owner (ownership stays personal).

View Source
const (
	ProjectRepoTypeHosted = "hosted"
	ProjectRepoTypeProxy  = "proxy"
	ProjectRepoTypeGroup  = "group"
)

Repository types a project may allow (Project.AllowedRepoTypes).

View Source
const (
	QuotaScopeRepository = "repository"
	QuotaScopeProject    = "project"
)

Quota scopes of QuotaOverview.

View Source
const (
	FindingVuln    = "vuln"
	FindingLicense = "license"
	FindingSecret  = "secret"
	FindingAI      = "ai"
)

Finding types of the cross-type security findings list.

View Source
const (
	FindingStatusOpen        = "open"
	FindingStatusQuarantined = "quarantined"
	FindingStatusSuppressed  = "suppressed"
)

Finding statuses: quarantined (the result's quarantine flag), suppressed (VEX decisions or an admin approval resolve it) or open.

View Source
const (
	FindingSeverityCritical = "critical"
	FindingSeverityHigh     = "high"
	FindingSeverityMedium   = "medium"
	FindingSeverityLow      = "low"
	FindingSeverityNone     = "none"
)

Severities of a finding, highest first. FindingSeverityNone marks a result that reports something without a severity (an approved license, say).

View Source
const (
	FindingSortSeverity = "severity"
	FindingSortPriority = "priority"
)

The orders of the findings list.

View Source
const (
	OIDCTypeOIDC   = ""
	OIDCTypeGitHub = "github"
	OIDCTypeOAuth2 = "oauth2"
)

OIDC provider flavours (OIDCConfig.Type).

View Source
const (
	TierMoveCopying = "copying"
	TierMoveFlipped = "flipped"
)

Storage tier move states (see storage_tier_moves).

View Source
const (
	TokenListPersonal   = "personal"
	TokenListProject    = "project"
	TokenListFederation = "federation"
)

Token list kinds: a personal access token, a project service token, or a federation peer token of one repository.

View Source
const (
	VEXAffected           = "affected"
	VEXNotAffected        = "not_affected"
	VEXFixed              = "fixed"
	VEXUnderInvestigation = "under_investigation"
)

VEX statuses recorded in VEXStatement.Status (the OpenVEX status labels).

View Source
const (
	VEXComponentNotPresent       = "component_not_present"
	VEXVulnerableCodeNotPresent  = "vulnerable_code_not_present"
	VEXVulnerableCodeNotInExec   = "vulnerable_code_not_in_execute_path"
	VEXVulnerableCodeNotControl  = "vulnerable_code_cannot_be_controlled_by_adversary"
	VEXInlineMitigationsExisting = "inline_mitigations_already_exist"
)

VEX justifications (the OpenVEX enum); required for VEXNotAffected.

View Source
const (
	VEXSourceLocal = "local" // operator decision
	VEXSourceCSAF  = "csaf"  // materialized from a vendor CSAF VEX feed
	VEXSourcePeer  = "peer"  // decision of a federated peer
)

VEX statement sources (VEXStatement.SourceKind).

View Source
const (
	VEXSuggestionPending   = "pending"
	VEXSuggestionAccepted  = "accepted"
	VEXSuggestionDismissed = "dismissed"
)

States of a peer's VEX suggestion (VEXSuggestion.State).

View Source
const (
	VulnSortSeverity = "severity"
	VulnSortPriority = "priority"
)

Sort orders of the scan overview (VulnScanListParams.Sort).

View Source
const (
	PayloadFormatOpenArtifact = "openartifact"
	PayloadFormatCloudEvents  = "cloudevents"
	PayloadFormatSlack        = "slack"
	PayloadFormatTeams        = "teams"
	PayloadFormatDiscord      = "discord"
)

Webhook payload formats (webhooks.payload_format).

View Source
const DefaultCleanupCron = "0 2 * * *"

DefaultCleanupCron is the schedule applied when a policy has none (daily at 02:00 UTC).

View Source
const MaxDetailFiles = 200

MaxDetailFiles bounds the files ComponentDetail lists for one version.

View Source
const MaxProjectSlugLen = 64

MaxProjectSlugLen is the length of projects.slug (varchar(64)).

View Source
const SystemProjectID = "00000000-0000-0000-0000-000000000001"

SystemProjectID is the built-in system project: the "unassigned" project every repository lived in before projects took part in authorization. Its membership grants nothing, whatever its roles say; project-derived access applies to every other project.

Variables

View Source
var ErrInvalidCleanupPolicy = errors.New("invalid cleanup policy")

ErrInvalidCleanupPolicy is wrapped by every CleanupPolicy.Validate error.

Functions

func FindingTypes added in v0.11.0

func FindingTypes() []string

FindingTypes lists every finding type, the default of a findings query.

func ProjectRoleRank added in v0.6.0

func ProjectRoleRank(role string) int

ProjectRoleRank orders the roles (viewer 1 < developer 2 < maintainer 3 < owner 4); 0 for an unknown role.

func ProjectSlug added in v0.6.0

func ProjectSlug(name string) string

ProjectSlug derives a project's slug from its name: lowercased, every run of characters outside [a-z0-9] collapsed to a single '-', leading and trailing '-' trimmed. The result is empty when the name has no letter or digit; callers must also reject slugs longer than MaxProjectSlugLen.

Types

type AIAnalysis

type AIAnalysis struct {
	ID                    string    `json:"id"`
	RepositoryID          string    `json:"repository_id"`
	ArtifactID            string    `json:"artifact_id"`     // generic reference (component ID, npm version ID, etc.)
	ArtifactFormat        string    `json:"artifact_format"` // "deb", "helm", "maven", "npm", "pypi", "rpm", etc.
	ArtifactName          string    `json:"artifact_name"`
	ArtifactVersion       string    `json:"artifact_version"`
	Summary               string    `json:"summary"`
	Tags                  []string  `json:"tags"`           // stored as JSONB
	LicenseStatus         string    `json:"license_status"` // "SAFE", "REVIEW_REQUIRED", "UNKNOWN"
	LicenseName           string    `json:"license_name"`
	SecurityNotes         string    `json:"security_notes"`
	QuarantineRecommended bool      `json:"quarantine_recommended"`
	Status                string    `json:"status"` // "pending", "processing", "completed", "failed"
	ErrorMessage          string    `json:"error_message"`
	ModelUsed             string    `json:"model_used"`
	PromptTokens          int       `json:"prompt_tokens"`
	CompletionTokens      int       `json:"completion_tokens"`
	CreatedAt             time.Time `json:"created_at"`
	UpdatedAt             time.Time `json:"updated_at"`
}

AIAnalysis stores the AI-generated analysis for an artifact.

type AnsibleCollection added in v0.14.0

type AnsibleCollection struct {
	ID           string
	RepositoryID string
	Namespace    string
	Name         string
	Version      string
	// Filename is the artifact file name, "<namespace>-<name>-<version>.tar.gz".
	Filename string

	BlobKey   string
	SizeBytes int64
	SHA256    string

	// Dependencies maps "namespace.name" to a version requirement.
	Dependencies map[string]string
	// Metadata is the collection_info object of MANIFEST.json.
	Metadata json.RawMessage
	// RequiresAnsible is the requires_ansible of meta/runtime.yml, "" when absent.
	RequiresAnsible string

	CreatedAt time.Time
	UpdatedAt time.Time
}

AnsibleCollection is one published version of an Ansible collection: the ns-name-version.tar.gz artifact and what its MANIFEST.json says about it.

type AnsibleCollectionName added in v0.14.0

type AnsibleCollectionName struct {
	Namespace string
	Name      string
	CreatedAt time.Time
	UpdatedAt time.Time
}

AnsibleCollectionName is one collection (all its versions) in a repository.

type ApkPackage added in v0.13.0

type ApkPackage struct {
	ID           string
	RepositoryID string
	Branch       string
	Repo         string
	// Arch is the architecture directory of the mirror tree; PkgArch is the
	// package's own architecture (PKGINFO arch, APKINDEX A:), noarch inside an
	// x86_64 directory.
	Arch    string
	PkgArch string
	Name    string
	Version string
	// Checksum is the APKINDEX "C:" value: "Q1" + base64(SHA-1 of the control segment).
	Checksum string
	// DataHash is the lowercase hex SHA-256 of the data segment.
	DataHash         string
	Description      string
	URL              string
	License          string
	Origin           string
	Maintainer       string
	Commit           string
	BuildTime        int64
	InstalledSize    int64
	Depends          []string
	Provides         []string
	InstallIf        []string
	ProviderPriority int
	BlobKey          string
	BlobSHA256       string
	SizeBytes        int64
	DownloadCount    int64
	CreatedAt        time.Time
	UpdatedAt        time.Time
}

ApkPackage is one .apk file of an Alpine repository, addressed as Branch/Repo/Arch/Name-Version.apk of the mirror tree.

type ApkSigningKey added in v0.13.0

type ApkSigningKey struct {
	RepositoryID string
	KeyName      string
	Fingerprint  string
	PublicKeyPEM string
	// PrivateKeyEnc is the internal/crypto sealed PKCS#8 PEM; it never reaches
	// API responses, backups or sidecars.
	PrivateKeyEnc []byte
	CreatedBy     string
	CreatedAt     time.Time
	UpdatedAt     time.Time
}

ApkSigningKey is the index signing key of one Alpine repository.

type ArtifactSecurity added in v0.11.0

type ArtifactSecurity struct {
	SecurityCounts

	Secrets     int64
	Quarantined bool
	ScannedAt   *time.Time
}

ArtifactSecurity is the security state of one package row (one file): its latest vulnerability counts, secret findings, quarantine state and the time of its latest completed scan.

type AuditCursor added in v0.4.0

type AuditCursor struct {
	CreatedAt time.Time
	ID        string
}

AuditCursor is a keyset position in the audit listing order (created_at DESC, id ASC).

type AuditListParams added in v0.4.0

type AuditListParams struct {
	Actor  string
	Action string
	// ProjectID, when set, restricts the listing to entries of that project:
	// those carrying its project_id plus those of any repository it owns now.
	ProjectID string
	// RepositoryID, when set, restricts the listing to entries carrying that
	// repository_id (the repository's own activity, unlike ProjectID which
	// also folds in every repository of a project).
	RepositoryID string
	// PackageName and PackageVersion, when set, keep only entries whose
	// details name that package (and version). Only entries that record the
	// package match, see audit.Event.Package.
	PackageName    string
	PackageVersion string
	// Actions, when non-empty, keeps only entries whose action is exactly one
	// of them (Action is a substring match; both may be set).
	Actions []string
	// HideProjectTokenEvents drops project.token_* entries (token mint and
	// revoke), which only maintainers may see.
	HideProjectTokenEvents bool
	// Since and Until bound created_at: entries at or after Since and strictly
	// before Until. Nil leaves that side open.
	Since *time.Time
	Until *time.Time
	Limit int
	// Offset skips that many entries. Ignored when After is set.
	Offset int
	// After, when set, returns only entries strictly after this position
	// (keyset paging: no offset scan, no total).
	After *AuditCursor
	// NoTotal skips the offset-paging total (keyset callers never read it).
	NoTotal bool
}

AuditListParams selects a page of audit entries. Entries are ordered newest first, ties on created_at broken by ascending id.

type AuditLog

type AuditLog struct {
	ID           string          `db:"id"`
	Action       string          `db:"action"`
	ProjectID    *string         `db:"project_id"`
	RepositoryID *string         `db:"repository_id"`
	ActorID      *string         `db:"actor_id"`
	ActorType    *string         `db:"actor_type"`
	DetailsJSON  json.RawMessage `db:"details_json"`
	ResourceType *string         `db:"resource_type"`
	ResourceID   *string         `db:"resource_id"`
	IPAddress    *string         `db:"ip_address"`
	CreatedAt    time.Time       `db:"created_at"`
}

AuditLog mirrors the audit_logs table schema: structured columns for compliance-grade auditing.

type AuditNameRefs added in v0.11.0

type AuditNameRefs struct {
	UserIDs             []string
	GroupIDs            []string
	RepositoryIDs       []string
	ProjectIDs          []string
	PermissionTargetIDs []string
	GPGKeyIDs           []string
	SSOProviderIDs      []string
	BundleIDs           []string
	TokenIDs            []string
}

AuditNameRefs lists the identifiers of one audit page whose names must be resolved. Every slice holds UUID strings; ResolveAuditNames looks each kind up with a single query regardless of how many rows the page has.

func (AuditNameRefs) Empty added in v0.11.0

func (r AuditNameRefs) Empty() bool

Empty reports whether there is nothing to resolve.

type AuditNames added in v0.11.0

type AuditNames struct {
	Users             map[string]string
	Groups            map[string]string
	Repositories      map[string]string
	Projects          map[string]string
	PermissionTargets map[string]string
	GPGKeys           map[string]string
	SSOProviders      map[string]string
	Bundles           map[string]string
	Tokens            map[string]string
}

AuditNames maps identifier to display name, one map per kind of AuditNameRefs. Identifiers whose row no longer exists are absent.

func NewAuditNames added in v0.11.0

func NewAuditNames() *AuditNames

NewAuditNames returns an AuditNames with every map allocated.

type AuditPage added in v0.4.0

type AuditPage struct {
	Logs []*AuditLog
	// Next is the position of the last entry in Logs when more entries
	// follow, nil on the last page.
	Next *AuditCursor
	// Total is the number of matching entries, computed for offset paging
	// only. It is exact when TotalExact is true; otherwise it is the planner
	// estimate (unfiltered) or a lower bound (filtered).
	Total      int
	TotalExact bool
}

AuditPage is one page of audit entries.

type BackupJob

type BackupJob struct {
	ID           string
	Status       string // "pending", "running", "completed", "failed"
	Type         string // "full", "metadata-only"
	StoragePath  string
	SizeBytes    int64
	ErrorMessage string
	StartedAt    *time.Time
	CompletedAt  *time.Time
	CreatedAt    time.Time
	UpdatedAt    time.Time
}

type BlobFacts added in v0.7.0

type BlobFacts struct {
	SHA256         string
	SizeBytes      int64
	CreatedAt      time.Time
	LastAccessedAt *time.Time
	BackendID      string // "" = primary store
	TierChangedAt  *time.Time
}

BlobFacts are the per-blob facts a lifecycle policy is evaluated against.

type BlobRef added in v0.7.0

type BlobRef struct {
	Repo   string
	Format string
	Path   string
}

BlobRef is one repository entry referencing a blob.

type BundleCheck added in v0.21.0

type BundleCheck struct {
	ID         string            `db:"id"`
	BundleID   string            `db:"bundle_id"`
	Name       string            `db:"name"`
	Status     BundleCheckStatus `db:"status"`
	Summary    string            `db:"summary"`
	DetailsURL string            `db:"details_url"`
	ReportedBy string            `db:"reported_by"`
	// ExpiresAt, when set, is the moment a success stops counting.
	ExpiresAt *time.Time `db:"expires_at"`
	CreatedAt time.Time  `db:"created_at"`
	UpdatedAt time.Time  `db:"updated_at"`
}

BundleCheck is the latest result of one named external check reported against a release bundle.

type BundleCheckStatus added in v0.21.0

type BundleCheckStatus string

BundleCheckStatus is the state an external check reports.

const (
	BundleCheckPending BundleCheckStatus = "pending"
	BundleCheckSuccess BundleCheckStatus = "success"
	BundleCheckFailure BundleCheckStatus = "failure"
	BundleCheckError   BundleCheckStatus = "error"
)

type BundlePromotion

type BundlePromotion struct {
	ID           string          `db:"id"`
	BundleID     string          `db:"bundle_id"`
	FromStage    *string         `db:"from_stage"`
	ToStage      string          `db:"to_stage"`
	TargetRepoID string          `db:"target_repo_id"`
	Status       PromotionStatus `db:"status"`
	PromotedBy   string          `db:"promoted_by"`
	Notes        string          `db:"notes"`
	ErrorMessage *string         `db:"error_message"`
	ItemCount    int             `db:"item_count"`
	StartedAt    time.Time       `db:"started_at"`
	CompletedAt  *time.Time      `db:"completed_at"`
}

type BundleSignature added in v0.8.0

type BundleSignature struct {
	KeyFingerprint string
	Signature      string
	ItemIDs        []string
}

BundleSignature is the GPG signature a bundle is sealed with. ItemIDs (the ids of the items the signed manifest was built from, sorted) pin the item set: sealing fails when it changed meanwhile.

type BundleState

type BundleState string
const (
	BundleStateDraft    BundleState = "draft"
	BundleStateSealed   BundleState = "sealed"
	BundleStateArchived BundleState = "archived"
)

type CRANFile added in v0.26.0

type CRANFile struct {
	ID           string
	RepositoryID string
	// Package and Version are the package name and the version as written.
	Package string
	Version string
	// Path is the canonical repository path of the file, Filename its last
	// element, Tree the directory of the tree it belongs to (the tree's PACKAGES
	// lists it).
	Path     string
	Filename string
	Tree     string
	// Fields are the standard PACKAGES fields of the package's DESCRIPTION
	// (Depends, Imports, License, ...), folded to one line each.
	Fields map[string]string
	// MD5 is the file's MD5 sum, the PACKAGES MD5sum field.
	MD5 string
	// Title, Description, License, Maintainer, URL describe the version.
	Title       string
	Description string
	License     string
	Maintainer  string
	URL         string
	BlobKey     string
	Digest      string
	SizeBytes   int64
	CreatedAt   time.Time
	UpdatedAt   time.Time
}

CRANFile is one stored R package file: a source tarball, a Windows binary zip or a macOS binary tgz of one package version.

type CargoCrate

type CargoCrate struct {
	ID            string
	RepositoryID  string
	Name          string
	Version       string
	Description   string
	Homepage      string
	Documentation string
	Repository    string
	License       string
	Keywords      []string
	Categories    []string
	Authors       []string
	Readme        string
	MetadataJSON  []byte
	BlobKey       string
	Checksum      string
	SizeBytes     int64 // size of the crate archive; recorded on the shared blobs row
	Yanked        bool
	DownloadCount int
	CreatedAt     time.Time
	UpdatedAt     time.Time
}

type CargoCrateSummary added in v0.5.0

type CargoCrateSummary struct {
	Name        string
	Description string // of the newest version
	Downloads   int64  // summed over every version
	// Versions lists every live version, yanked ones included, oldest first.
	Versions []string
	// LiveVersions lists the versions that are not yanked, oldest first.
	LiveVersions []string
}

CargoCrateSummary is one crate in a search result, aggregated over all of its live versions.

type ClaimMapping

type ClaimMapping struct {
	UsernameClaim string `json:"username_claim"`
	EmailClaim    string `json:"email_claim"`
	NameClaim     string `json:"name_claim"`
	GroupsClaim   string `json:"groups_claim"`
}

type CleanupPolicy

type CleanupPolicy struct {
	ID string `json:"id"`
	// RepositoryID is "" for a project default policy, whose ProjectID is set.
	RepositoryID            string     `json:"repository_id"`
	ProjectID               string     `json:"project_id,omitempty"`
	Name                    string     `json:"name"`
	Enabled                 bool       `json:"enabled"`
	KeepLastN               *int       `json:"keep_last_n"`
	KeepSinceDays           *int       `json:"keep_since_days"`
	KeepDownloadedSinceDays *int       `json:"keep_downloaded_since_days"`
	NamePattern             string     `json:"name_pattern"`
	ScheduleCron            string     `json:"schedule_cron"`
	LastRunAt               *time.Time `json:"last_run_at"`
	LastRunDeleted          *int       `json:"last_run_deleted"`
	LastRunError            string     `json:"last_run_error"`
	CreatedAt               time.Time  `json:"created_at"`
	UpdatedAt               time.Time  `json:"updated_at"`
}

func (*CleanupPolicy) Validate added in v0.2.0

func (p *CleanupPolicy) Validate() error

Validate checks that the policy can safely be executed: at least one retention criterion, strictly positive values (zero or negative values would select every artifact for deletion), a compilable name pattern and a valid cron schedule. keep_downloaded_since_days is rejected because download timestamps are not tracked, so it could never be honoured.

type Component

type Component struct {
	ID            string
	RepositoryID  string
	ArtifactID    string
	SHA256        string
	Format        string
	Name          string
	Version       string
	Release       string
	Epoch         int
	Arch          string
	Summary       string
	Description   string
	License       string
	URL           string
	Vendor        string
	Group         string
	Packager      string
	SourceRPM     string
	BuildHost     string
	BuildTime     int64
	PackageSize   int64
	InstalledSize int64
	ArchiveSize   int64
	Filename      string
	// HeaderStart/HeaderEnd are the RPM header byte range (rpm packages only).
	HeaderStart int64
	HeaderEnd   int64
	// RPMExtra is JSON-encoded dependency/file/changelog data (rpm packages only).
	RPMExtra  []byte
	CreatedAt time.Time
	UpdatedAt time.Time
}

type ComponentBlob added in v0.3.0

type ComponentBlob struct {
	ID        string
	Format    string
	Filename  string // the listing's filename for the row
	Name      string // the listing's package name for the row
	Version   string // the listing's version for the row ("" for raw and proxy-cache rows)
	SHA256    string
	Size      int64
	MediaType string
}

ComponentBlob locates the downloadable blob behind one row of the repository package listing (any format). SHA256 is empty when the row has no blob.

type ComponentDetail added in v0.11.0

type ComponentDetail struct {
	ID          string
	Format      string
	Name        string
	Version     string
	Arch        string
	Filename    string
	SHA256      string
	MD5         string
	SHA1        string
	SizeBytes   int64
	Summary     string
	Description string
	License     string
	Homepage    string
	CreatedAt   time.Time
	UpdatedAt   time.Time
	// Info holds the format-specific display fields (empty values dropped).
	Info map[string]string
	// Deps is the raw JSON the dependencies are decoded from, decoded by the
	// decoder named DepsDecoder; empty when the format shows none.
	Deps        []byte
	DepsDecoder string
	// Files are the listed files of the version (the row itself for a proxy
	// cache entry or a docker tag), newest first, at most MaxDetailFiles.
	Files []ComponentFile
}

ComponentDetail is one package file (the artifact a listing row id names) with the metadata its format's storage.Detail descriptor reads out of the generic tables.

type ComponentFile added in v0.19.0

type ComponentFile struct {
	ID       string
	Filename string
	Arch     string
	Size     int64
	SHA256   string
}

ComponentFile is one file of a package version in a ComponentDetail.

type ComposerPackage added in v0.15.0

type ComposerPackage struct {
	ID           string
	RepositoryID string
	// Name is the full lowercase "vendor/package".
	Name string
	// Version is the version as published, e.g. "v1.2.3" or "dev-main".
	Version string
	// VersionNormalized is Composer's VersionParser::normalize of Version.
	VersionNormalized string

	BlobKey   string
	SizeBytes int64
	SHA256    string
	// SHA1 is the hex sha1 of the zip (Composer dist.shasum).
	SHA1 string

	// ComposerJSON is the package's composer.json as uploaded.
	ComposerJSON json.RawMessage

	CreatedAt time.Time
	UpdatedAt time.Time
}

ComposerPackage is one published version of a Composer package: the dist zip and the composer.json it carries.

type ComposerPackageName added in v0.15.0

type ComposerPackageName struct {
	Name string
	// Description is that of the newest live version, "" when absent.
	Description string
	UpdatedAt   time.Time
}

ComposerPackageName is one package (all its versions) in a repository.

type ConanFileKey added in v0.5.0

type ConanFileKey struct {
	Name            string
	Version         string
	UserChannel     string
	RecipeRevision  string
	PackageID       string
	PackageRevision string
	Filename        string
}

ConanFileKey identifies one stored file of a repository.

func ParseConanReference added in v0.8.0

func ParseConanReference(ref string) (ConanFileKey, bool)

ParseConanReference splits name/version@user/channel#revision.

type ConanPackage

type ConanPackage struct {
	ID           string
	RepositoryID string
	Name         string
	Version      string
	// UserChannel is "user/channel"; "_/_" for a reference without either.
	UserChannel     string
	RecipeRevision  string
	PackageID       string
	PackageRevision string
	// Filename is the path of the file inside the revision (conanfile.py,
	// conanmanifest.txt, conan_package.tgz, metadata/...). Empty only for rows
	// stored before files were tracked.
	Filename  string
	BlobKey   string
	SHA256    string
	SizeBytes int64
	// MD5 and SHA1 are the lowercase hex digests Conan 1 clients ask for
	// (snapshots, checksum deploy); empty for files stored before they were
	// tracked.
	MD5       string
	SHA1      string
	CreatedAt time.Time
	UpdatedAt time.Time
}

ConanPackage is one stored file of a Conan recipe revision (PackageID empty) or of a package revision of it. Conan 2 addresses everything by revision: the recipe revision is the hash of the recipe's manifest, the package revision that of the package's manifest.

type ConanRecipe added in v0.5.0

type ConanRecipe struct {
	Name        string
	Version     string
	UserChannel string
}

ConanRecipe names a recipe (every revision of name/version@user/channel).

type CondaPackage

type CondaPackage struct {
	ID           string
	RepositoryID string
	Name         string
	Version      string
	BuildString  string
	Platform     string
	// Extension is CondaExtTarBz2 or CondaExtConda; empty is read as
	// CondaExtTarBz2 (rows written before the extension was recorded).
	Extension string
	// BuildNumber, Timestamp, Depends and Extra come from info/index.json.
	BuildNumber int
	// Timestamp is milliseconds since the epoch; 0 when the package declares none.
	Timestamp int64
	Depends   []string
	// Extra holds the remaining repodata fields (constrains, license,
	// license_family, noarch, arch, platform, features, track_features) as a
	// JSON object.
	Extra     json.RawMessage
	BlobKey   string
	SizeBytes int64
	SHA256    string
	MD5       string
	CreatedAt time.Time
	UpdatedAt time.Time
}

CondaPackage is one conda package file. A .tar.bz2 and a .conda with the same name, version and build are separate rows.

func (*CondaPackage) Filename added in v0.5.0

func (p *CondaPackage) Filename() string

Filename returns the package file name: name-version-build plus extension.

type DebControl added in v0.16.0

type DebControl struct {
	Maintainer string
	Homepage   string
	Fields     map[string]string
}

DebControl is what a deb upload stores in the same transaction as the package row: the maintainer and homepage (version metadata) and the control stanza map Packages generation renders. A row never exists without them, so no index can list a package with a stanza stripped of Depends, Maintainer, etc.

type DebPackage

type DebPackage struct {
	ID             string
	RepositoryID   string
	DistributionID string
	ComponentID    string
	BlobID         string
	Name           string
	Version        string
	Arch           string
	Summary        string
	Description    string
	License        string
	Maintainer     string
	Homepage       string
	Filename       string
	InstalledSize  int64
	CreatedAt      time.Time
	UpdatedAt      time.Time
}

DebPackage represents a Debian package published on the generic package tables (package_files and deb_files).

type DebPackageEntry added in v0.2.0

type DebPackageEntry struct {
	ID             string
	Name           string
	Version        string
	Arch           string
	Filename       string
	DistributionID string
	Distribution   string
	ComponentName  string
	SHA256         string
	Size           int64
	InstalledSize  int64
	ControlFields  map[string]string
}

DebPackageEntry is a deb package joined with everything needed to render a Packages stanza: blob checksum/size, distribution/component names and the stored control fields.

type DebPackageStamp added in v0.19.0

type DebPackageStamp struct {
	DebPackageEntry

	// ControlRev is the version of the row holding the control fields.
	ControlRev int64
}

DebPackageStamp is a DebPackageEntry together with the version of its control stanza row. Everything a Packages stanza is rendered from is the entry's fields and its control fields, and the control fields are fixed by the row version: two stamps that are equal (EqualStamp) render the same stanza, so a group keeps the rendered text under the stamp instead of reading the control fields again. ControlFields is empty unless the stamp was read with its controls.

func (*DebPackageStamp) EqualStamp added in v0.19.0

func (a *DebPackageStamp) EqualStamp(b *DebPackageStamp) bool

EqualStamp reports whether a and b describe the same file in the same state (the control fields themselves are not compared; ControlRev stands for them).

type DebianArchitecture

type DebianArchitecture struct {
	ID             string
	DistributionID string
	Name           string // e.g., "amd64", "i386", "arm64"
	CreatedAt      time.Time
	UpdatedAt      time.Time
}

DebianArchitecture represents a supported architecture.

type DebianComponent

type DebianComponent struct {
	ID             string
	DistributionID string
	Name           string // e.g., "main", "universe", "restricted"
	Description    string
	CreatedAt      time.Time
	UpdatedAt      time.Time
}

DebianComponent represents a component within a distribution (main, universe, etc.)

type DebianDistribution

type DebianDistribution struct {
	ID           string
	RepositoryID string
	Name         string // e.g., "focal", "jammy"
	Description  string
	Codename     string // e.g., "20.04", "22.04"
	CreatedAt    time.Time
	UpdatedAt    time.Time
}

DebianDistribution represents a Debian distribution (e.g., focal, jammy).

type DeclarativeObject added in v0.8.1

type DeclarativeObject struct {
	Kind        string
	Name        string
	ObjectID    string
	AppliedHash string
	AppliedAt   time.Time
}

DeclarativeObject is the ownership marker of an object created or adopted by `oa apply`. ObjectID is the server-side id at apply time.

type DependencyTrackLastPush added in v0.11.0

type DependencyTrackLastPush struct {
	OK bool
	At time.Time
}

DependencyTrackLastPush is the outcome of the most recent finished Dependency-Track push of any artifact.

type DependencyTrackPush added in v0.8.0

type DependencyTrackPush struct {
	RepositoryID   string     `json:"repository_id"`
	ArtifactID     string     `json:"artifact_id"`
	State          string     `json:"state"`
	Detail         string     `json:"detail"`
	ProjectUUID    string     `json:"project_uuid"`
	ProjectName    string     `json:"project_name"`
	ProjectVersion string     `json:"project_version"`
	Components     int        `json:"components"`
	VEXStatements  int        `json:"vex_statements"`
	VEXApplied     int        `json:"vex_applied"`
	BOMPushedAt    *time.Time `json:"bom_pushed_at"`
	VEXPushedAt    *time.Time `json:"vex_pushed_at"`
	CreatedAt      time.Time  `json:"created_at"`
	UpdatedAt      time.Time  `json:"updated_at"`
}

DependencyTrackPush is the last BOM / VEX push of one artifact.

type DockerBlob

type DockerBlob struct {
	ID           string `db:"id"`
	RepositoryID string `db:"repository_id"`
	Digest       string `db:"digest"` // sha256:<hex>
	MediaType    string `db:"media_type"`
	Size         int64  `db:"size"`
	BlobSHA256   string `db:"blob_sha256"` // blobstore key
	// Image, when set on create, also links the blob to that image of the
	// repository ("" is the default image); nil records the repository only.
	Image     *string   `db:"-"`
	CreatedAt time.Time `db:"created_at"`
	// Inserted is set by CreateDockerBlob: true when the call created the
	// repository's row, false when the repository already held the blob. Callers
	// that meter storage quota reserve only for a row they inserted.
	Inserted bool `db:"-"`
}

DockerBlob represents a content-addressable blob (layer or config).

type DockerCatalogEntry added in v0.8.0

type DockerCatalogEntry struct {
	// Name is the distribution name listed in the catalog.
	Name       string
	Repository *Repository
	Image      string
	Sources    []*Repository
}

DockerCatalogEntry is one name of the registry catalog: an image of a docker repository, "<repository>/<image>" (just the repository for its default image). Sources are the repositories that hold the image: the repository itself, or for a group its members that do.

type DockerGCBlob added in v0.4.0

type DockerGCBlob struct {
	Digest     string // sha256:<hex>
	BlobSHA256 string // blob-store key
	Size       int64
}

DockerGCBlob is a blob record of a repository as seen by registry GC.

type DockerGCManifest added in v0.4.0

type DockerGCManifest struct {
	ID            string
	Image         string
	Digest        string // sha256:<hex>
	SubjectDigest string
	Size          int64
	BlobSHA256    string // blob-store key of the manifest body
	// Tagged: some tag of the same image points at the manifest.
	Tagged bool
	// Young: pushed or re-pushed within the grace period.
	Young bool
	// Children are the digests of the manifests an index references.
	Children []string
	// DependentOf are the subject digests of the live dependent tags (cosign
	// .sig/.att/.sbom/.src, referrers tag schema) pointing at the manifest, when
	// those subjects are still to be judged by this GC run. Tagged is false then
	// unless some other tag holds the manifest.
	DependentOf []string
}

DockerGCManifest is a manifest as seen by registry GC.

type DockerManifest

type DockerManifest struct {
	ID            string `db:"id"`
	RepositoryID  string `db:"repository_id"`
	Image         string `db:"image"`  // image name inside the repository; "" is the default image
	Digest        string `db:"digest"` // sha256:<hex>
	MediaType     string `db:"media_type"`
	BlobID        string `db:"blob_id"`
	Size          int64  `db:"size"`
	SubjectDigest string `db:"subject_digest"` // OCI referrers
	// BlobSHA256 is populated only by ListDockerManifestsByRepo (a JOIN with
	// blobs, used for backup export) since BlobID above is a live blobs.id
	// UUID that doesn't survive a restore into a fresh DB.
	BlobSHA256 string `db:"-"`
	// Refs, when set, is recorded together with the manifest in one
	// transaction (see CreateDockerManifest). Nil leaves the manifest
	// unindexed, to be indexed later by registry GC.
	Refs *DockerManifestRefs `db:"-"`
	// RequiredBlobs, when set together with Refs, are the config and layer
	// digests the manifest needs pushed. CreateDockerManifest verifies, under
	// the lock registry GC takes exclusively, that the repository holds each of
	// them for this image, and fails with ErrDockerBlobsMissing otherwise.
	RequiredBlobs []string  `db:"-"`
	CreatedAt     time.Time `db:"created_at"`
	UpdatedAt     time.Time `db:"updated_at"`
	// ExpiresAt is the quay.expires-after deadline the manifest declared when it
	// was pushed; nil when it declares none (or its repository does not honour it).
	ExpiresAt *time.Time `db:"expires_at"`
	// Inserted is set by CreateDockerManifest: true when the call created the
	// live row, false when it refreshed an existing one. Callers that meter
	// storage quota reserve only for a row they inserted.
	Inserted bool `db:"-"`
}

DockerManifest stores an OCI or Docker v2 image manifest.

type DockerManifestRefs added in v0.4.0

type DockerManifestRefs struct {
	Blobs     []string
	Manifests []string
}

DockerManifestRefs lists what a manifest body references: blob digests (config and layers) and child manifest digests (an index).

type DockerRepository

type DockerRepository struct {
	ID           string    `db:"id"`
	RepositoryID string    `db:"repository_id"`
	CreatedAt    time.Time `db:"created_at"`
}

DockerRepository holds Docker-specific config for a repository.

type DockerTag

type DockerTag struct {
	ID             string    `db:"id"`
	RepositoryID   string    `db:"repository_id"`
	Image          string    `db:"image"` // image name inside the repository; "" is the default image
	Name           string    `db:"name"`
	ManifestDigest string    `db:"manifest_digest"`
	CreatedAt      time.Time `db:"created_at"`
	UpdatedAt      time.Time `db:"updated_at"`
}

DockerTag is a named reference to a manifest.

type DockerUpload

type DockerUpload struct {
	ID           string `db:"id"`
	RepositoryID string `db:"repository_id"`
	// Image is the image the session was started for; every request on the
	// session must come through it.
	Image      string `db:"image"`
	UploadUUID string `db:"upload_uuid"`
	Offset     int64  `db:"offset"`
	// HashState is the marshalled sha256 state of the first Offset bytes; empty
	// while Offset is 0.
	HashState []byte `db:"hash_state"`
	// StageState is the opaque blob store token of the upload object.
	StageState string    `db:"stage_state"`
	CreatedAt  time.Time `db:"created_at"`
	UpdatedAt  time.Time `db:"updated_at"`
}

DockerUpload tracks an in-progress chunked blob upload.

type EPSSScore added in v0.14.0

type EPSSScore struct {
	// CVE is the upper-case CVE id.
	CVE string
	// Score is the probability (0..1) of exploitation activity in the next 30 days.
	Score float64
	// Percentile is the share of scored CVEs with the same or a lower score.
	Percentile float64
}

EPSSScore is the EPSS score of one CVE.

type ExploitFeedState added in v0.14.0

type ExploitFeedState struct {
	// Name is ExploitFeedKEV or ExploitFeedEPSS.
	Name string
	// SourceURL is the URL the loaded data came from.
	SourceURL string
	// Version is the catalog version (KEV) or model version (EPSS) of the data.
	Version string
	// PublishedAt is when the feed says the data was released: the KEV
	// dateReleased, the EPSS score_date.
	PublishedAt *time.Time
	// EntryCount is the number of rows loaded.
	EntryCount int
	// Generation counts the imports of the feed.
	Generation int64
	// ETag and LastModified are the validators of the loaded file, sent back
	// as If-None-Match and If-Modified-Since.
	ETag         string
	LastModified string
	// ImportedAt is when the data was last replaced, CheckedAt when the source
	// was last asked (an unchanged file only moves CheckedAt).
	ImportedAt *time.Time
	CheckedAt  *time.Time
	// LastError is the sanitized reason the last check failed; empty after a success.
	LastError string
}

ExploitFeedState is what is loaded from one feed and how the last check went.

type ExploitSignal added in v0.14.0

type ExploitSignal struct {
	KEV  *KEVEntry
	EPSS *EPSSScore
}

ExploitSignal is what the feeds say about one CVE; a nil field means the feed does not list it.

type FileDeletion added in v0.15.0

type FileDeletion struct {
	// ID is the listed file id the caller asked to delete.
	ID string
	// BlobSHA256 lists the blobs the deleted files referenced; the caller frees
	// them with storage.SafeDeleteBlob (which keeps blobs still referenced
	// elsewhere).
	BlobSHA256 []string
	// QuotaArtifacts is the number of quota-counted artifacts removed (one per
	// primary file) and QuotaBytes the size of every blob the files held.
	QuotaArtifacts int
	QuotaBytes     int64
}

FileDeletion is what a permanent delete of one live package item (listed file and, for a version-scoped format, the files that go with it) gives back.

type Finding added in v0.11.0

type Finding struct {
	ID             string
	Type           string
	RepositoryID   string
	Repository     string
	Format         string
	ArtifactID     string
	PackageName    string
	PackageVersion string
	Scanner        string
	ScanStatus     string
	Critical       int
	High           int
	Medium         int
	Low            int
	Quarantined    bool
	Status         string
	// VEXStatus is the least resolved VEX decision on the vulnerabilities of a
	// vuln finding (affected, under_investigation, fixed, not_affected); empty
	// when none applies.
	VEXStatus string
	// SeverityRank is 4 critical, 3 high, 2 medium, 1 low, 0 none.
	SeverityRank int
	// KEVCount is the number of vulnerabilities of a vuln finding in the KEV
	// catalog (0 for the other types).
	KEVCount int
	// MaxEPSS is the highest EPSS score of a vuln finding; nil when none is scored.
	MaxEPSS *float64
	// SortRank is the rank the list was ordered by: SeverityRank, or the exploit
	// rank (kev 6, epss 5) under FindingSortPriority.
	SortRank int
	// Title is a one-line summary: the worst vulnerability id, the licenses, the
	// worst secret finding or the AI note.
	Title     string
	ScannedAt time.Time
}

Finding is one stored scan result that reports something.

func (*Finding) Severity added in v0.11.0

func (f *Finding) Severity() string

Severity is the highest severity of the finding, FindingSeverityNone when it has none.

type FindingCursor added in v0.11.0

type FindingCursor struct {
	Sort      string
	Rank      int
	ScannedAt time.Time
	ID        string
}

FindingCursor is a keyset position in the findings order (sort rank DESC, ScannedAt DESC, ID ASC). Sort is the order it was minted under.

type FindingFilter added in v0.11.0

type FindingFilter struct {
	Scope   FindingScope
	Repo    string
	Project string
}

FindingFilter narrows findings by repository and project name (empty: any) within a scope.

type FindingListParams added in v0.11.0

type FindingListParams struct {
	FindingFilter

	// Types are the finding types to include (never empty: FindingTypes()).
	Types []string
	// Severity is the highest severity of the finding: critical, high, medium or low.
	Severity string
	// Status is open, quarantined or suppressed.
	Status string
	// Q matches the repository name and "name@version" case-insensitively as a
	// substring.
	Q     string
	Limit int
	// Sort is FindingSortSeverity (default, also for "") or FindingSortPriority.
	Sort string
	// KEV, when set, keeps findings with (true) or without (false) a KEV vulnerability.
	KEV *bool
	// EPSSMin, when set, keeps findings whose highest EPSS score is at least this.
	EPSSMin *float64
	// PriorityRank, when set, keeps findings whose exploit rank equals it
	// (6 kev, 5 epss, 4..1 the severity ranks).
	PriorityRank *int
	// EPSSThreshold is the EPSS score from which a finding ranks as epss.
	EPSSThreshold float64
	// After, when set, returns only findings strictly after this position.
	After *FindingCursor
}

FindingListParams selects one keyset page of findings. Empty filters match everything.

type FindingPage added in v0.11.0

type FindingPage struct {
	Findings []*Finding
	Next     *FindingCursor
}

FindingPage is one page of findings; Next is set when more follow.

type FindingScope added in v0.11.0

type FindingScope struct {
	// All sees every repository (a global admin).
	All bool
	// ProjectIDs are the projects whose repositories are visible when All is false.
	ProjectIDs []string
}

FindingScope limits a findings query to the repositories a caller may see.

type FindingTypeSummary added in v0.11.0

type FindingTypeSummary struct {
	Total       int
	Critical    int
	High        int
	Medium      int
	Low         int
	Quarantined int
}

FindingTypeSummary counts the findings of one type; the severities count by each finding's highest severity.

type FindingsSummary added in v0.11.0

type FindingsSummary struct {
	ByType map[string]FindingTypeSummary
	// ScannedRepositories of TotalRepositories (repositories that hold artifacts)
	// have a completed scan of any type.
	ScannedRepositories int
	TotalRepositories   int
	// LastScanAt is when the latest scan of the scope finished; nil when none did.
	LastScanAt *time.Time
}

FindingsSummary counts findings per type and how much of the scope was scanned.

type FlipOutcome added in v0.7.0

type FlipOutcome int

FlipOutcome is the result of a conditional placement flip.

const (
	// FlipDone: the placement now points at the target.
	FlipDone FlipOutcome = iota
	// FlipBlobGone: no blobs row exists any more (deleted meanwhile).
	FlipBlobGone
	// FlipPlacementChanged: the placement is not the expected source.
	FlipPlacementChanged
)

Flip outcomes.

type GPGKey added in v0.8.0

type GPGKey struct {
	ID             string
	Name           string
	Fingerprint    string
	KeyID          string
	Algorithm      string
	UserID         string
	PublicKey      string
	PrivateKeyEnc  string
	IsGlobalActive bool
	Source         string
	CreatedBy      string
	CreatedAt      time.Time
	ExpiresAt      *time.Time
}

GPGKey is a database-managed GPG signing key. PrivateKeyEnc is the armored, passphrase-less private key sealed by internal/crypto; it is only filled by the single-key getters and the repository resolver, never by ListGPGKeys, and is never serialised into an API response.

type GPGKeyAssignment added in v0.8.0

type GPGKeyAssignment struct {
	KeyID            string
	RepositoryID     string
	RepositoryName   string
	RepositoryFormat string
}

GPGKeyAssignment binds a repository to the key that signs its metadata.

type GPGSigningRepo added in v0.8.0

type GPGSigningRepo struct {
	ID     string
	Format string
}

GPGSigningRepo identifies a repository whose metadata a key signs.

type GitLFSObject added in v0.26.0

type GitLFSObject struct {
	ID           string
	RepositoryID string
	// OID is the object id, the lower-case hex SHA-256 of the content (and the
	// digest of its blob).
	OID       string
	SizeBytes int64
	BlobKey   string
	// CreatedAt overrides the creation time of a restore or import; the zero
	// value stamps now.
	CreatedAt time.Time
	UpdatedAt time.Time
}

GitLFSObject is one Git LFS object of a repository: a blob named by its SHA-256 object id.

type GoModule

type GoModule struct {
	ID           string
	RepositoryID string
	ModulePath   string
	Version      string
	GoModContent string
	ZipBlobKey   string
	ModBlobKey   string
	ZipSizeBytes int64
	ZipHash      string
	CreatedAt    time.Time
	UpdatedAt    time.Time
}

type Group

type Group struct {
	ID          string
	Name        string
	Description *string
	CreatedAt   time.Time
	UpdatedAt   time.Time
}

type GroupMetadataState added in v0.8.0

type GroupMetadataState struct {
	RepositoryID string
	// Stale is set when a member or the group changed since the metadata was
	// generated.
	Stale bool
	// UpdatedAt changes on every MarkGroupMetadataStale; a regeneration clears
	// Stale only if it is still the value it started from.
	UpdatedAt time.Time
	// GeneratedAt is when the metadata was last generated, nil before the first
	// generation.
	GeneratedAt *time.Time
	// RefreshAfter is when proxy members' upstream metadata may have changed
	// (their cache TTL), nil for a group without proxy members.
	RefreshAfter *time.Time
	// Dists are the Debian distributions served in addition to the ones the
	// hosted members hold.
	Dists []string
}

GroupMetadataState is the regeneration bookkeeping of a deb or rpm group repository's merged metadata (group_metadata_state).

type HeldName added in v0.24.0

type HeldName struct {
	Index  int
	RepoID string
}

HeldName says that hosted repository RepoID holds a live version of the package Index of a batch lookup names.

type HelmChart

type HelmChart struct {
	ID           string
	RepositoryID string
	Name         string
	Version      string
	AppVersion   string
	Description  string
	Keywords     []string
	Home         string
	Sources      []string
	Maintainers  []map[string]string // [{name, email, url}]
	Icon         string
	APIVersion   string
	Type         string
	BlobKey      string
	Digest       string
	SizeBytes    int64
	CreatedAt    time.Time
	UpdatedAt    time.Time
}

type IvyArtifact

type IvyArtifact struct {
	ID           string
	RepositoryID string
	Organisation string
	Module       string
	Revision     string
	ArtifactName string
	ArtifactType string
	ArtifactExt  string
	BlobKey      string
	SizeBytes    int64
	SHA256       string
	CreatedAt    time.Time
	UpdatedAt    time.Time
}

type KEVEntry added in v0.14.0

type KEVEntry struct {
	// CVE is the upper-case CVE id.
	CVE string
	// VendorProject, Product and Name are the catalog's vendorProject, product
	// and vulnerabilityName.
	VendorProject string
	Product       string
	Name          string
	// DateAdded is the day CISA added the CVE to the catalog.
	DateAdded time.Time
	// DueDate is the remediation deadline CISA set; nil when the catalog gives none.
	DueDate *time.Time
	// KnownRansomware reports knownRansomwareCampaignUse = "Known".
	KnownRansomware bool
}

KEVEntry is one entry of the CISA Known Exploited Vulnerabilities catalog.

type LicensePolicy

type LicensePolicy struct {
	ID              string
	RepositoryID    *string // nil = global policy
	Name            string
	Description     string
	Action          string // "warn", "block", "allow"
	AllowedLicenses []string
	DeniedLicenses  []string
	Enabled         bool
	CreatedAt       time.Time
	UpdatedAt       time.Time
}

LicensePolicy represents a license compliance policy.

type LicenseScanResult

type LicenseScanResult struct {
	ID              string
	RepositoryID    string
	ArtifactID      string
	Licenses        []string
	SPDXExpressions []string
	// UnresolvedLicenses are the entries of Licenses that are not SPDX
	// expressions: raw text read from the artifact ("BSD", "BSD License"),
	// kept as written and flagged for review.
	UnresolvedLicenses []string
	// LicenseSource is "artifact" when Licenses include ones read from the
	// package file, "client_declared" when they only come from what a client
	// declared (license properties) because the file declared or allowed none.
	LicenseSource string
	ScanStatus    string // "pending", "completed", "failed"
	ScanError     string
	// Quarantined makes downloads of the artifact answer 403 until approved.
	Quarantined bool
	// QuarantineApproved records that an admin approved the artifact for
	// Licenses; it is cleared when a re-scan finds different licenses.
	QuarantineApproved bool
	ScannedAt          *time.Time
	CreatedAt          time.Time
	UpdatedAt          time.Time
}

LicenseScanResult represents a license scan result for an artifact.

type MavenArtifact

type MavenArtifact struct {
	ID                  string
	RepositoryID        string
	BlobID              string
	GroupID             string
	ArtifactCoord       string
	Version             string
	Classifier          string
	Extension           string
	SnapshotTimestamp   string
	SnapshotBuildNumber int
	IsSnapshot          bool
	RepoPath            string
	MD5                 string
	SHA1                string
	SHA256              string
	SHA512              string
	// BlobSHA256/BlobSizeBytes are populated only by ListMavenArtifactsByRepo
	// (a JOIN with blobs, used for backup export) since BlobID above is a
	// live blobs.id UUID that doesn't survive a restore into a fresh DB.
	BlobSHA256    string
	BlobSizeBytes int64
	CreatedAt     time.Time
	UpdatedAt     time.Time
	// Replaced is set by CreateMavenArtifact to the content a snapshot
	// overwrite took the path over from (nil for a new path).
	Replaced *ReplacedBlob
}

func (*MavenArtifact) Coordinate

func (m *MavenArtifact) Coordinate() pkgmaven.Coordinate

type MavenGARefs added in v0.9.0

type MavenGARefs struct {
	// Versions holds every distinct live version, in version (string) order.
	Versions []string
	// Snapshots holds one entry per live file of every -SNAPSHOT version.
	Snapshots []MavenSnapshotRef
}

MavenGARefs is what maven-metadata.xml regeneration needs to know about one group:artifact, without the ids, paths and checksums of the full artifact rows.

type MavenSnapshotRef added in v0.9.0

type MavenSnapshotRef struct {
	Version     string
	Classifier  string
	Extension   string
	Timestamp   string
	BuildNumber int
}

MavenSnapshotRef is one live file of a -SNAPSHOT version.

type NPMDistTag

type NPMDistTag struct {
	ID        string
	PackageID string
	Tag       string
	Version   string
	UpdatedAt time.Time
}

type NPMPackage

type NPMPackage struct {
	ID             string
	RepositoryID   string
	Scope          string
	Name           string
	FullName       string
	LatestVersion  string
	PackumentStale bool
	CreatedAt      time.Time
	UpdatedAt      time.Time
}

type NPMVersion

type NPMVersion struct {
	// ID is the id of the tarball package_files row (the artifact id).
	ID              string
	PackageID       string
	Version         string
	ManifestJSON    []byte
	Integrity       string
	Shasum          string
	BlobID          string
	TarballFilename string
	// BlobSHA256/BlobSizeBytes are resolved by the Get* reads (a JOIN with
	// blobs): BlobID above is a blobs.id UUID, not a storage key.
	BlobSHA256    string
	BlobSizeBytes int64
	CreatedAt     time.Time
}

type NPMVersionState added in v0.6.0

type NPMVersionState struct {
	Version    string
	Deprecated bool
}

NPMVersionState is the part of a live npm version that decides the "latest" dist-tag: its number and whether its manifest carries a deprecation message.

type NameVersion added in v0.24.0

type NameVersion struct {
	Name    string
	Version string
}

NameVersion is one package version of a batch lookup, as a client names it.

type NixPath added in v0.14.0

type NixPath struct {
	ID           string
	RepositoryID string
	// StoreHash is the 32 character nixbase32 hash of the store path.
	StoreHash string
	Name      string
	// NarHash is the narinfo NarHash ("sha256:<nixbase32>") of the uncompressed NAR.
	NarHash string
	NarSize int64
	// NarFile is the file name below nar/ ("<nixbase32 file hash>.nar.xz").
	NarFile     string
	Compression string
	// References are the base names of the referenced store paths.
	References []string
	Deriver    string
	CA         string
	// Signatures are the Sig lines the uploader supplied ("name:base64").
	Signatures    []string
	DownloadCount int64
	BlobKey       string
	// SHA256 is the lowercase hex SHA-256 of the NAR file (the narinfo FileHash).
	SHA256 string
	// SizeBytes is the size of the NAR file (the narinfo FileSize).
	SizeBytes int64
	CreatedAt time.Time
	UpdatedAt time.Time
}

NixPath is one store path of a Nix binary cache: its narinfo and the NAR file it points to. Components are named Name (the store path name without the hash) at version StoreHash.

type NixPendingNar added in v0.14.0

type NixPendingNar struct {
	RepositoryID string
	// SHA256 is the lowercase hex SHA-256 of the file.
	SHA256    string
	NarFile   string
	BlobKey   string
	SizeBytes int64
	// ReservedBytes is what the staged file holds in the repository's storage
	// quota until its narinfo arrives or the row is swept.
	ReservedBytes int64
	CreatedAt     time.Time
}

NixPendingNar is a NAR file uploaded before its narinfo.

type NixSigningKey added in v0.14.0

type NixSigningKey struct {
	RepositoryID string
	KeyName      string
	// PublicKey is the Nix public key format "name:base64(32 bytes)".
	PublicKey string
	// PrivateKeyEnc is the internal/crypto sealed private key; it never reaches
	// API responses, backups or sidecars.
	PrivateKeyEnc []byte
	CreatedBy     string
	CreatedAt     time.Time
	UpdatedAt     time.Time
}

NixSigningKey is the narinfo signing key of one Nix repository.

type NuGetPackage

type NuGetPackage struct {
	ID                       string
	RepositoryID             string
	PackageID                string
	Version                  string
	Title                    string
	Description              string
	Summary                  string
	Authors                  string
	Owners                   string
	Tags                     string
	ProjectURL               string
	LicenseURL               string
	IconURL                  string
	RequireLicenseAcceptance bool
	IsPrerelease             bool
	MinClientVersion         string
	// DependencyGroups is the registration "dependencyGroups" JSON of the
	// package. nil means not recorded yet (derive it from the nuspec); an empty
	// array means the package has no dependencies.
	DependencyGroups     json.RawMessage
	BlobKey              string
	PackageHash          string
	PackageHashAlgorithm string
	PackageSize          int64
	DownloadCount        int
	CreatedAt            time.Time
	UpdatedAt            time.Time
}

type OCIAttestation added in v0.21.0

type OCIAttestation struct {
	ID           string
	RepositoryID string
	// Image is the image inside the repository ("" for the default image).
	Image string
	// SubjectDigest is the manifest digest the envelope is about.
	SubjectDigest string
	// AttestationDigest is the digest ("sha256:<hex>") of the signed envelope.
	AttestationDigest string
	// ManifestID is the docker manifest that carries the envelope.
	ManifestID     string
	PredicateType  string
	Kind           string
	SignerIdentity string
	Issuer         string
	Verified       bool
	VerifyError    string
	// PayloadBlob is the blob store key of the envelope.
	PayloadBlob string
	// CreatedAt is when the envelope was first seen; on a write it is that
	// time too (an existing row keeps its own).
	CreatedAt time.Time
	UpdatedAt time.Time
}

OCIAttestation is one signature, in-toto attestation or SBOM attached to a docker image, with the outcome of verifying it against the repository's attestation trust configuration.

type OIDCCondition added in v0.16.0

type OIDCCondition struct {
	Claim    string   `json:"claim"`
	Patterns []string `json:"patterns"`
}

OIDCCondition is one claim condition of an OIDCTrustPolicy: the token's claim must match at least one of Patterns (a glob where "*" matches any run of characters, "/" included, and "?" one character).

type OIDCConfig

type OIDCConfig struct {
	Issuer       string `json:"issuer"`
	ClientID     string `json:"client_id"`
	ClientSecret string `json:"client_secret"`
	// Scopes defaults to "openid email profile"; "groups" and any other
	// IdP-specific scope are opt-in.
	Scopes        []string `json:"scopes"`
	UsernameClaim string   `json:"username_claim"`
	EmailClaim    string   `json:"email_claim"`
	NameClaim     string   `json:"name_claim"`
	GroupsClaim   string   `json:"groups_claim"`

	// Type is "", "github" or "oauth2".
	Type string `json:"type,omitempty"`

	// DexConnectorID pins a Dex provider (Type "") to one of the connectors
	// of that Dex: it is sent as connector_id on the authorization request,
	// so Dex skips its connector chooser, and the ID token's
	// federated_claims.connector_id must equal it. Scopes default to
	// "openid email profile groups federated:id" when it is set; explicit
	// scopes must include federated:id, the scope that releases the claim.
	DexConnectorID string `json:"dex_connector_id,omitempty"`

	// AllowedTenants lists the Entra tenant IDs accepted for a multi-tenant
	// authority (issuer .../common/v2.0, .../organizations/v2.0). The ID
	// token's tid claim must be one of them. Required for those authorities.
	AllowedTenants []string `json:"allowed_tenants,omitempty"`
	// HostedDomain restricts Google logins to one Workspace domain: the ID
	// token's hd claim must equal it (the hd request parameter is only a hint).
	HostedDomain string `json:"hosted_domain,omitempty"`
	// RequireEmailVerified rejects logins whose ID token does not carry
	// email_verified=true. Always enforced for Google (accounts.google.com).
	RequireEmailVerified bool `json:"require_email_verified,omitempty"`
	// GraphGroups fetches the user's groups from Microsoft Graph when Entra
	// signals a groups overage (more groups than fit in the token). Needs the
	// Graph scope in Scopes (for example https://graph.microsoft.com/User.Read)
	// and admin consent for the matching permission.
	GraphGroups bool `json:"graph_groups,omitempty"`
	// GraphEndpoint overrides https://graph.microsoft.com (national clouds).
	GraphEndpoint string `json:"graph_endpoint,omitempty"`

	// OAuth2-only (Type "github" or "oauth2"). For "github" every URL defaults
	// to github.com; set AuthBaseURL/APIBaseURL for GitHub Enterprise Server.
	AuthorizationURL string `json:"authorization_url,omitempty"`
	TokenURL         string `json:"token_url,omitempty"`
	UserinfoURL      string `json:"userinfo_url,omitempty"`
	AuthBaseURL      string `json:"auth_base_url,omitempty"`
	APIBaseURL       string `json:"api_base_url,omitempty"`
	// AllowedOrgs (github) lists the organizations a user must belong to; a
	// login from outside them is rejected, and "org" / "org/team-slug" become
	// the user's groups.
	AllowedOrgs []string `json:"allowed_orgs,omitempty"`
}

OIDCConfig configures an "oidc" kind provider. Type selects the flavour: empty is a standards-compliant OIDC provider (discovery + ID token); "github" and "oauth2" are plain OAuth 2.0 providers without an ID token (identity comes from the userinfo endpoint).

type OIDCDiscovery added in v0.21.0

type OIDCDiscovery struct {
	Mode string          `json:"mode"`
	JWKS json.RawMessage `json:"jwks,omitempty"`
}

OIDCDiscovery says how the keys that verify the tokens of a policy's issuer are found. JWKS is a public key set (a JSON object), set for the static mode only.

func (OIDCDiscovery) EffectiveMode added in v0.21.0

func (d OIDCDiscovery) EffectiveMode() string

EffectiveMode is the mode, OIDCDiscoveryAnonymous when none is set.

type OIDCTrustPolicy added in v0.16.0

type OIDCTrustPolicy struct {
	ID               string
	Name             string
	Issuer           string
	Audience         string
	Conditions       []OIDCCondition
	ServiceAccountID string
	TokenTTLSeconds  int
	Enabled          bool
	CreatedBy        string
	CreatedAt        time.Time
	UpdatedAt        time.Time

	// Discovery is how the issuer's signing keys are found; the zero value
	// means OIDCDiscoveryAnonymous.
	Discovery OIDCDiscovery
	// AllowPrivateIssuer lets the issuer and its jwks_uri resolve to private or
	// loopback addresses (a cluster-internal issuer) whatever the process-wide
	// OPENARTIFACT_ALLOW_PRIVATE_UPSTREAMS says. Only administrators set it.
	AllowPrivateIssuer bool

	// ServiceAccountName and ServiceAccountDisabled are read-only: filled by reads.
	ServiceAccountName     string
	ServiceAccountDisabled bool
}

OIDCTrustPolicy is an administrator's rule for exchanging an ID token of an external issuer (a CI system) for a short-lived token of a service account.

type OSVAdvisory added in v0.14.0

type OSVAdvisory struct {
	ID        string
	Modified  time.Time
	Published *time.Time
	// Withdrawn is set when OSV withdrew the record: it matches nothing.
	Withdrawn *time.Time
	Summary   string
	// Severity is the record's severity array as published.
	Severity json.RawMessage
	// DBSeverity is database_specific.severity, "" when absent.
	DBSeverity string
	CWEIDs     []string
	Refs       []string
	// Aliases are the other ids of the record (CVE, GHSA, ...), without its own id.
	Aliases  []string
	Affected []OSVAffected
}

OSVAdvisory is one record of the local OSV mirror (https://osv.dev, CC-BY 4.0).

type OSVAdvisoryMatch added in v0.14.0

type OSVAdvisoryMatch struct {
	Advisory OSVAdvisory
	Affected []OSVAffected
}

OSVAdvisoryMatch is an advisory with the affected entries that name one package: what a version is matched against.

type OSVAffected added in v0.14.0

type OSVAffected struct {
	Ecosystem string
	Name      string
	// NameNorm is Name normalized for matching.
	NameNorm string
	// Ranges is the JSON array of OSV ranges ([{"type":"SEMVER","events":[...]}]).
	Ranges   json.RawMessage
	Versions []string
}

OSVAffected is one affected package of an advisory: the ranges and explicit versions as OSV publishes them.

type OSVMirrorState added in v0.14.0

type OSVMirrorState struct {
	Ecosystem string
	// HighWater is the largest `modified` imported; nil before the first import.
	HighWater *time.Time
	// ETag and ArchiveModified validate the next download (conditional request).
	ETag            string
	ArchiveModified string
	SourceURL       string
	// Advisories is the number of advisories that affect the ecosystem.
	Advisories         int
	LastCheckedAt      *time.Time
	LastImportedAt     *time.Time
	LastImportSeconds  float64
	LastRematchSeconds float64
	LastError          string
	// RematchPending is set while advisory changes are applied and not yet
	// matched against the stored packages.
	RematchPending bool
	// RematchedAt is when the last completed re-match started; nil before the first.
	RematchedAt *time.Time
}

OSVMirrorState is the import state of one ecosystem of the mirror.

type OSVPackageKey added in v0.14.0

type OSVPackageKey struct {
	Ecosystem string
	NameNorm  string
}

OSVPackageKey identifies an affected package of the mirror.

type PackageDelta

type PackageDelta struct {
	ID           string
	RepositoryID string
	// Source package (the version the client already has)
	FromSHA256   string
	FromFilename string
	// Target package (the version the client wants)
	ToSHA256   string
	ToFilename string
	// The delta blob (stored in BlobStore keyed by DeltaSHA256)
	DeltaSHA256 string
	DeltaSize   int64
	// Format: "deb" or "rpm"
	Format    string
	CreatedAt time.Time
}

PackageDelta represents a pre-computed bsdiff patch between two package versions. Clients that already have the "from" version can download the delta instead of the full package, saving significant bandwidth for incremental updates.

type PackageRollup added in v0.11.0

type PackageRollup struct {
	Format        string
	Name          string
	LatestVersion string
	VersionCount  int
	// SizeBytes is the size of the latest version, all its files summed.
	SizeBytes int64
	// CreatedAt is when the latest version was published; UpdatedAt the latest
	// modification of any version.
	CreatedAt time.Time
	UpdatedAt time.Time
	// LatestIDs are the listing row ids (one per file) of the latest version.
	LatestIDs []string
}

PackageRollup is one package (repository, format, name) across its versions.

type PackageRollupOptions added in v0.11.0

type PackageRollupOptions struct {
	RepoID string
	// RepoFormat is the repository's format; when it names a package table
	// only that table (and the proxy cache) is read.
	RepoFormat string
	// Format, Name (exact) and Query (case-insensitive substring of the name or
	// version) restrict the matched package rows, as in ComponentListOptions.
	Format string
	Name   string
	Query  string
	// Flagged keeps the packages whose latest version has a critical or high
	// vulnerability, a secret finding or a quarantined scan result.
	Flagged bool
	// SortByName orders by name; otherwise the most recently published first.
	SortByName bool
	Page       int
	Limit      int
}

PackageRollupOptions select and order the per-package rollup of one repository.

type PacmanPackage added in v0.13.0

type PacmanPackage struct {
	ID           string
	RepositoryID string
	Name         string
	Base         string
	// Version is "[epoch:]pkgver-pkgrel".
	Version string
	// Arch is the architecture of the package ("any" or a CPU architecture);
	// RepoArch the os/ARCH directory it was uploaded to.
	Arch     string
	RepoArch string
	// Filename is the published file name.
	Filename string

	BlobKey   string
	SizeBytes int64
	SHA256    string
	MD5       string

	Description   string
	URL           string
	Packager      string
	BuildDate     int64
	InstalledSize int64
	Licenses      []string
	Groups        []string
	Replaces      []string
	Conflicts     []string
	Provides      []string
	Depends       []string
	OptDepends    []string
	MakeDepends   []string
	CheckDepends  []string

	// FileList is the newline-separated file list of the files database; nil
	// while it has not been read from the package yet. It is only loaded by the
	// queries that say so.
	FileList *string

	// Signature is the base64 of the binary detached signature, "" when unsigned.
	Signature string
	// SignatureSource is PacmanSigUploader, PacmanSigServer or "".
	SignatureSource string
	// SignatureKey is the fingerprint of the repository key behind a server signature.
	SignatureKey string

	CreatedAt time.Time
	UpdatedAt time.Time
}

PacmanPackage is one package file (.pkg.tar.zst, .xz or .gz) of a pacman repository. A repository database lists the newest version of each Name; older rows stay downloadable until they are deleted.

type PermissionAssignment

type PermissionAssignment struct {
	ID                 string
	PermissionTargetID string
	PrincipalType      string
	PrincipalID        string
	CreatedAt          time.Time
}

type PermissionAssignmentView added in v0.8.1

type PermissionAssignmentView struct {
	PrincipalType string
	PrincipalID   string
	PrincipalName string
}

PermissionAssignmentView is one assignment of a permission target with the principal's display name (username or group name).

type PermissionTarget

type PermissionTarget struct {
	ID               string
	Name             string
	RepositoryFilter string
	PathPattern      string
	Actions          []string
	CreatedAt        time.Time
	UpdatedAt        time.Time
}

type PipelineStage

type PipelineStage struct {
	Name         string `json:"name"`
	RepositoryID string `json:"repo_id"`
	// RequiredChecks names the external checks (BundleCheck) that must all be
	// a live success before a bundle is promoted into the stage.
	RequiredChecks []string `json:"required_checks"`
}

PipelineStage is one element in a PromotionPipeline.Stages slice.

type PresignedUpload added in v0.5.0

type PresignedUpload struct {
	ID           string
	RepositoryID string
	Path         string
	SizeBytes    int64
	SHA256       string
	ContentType  string
	CreatedBy    string
	CreatedAt    time.Time
	// ExpiresAt is the complete deadline: after it the cleanup worker removes
	// the row and the staging object.
	ExpiresAt time.Time
	// CompletingSince is the start of the complete call that currently holds
	// the upload's lease; nil when none does.
	CompletingSince *time.Time
	// CompletedAt is set once the artifact is recorded. ArtifactID is then the
	// id the complete call returned.
	CompletedAt *time.Time
	ArtifactID  string
	// PartSize is the planned size of every part but the last of a multipart
	// upload; 0 for a single-PUT upload.
	PartSize int64
	// MultipartID is the backend's handle of the open multipart upload.
	MultipartID string
}

PresignedUpload is a presigned upload awaiting its complete call. The object lives at the staging key staging/<ID> in the blob store.

type Project added in v0.6.0

type Project struct {
	ID          string
	Name        string
	DisplayName *string
	Description *string
	// OwnerID is the recorded owner; it always counts as an owner member.
	OwnerID *string
	// Slug is the URL-safe unique identifier derived from the name (ProjectSlug).
	Slug string
	// AllowedFormats limits the formats of self-service repositories; nil
	// allows every format.
	AllowedFormats []string
	// AllowedRepoTypes limits the repository types (hosted, proxy, group).
	AllowedRepoTypes []string
	// RepoNamePrefix is the prefix self-service repository names must carry.
	RepoNamePrefix string
	// AllowPublicRepos lets project repositories be anonymously readable.
	AllowPublicRepos bool
	// MaxRepositories caps the repositories of the project; 0 = unlimited.
	MaxRepositories int
	// TokenMaxTTLDays caps the lifetime of project tokens; 0 = no cap.
	TokenMaxTTLDays int
	CreatedAt       time.Time
	UpdatedAt       time.Time
}

Project owns repositories. Members (users and groups) hold a role on them.

type ProjectGrant added in v0.6.0

type ProjectGrant struct {
	ProjectID string
	Role      string
}

ProjectGrant is one role a user holds in a project: a membership row, the project's recorded owner (owner), or a group the user belongs to. A user can hold several grants per project; the highest rank wins.

type ProjectGroup added in v0.6.0

type ProjectGroup struct {
	ProjectID string
	GroupID   string
	GroupName string
	Role      string
	CreatedBy *string
	CreatedAt time.Time
}

ProjectGroup attaches a group to a project with a role (viewer, developer or maintainer).

type ProjectMember added in v0.6.0

type ProjectMember struct {
	ID        string
	ProjectID string
	UserID    string
	Username  string // read-only: filled by reads, ignored on writes
	Role      string // viewer, developer, maintainer, owner
	CreatedAt time.Time
}

ProjectMember is a user's membership row.

type ProjectQuota added in v0.6.0

type ProjectQuota struct {
	ProjectID            string
	MaxSizeBytes         int64
	MaxArtifactCount     int64
	WarnThresholdPercent int
	CurrentSizeBytes     int64
	CurrentArtifactCount int64
	UpdatedAt            time.Time
}

ProjectQuota is the storage ceiling over all repositories of a project (a limit of 0 means unlimited). The Current* counters are only maintained while a limit is set; Usage reports the live sums of the repository counters.

func (*ProjectQuota) Limited added in v0.6.0

func (q *ProjectQuota) Limited() bool

Limited reports whether the ceiling is enforced (a non-zero limit is set).

type ProjectRepoUsage added in v0.6.0

type ProjectRepoUsage struct {
	RepositoryID         string
	Name                 string
	Format               string
	RepoType             string
	SizeBytes            int64
	ArtifactCount        int64
	MaxSizeBytes         int64
	MaxArtifactCount     int64
	WarnThresholdPercent int
}

ProjectRepoUsage is one repository's line in a project usage report.

type ProjectStats added in v0.11.0

type ProjectStats struct {
	MemberCount  int
	SizeBytes    int64
	MaxSizeBytes int64
}

ProjectStats is what the project list shows next to each project: direct members, live usage (the sum of its repositories' counters, trashed ones included, as ProjectUsage) and the size ceiling (0: no quota).

type ProjectUsage added in v0.6.0

type ProjectUsage struct {
	Quota         ProjectQuota
	SizeBytes     int64
	ArtifactCount int64
	Repositories  []ProjectRepoUsage
}

ProjectUsage is the usage of a project: the sum over its repositories plus the ceiling.

type PromotionPipeline

type PromotionPipeline struct {
	ID          string          `db:"id"`
	Name        string          `db:"name"`
	Description string          `db:"description"`
	Stages      []PipelineStage `db:"-"`
	StagesRaw   json.RawMessage `db:"stages"`
	CreatedBy   string          `db:"created_by"`
	CreatedAt   time.Time       `db:"created_at"`
	UpdatedAt   time.Time       `db:"updated_at"`
}

type PromotionStatus

type PromotionStatus string
const (
	PromotionStatusInProgress PromotionStatus = "in_progress"
	PromotionStatusSuccess    PromotionStatus = "success"
	PromotionStatusFailed     PromotionStatus = "failed"
)

type PropertyMatch added in v0.23.0

type PropertyMatch struct {
	ArtifactID string
	Name       *string
	Version    *string
	Format     *string
}

PropertyMatch is one artifact found by a property search.

ArtifactID is the id the properties are stored under. When it is the id of a live file of the same repository (the listing item id the web UI and oa use, package_files.id), Name, Version and Format describe that file's package version; when it is the id of a live docker tag of the same repository (docker_tags.id), they are the image name (repository/image), the tag and "docker", as the package listing shows them; otherwise they are nil.

type ProxyCacheEntry

type ProxyCacheEntry struct {
	ID           string
	RepositoryID string
	CacheKey     string
	BlobKey      string
	ContentType  string
	StatusCode   int
	SizeBytes    int64
	HitCount     int
	LastHitAt    *time.Time
	ExpiresAt    time.Time
	CreatedAt    time.Time
	UpdatedAt    time.Time
}

type ProxyCacheKey added in v0.14.0

type ProxyCacheKey struct {
	ID           string
	RepositoryID string
	CacheKey     string
	CreatedAt    time.Time
}

ProxyCacheKey is a cached upstream file of a proxy repository: the key its package coordinates are derived from.

type PubPackage added in v0.26.0

type PubPackage struct {
	ID           string
	RepositoryID string
	Name         string
	Version      string
	// Filename is the archive file name, "<name>-<version>.tar.gz".
	Filename string

	BlobKey   string
	SizeBytes int64
	SHA256    string

	// Pubspec is the pubspec.yaml of the archive as JSON.
	Pubspec json.RawMessage

	CreatedAt time.Time
	UpdatedAt time.Time
}

PubPackage is one published version of a Dart or Flutter package: the name-version.tar.gz archive and the pubspec.yaml it carries.

type PyPIPackage

type PyPIPackage struct {
	ID             string
	RepositoryID   string
	Name           string
	Version        string
	Filename       string
	PackageType    string
	PythonVersion  string
	RequiresPython string
	Summary        string
	Author         string
	AuthorEmail    string
	License        string
	Keywords       string
	Classifiers    []string
	BlobKey        string
	MD5Digest      string
	SHA256Digest   string
	SizeBytes      int64
	CreatedAt      time.Time
	UpdatedAt      time.Time
}

type QuayNotification added in v0.21.0

type QuayNotification struct {
	ID               string
	QuayRepositoryID string
	Title            string
	Event            string
	Method           string
	Config           json.RawMessage
	EventConfig      json.RawMessage
	CreatedAt        time.Time
}

QuayNotification is a stored repository notification.

type QuayRepository added in v0.21.0

type QuayRepository struct {
	ID           string
	RepositoryID string
	// OrgName is the hosted docker repository's name: the Quay organization.
	OrgName       string
	Name          string // the image path, "<namespace>/<component>"
	Description   string
	ReadTargetID  string
	WriteTargetID string
	CreatedAt     time.Time
}

QuayRepository is one image path a Quay client created inside a hosted docker repository (the Quay organization). The two permission targets scope a principal to that image: read pulls, write pulls and pushes.

type QuayRobot added in v0.21.0

type QuayRobot struct {
	ID           string
	RepositoryID string
	OrgName      string
	Name         string // the short robot name, without the "<org>+" prefix
	Description  string
	UserID       string
	TokenID      string
	// TokenEnc is the robot's token sealed with internal/crypto.
	TokenEnc  string
	CreatedAt time.Time
}

QuayRobot is a Quay robot account: the service account behind it and its sealed token.

type QuayTag added in v0.21.0

type QuayTag struct {
	Name           string
	ManifestDigest string
	UpdatedAt      time.Time
}

QuayTag is one tag of a Quay repository.

type QuayTeam added in v0.21.0

type QuayTeam struct {
	ID           string
	RepositoryID string
	Name         string
	GroupID      string
	CreatedAt    time.Time
}

QuayTeam is a Quay team: the group behind it.

type QuayTeamPermission added in v0.21.0

type QuayTeamPermission struct {
	Repository string
	IsPublic   bool
	Write      bool
}

QuayTeamPermission is a repository a Quay team has access to. IsPublic is the visibility of the organization (hosted docker repository) that holds it.

type QuayUserPermission added in v0.21.0

type QuayUserPermission struct {
	UserID string
	// Username is the account's OpenArtifact username; RobotName is the short
	// Quay robot name, "" for a regular user.
	Username  string
	RobotName string
	Write     bool
}

QuayUserPermission is a user or robot with access to one Quay repository.

type QuotaListParams added in v0.11.0

type QuotaListParams struct {
	// Scope keeps one scope only ("" for both).
	Scope string
	// LimitedOnly keeps only quotas that enforce a limit.
	LimitedOnly bool
	// Query is a case-insensitive substring of the repository or project name.
	Query string
	Page  int
	Limit int
}

QuotaListParams selects a page of the instance-wide quota overview.

type QuotaOverview added in v0.11.0

type QuotaOverview struct {
	Scope                string
	Name                 string
	Project              string // owning project of a repository ("" when none)
	MaxSizeBytes         int64
	MaxArtifactCount     int64
	WarnThresholdPercent int
	UsedBytes            int64
	ArtifactCount        int64
}

QuotaOverview is one line of the instance-wide quota overview: a repository's or a project's limits next to its live usage. A limit of 0 means unlimited.

type RPMRepo

type RPMRepo struct {
	ID            string
	RepositoryID  string
	BaseArch      string
	MetadataStale bool
	CreatedAt     time.Time
	UpdatedAt     time.Time
}

type RawArtifact

type RawArtifact struct {
	ID           string
	RepositoryID string
	Path         string
	ContentType  string
	BlobID       string
	SizeBytes    int64
	SHA256       string
	BlobKey      string
	Metadata     map[string]any
	CreatedAt    time.Time
	UpdatedAt    time.Time
}

RawArtifact is a raw file: a package_files row of a raw package. BlobID is UUID FK to blobs table; SizeBytes is for response display.

type RecentPackage added in v0.11.0

type RecentPackage struct {
	Repository string
	Format     string
	Name       string
	Version    string
	CreatedAt  time.Time
}

RecentPackage is a recently published package version.

type ReleaseBundle

type ReleaseBundle struct {
	ID           string      `db:"id"`
	Name         string      `db:"name"`
	Version      string      `db:"version"`
	Description  string      `db:"description"`
	State        BundleState `db:"state"`
	PipelineID   *string     `db:"pipeline_id"`
	CurrentStage *string     `db:"current_stage"`
	CreatedBy    string      `db:"created_by"`
	// CreatorID is the id of the user who created the bundle; empty when that
	// user was deleted. Ownership is decided on it, never on the username.
	CreatorID    string     `db:"creator_id"`
	SealedAt     *time.Time `db:"sealed_at"`
	SealedBy     *string    `db:"sealed_by"`
	ArchivedAt   *time.Time `db:"archived_at"`
	ArchivedBy   *string    `db:"archived_by"`
	GPGKeyID     *string    `db:"gpg_key_id"`
	GPGSignature *string    `db:"gpg_signature"`
	CreatedAt    time.Time  `db:"created_at"`
	UpdatedAt    time.Time  `db:"updated_at"`
}

func (*ReleaseBundle) IsMutable

func (b *ReleaseBundle) IsMutable() bool

IsMutable returns true only for draft bundles.

type ReleaseBundleItem

type ReleaseBundleItem struct {
	ID           string    `db:"id"`
	BundleID     string    `db:"bundle_id"`
	SourceRepoID string    `db:"source_repo_id"`
	ComponentID  *string   `db:"component_id"`
	SHA256       string    `db:"sha256"`
	ArtifactPath string    `db:"artifact_path"`
	Format       string    `db:"format"`
	SizeBytes    int64     `db:"size_bytes"`
	AddedBy      string    `db:"added_by"`
	AddedAt      time.Time `db:"added_at"`
}

type ReplacedBlob added in v0.20.0

type ReplacedBlob struct {
	SHA256    string
	SizeBytes int64
}

ReplacedBlob is the content of a live file an overwrite replaced: the bytes whose usage the caller gives back.

type RepoMetadata

type RepoMetadata struct {
	ID            string
	RepositoryID  string
	Path          string
	BlobSHA256    string
	BlobSize      int64
	LastGenerated time.Time
}

type RepoQuotaUsage added in v0.11.0

type RepoQuotaUsage struct {
	// LimitBytes is the size quota; 0 means unlimited.
	LimitBytes int64
	UsedBytes  int64
}

RepoQuotaUsage is a repository's storage use against its quota.

type RepoSecurity added in v0.11.0

type RepoSecurity struct {
	SecurityCounts

	Secrets int64
	// LicenseViolations is the number of artifacts whose license scan is
	// quarantined; the server stores no other license violation count.
	LicenseViolations int64
	// Quarantined is the number of quarantined scan results of any type.
	Quarantined int64
	ScannedAt   *time.Time
}

RepoSecurity is the security state of a repository: the vulnerability counts of the latest scan of every artifact summed, the secret findings, the quarantined license results and the time of the latest completed scan.

func (RepoSecurity) Flagged added in v0.11.0

func (s RepoSecurity) Flagged() bool

Flagged reports whether the repository holds anything that needs attention: a critical or high vulnerability, a secret finding or a quarantined result.

type RepoSecuritySummary added in v0.11.0

type RepoSecuritySummary struct {
	// ScannedAt is the latest completed scan; nil when nothing was scanned.
	ScannedAt               *time.Time
	VulnCritical            int
	VulnHigh                int
	VulnMedium              int
	VulnLow                 int
	LicenseViolations       int
	SecretCount             int
	AIQuarantineRecommended int
	AIReviewRequired        int
	// Quarantined counts the results whose quarantine flag is set.
	Quarantined int
}

RepoSecuritySummary is the counts-only security state of a repository, a package or one version: no ids, titles or other finding details.

type RepoStats added in v0.11.0

type RepoStats struct {
	// PackageCount is the number of distinct package names, as the package
	// listing names them.
	PackageCount int64
	// SizeBytes is the stored size, from the quota counter kept up to date on
	// every upload (it equals Quota.UsedBytes).
	SizeBytes       int64
	LastPublishedAt *time.Time
	Security        RepoSecurity
	Quota           RepoQuotaUsage
}

RepoStats are the catalog figures of one repository. Everything but the size and the quota is a stored rollup that lags the data by at most the repo stats reconcile interval.

func (RepoStats) NearQuota added in v0.11.0

func (s RepoStats) NearQuota(threshold float64) bool

NearQuota reports whether the repository has a size quota and has used at least threshold (0..1) of it.

type Repository

type Repository struct {
	ID                      string
	Name                    string
	Format                  string
	Description             string
	Public                  bool
	AllowFullUnpublish      bool
	RepoType                string // "hosted", "proxy", "group"
	UpstreamURL             string // proxy only
	UpstreamUsername        string // proxy only
	UpstreamPasswordEnc     string // proxy only — AES-256-GCM encrypted
	CacheTTLSeconds         int    // proxy only, default 3600
	NegativeCacheTTLSeconds int    // proxy only, default 60
	// MaxStaleSeconds is proxy only: how long past expiry a cached copy may be served when the upstream fails; 0 disables,
	// default 604800.
	MaxStaleSeconds int
	// MinAgeHours is proxy only: a version the upstream published less than
	// this many hours ago is hidden from the metadata and refused on download;
	// 0 disables the gate.
	MinAgeHours int
	// CurationMode is proxy only: "off" (default), "denylist" or "allowlist"
	// (internal/curation); the rules live in curation_rules.
	CurationMode string
	Blocked      bool // proxy only
	ProjectID    *string
	// PresignDownloads overrides storage.presignDownloads for this repository:
	// nil inherits the global setting, true/false force redirect/streaming.
	PresignDownloads *bool
	// TrashRetentionDays is how long deleted items stay restorable; nil uses
	// the server default, 0 deletes immediately (no trash).
	TrashRetentionDays *int
	// ImmutableReleases forbids deleting or overwriting released versions
	// without an admin's force.
	ImmutableReleases bool
	// MergeProxyVersions is a group-only setting. false (the default) makes a
	// hosted member win a package name: proxy members' versions and files of
	// a name any hosted member holds are hidden. true merges all members.
	MergeProxyVersions bool
	// DeployTargetID and DeployTarget (group only) name the hosted member a
	// write sent to the group is served by (Spec.GroupDeploy formats): the id
	// is the column, DeployTarget the name of a live target, "" when there is
	// none or it is in the trash. Writes through the group are 405 without one.
	DeployTargetID *string
	DeployTarget   string
	// SignPackages (hosted rpm only) signs uploaded RPMs with the active GPG key.
	SignPackages bool
	// HonourQuayExpiry (hosted docker only) deletes manifests once the
	// quay.expires-after deadline they declared at push time has passed.
	HonourQuayExpiry bool
	// Federated marks a hosted repository that replicates with peers
	// (see internal/federation). It is set only by federation.Store.Enable.
	Federated bool
	// DeletedAt/DeletedBy are set while the repository is in the trash. Every
	// lookup except the trash API hides such a repository.
	DeletedAt *time.Time
	DeletedBy string
	CreatedAt time.Time
	UpdatedAt time.Time
}

type RepositoryDependencyTrack added in v0.8.0

type RepositoryDependencyTrack struct {
	RepositoryID   string    `json:"repository_id"`
	Enabled        bool      `json:"enabled"`
	BaseURL        string    `json:"base_url"`
	APIKey         string    `json:"-"`
	ProjectName    string    `json:"project_name"`
	ProjectVersion string    `json:"project_version"`
	AutoPush       *bool     `json:"auto_push"`
	PushVEX        *bool     `json:"push_vex"`
	CreatedAt      time.Time `json:"created_at"`
	UpdatedAt      time.Time `json:"updated_at"`
}

RepositoryDependencyTrack is a repository's Dependency-Track override of the global settings. Empty strings and nil booleans inherit the global value; APIKey is stored encrypted.

type RepositoryGroupMember

type RepositoryGroupMember struct {
	GroupRepoID  string
	MemberRepoID string
	Priority     int
	CreatedAt    time.Time
}

type RepositoryUsage added in v0.11.0

type RepositoryUsage struct {
	PackageCount    int64
	VersionCount    int64
	LastPublishedAt *time.Time
}

RepositoryUsage summarises what a repository holds.

type RpmPackage

type RpmPackage struct {
	ID            string
	RepositoryID  string
	BlobID        string
	Name          string
	Version       string
	Release       string
	Epoch         int
	Arch          string
	Summary       string
	Description   string
	License       string
	URL           string
	Vendor        string
	GroupName     string
	Packager      string
	SourceRPM     string
	BuildHost     string
	BuildTime     *time.Time
	Filename      string
	PackageSize   int64
	InstalledSize int64
	ArchiveSize   int64
	CreatedAt     time.Time
	UpdatedAt     time.Time
}

RpmPackage represents an RPM package stored on the generic package tables (package_files and rpm_files).

type RubyGem

type RubyGem struct {
	ID             string
	RepositoryID   string
	Name           string
	Version        string
	Platform       string
	Description    string
	Summary        string
	Homepage       string
	Authors        []string
	Licenses       []string
	Dependencies   []byte // JSON array
	MetadataJSON   []byte
	BlobKey        string
	ChecksumSHA256 string
	Yanked         bool
	DownloadCount  int
	Size           int64 // gem file size in bytes
	CreatedAt      time.Time
	UpdatedAt      time.Time
}

type SAMLConfig

type SAMLConfig struct {
	IDPMetadataURL string `json:"idp_metadata_url"`
	IDPMetadataXML string `json:"idp_metadata_xml"`
	// IDPMetadataRefreshSeconds is how long fetched IdP metadata is reused
	// before it is re-read from IDPMetadataURL (default 3600, minimum 60).
	IDPMetadataRefreshSeconds int    `json:"idp_metadata_refresh_seconds,omitempty"`
	UsernameAttribute         string `json:"username_attribute"`
	EmailAttribute            string `json:"email_attribute"`
	NameAttribute             string `json:"name_attribute"`
	GroupsAttribute           string `json:"groups_attribute"`
	// AllowIDPInitiated accepts unsolicited responses (IdP tiles, Entra My
	// Apps). Off by default: such responses carry no InResponseTo binding.
	AllowIDPInitiated bool `json:"allow_idp_initiated,omitempty"`
}

type SBOMReport

type SBOMReport struct {
	ID           string
	RepositoryID string
	ArtifactID   string
	Format       string // "cyclonedx" or "spdx"
	SpecVersion  string // "1.4" or "2.3"
	ContentType  string
	SBOMData     map[string]any // for JSON SBOMs (cyclonedx); populated by the API layer from the generator, not persisted directly
	SBOMText     string         // for text SBOMs (spdx); ditto
	// BlobSHA256 is the sha256 of the blob store object holding the raw SBOM bytes; "" if not (yet) persisted. Set by the
	// caller before CreateSBOMReport; populated on reads via a JOIN with blobs.
	BlobSHA256 string
	// BlobSizeBytes is the size of that blob; only meaningful together with BlobSHA256, used by CreateSBOMReport to upsert
	// the blobs row.
	BlobSizeBytes  int64
	ComponentCount int
	GeneratedAt    time.Time
	CreatedAt      time.Time
	UpdatedAt      time.Time
}

type SBTArtifact

type SBTArtifact struct {
	ID           string
	RepositoryID string
	GroupID      string
	ArtifactID   string
	Version      string
	ScalaVersion string
	Filename     string
	BlobKey      string
	SizeBytes    int64
	SHA256       string
	CreatedAt    time.Time
	UpdatedAt    time.Time
}

type SSOProvider

type SSOProvider struct {
	ID          string `json:"id,omitempty"`
	Slug        string `json:"slug"`
	Kind        string `json:"kind"`
	DisplayName string `json:"display_name"`
	// Icon is the key an admin picked for the login button; empty means
	// automatic (auth.ResolveSSOIcon).
	Icon               string            `json:"icon,omitempty"`
	Enabled            bool              `json:"enabled"`
	OIDCConfig         json.RawMessage   `json:"oidc_config,omitempty"`
	SAMLConfig         json.RawMessage   `json:"saml_config,omitempty"`
	ClaimMapping       json.RawMessage   `json:"claim_mapping,omitempty"`
	GroupMapping       map[string]string `json:"group_mapping,omitempty"`
	PermissionMapping  map[string]string `json:"permission_mapping,omitempty"`
	AutoProvisionUsers bool              `json:"auto_provision_users"`
	LinkByEmail        bool              `json:"link_by_email"`
	CreatedAt          time.Time         `json:"created_at"`
	UpdatedAt          time.Time         `json:"updated_at"`
}

type SecretFinding

type SecretFinding struct {
	Type          string `json:"type"`
	Description   string `json:"description"`
	Severity      string `json:"severity"` // low, medium, high, critical
	RedactedValue string `json:"redacted_value"`
	LineHint      string `json:"line_hint"`
}

SecretFinding represents a single secret finding in a scan.

type SecretScanResult

type SecretScanResult struct {
	ID           string
	RepositoryID string
	ArtifactID   string
	ScanStatus   string // "pending", "completed", "failed", "clean", "flagged"
	Findings     []SecretFinding
	FindingCount int
	Quarantined  bool
	ScanError    string
	ScannedAt    *time.Time
	CreatedAt    time.Time
	UpdatedAt    time.Time
}

SecretScanResult represents a secret scan result for an artifact.

type SecurityCounts added in v0.11.0

type SecurityCounts struct {
	Critical int64
	High     int64
	Medium   int64
	Low      int64
}

SecurityCounts are vulnerability counts by severity (raw: VEX statements and ignore rules do not suppress any).

type SecurityHealthStats added in v0.11.0

type SecurityHealthStats struct {
	ScansPending          int
	ScansFailed24h        int
	LastScanAt            *time.Time
	UnscannedRepositories int
}

SecurityHealthStats are the instance-wide scan queue and coverage numbers.

type Session

type Session struct {
	ID         string
	UserID     string
	TokenHash  string
	IPAddress  *string
	UserAgent  *string
	ExpiresAt  time.Time
	CreatedAt  time.Time
	LastSeenAt time.Time
}

type SessionSSO added in v0.8.0

type SessionSSO struct {
	ProviderSlug string
	IDToken      string
}

SessionSSO links a session to the SSO provider that created it. IDToken is stored encrypted; it is empty for providers without an ID token.

type StorageBackend

type StorageBackend struct {
	ID            string
	Name          string
	Kind          string // filesystem, s3, gcs, azure
	Config        []byte // JSON: type-specific configuration
	Status        string // ok, degraded, error, unknown
	StatusMessage *string
	LastCheckedAt *time.Time
	CreatedAt     time.Time
	UpdatedAt     time.Time
}

StorageBackend represents a configured storage backend.

type StoragePolicy added in v0.7.0

type StoragePolicy struct {
	ID             string
	Name           string
	Enabled        bool
	Position       int
	TargetTierID   string
	FromTierID     string // "" = any tier
	MinAgeSeconds  *int64
	MinIdleSeconds *int64
	MinSizeBytes   *int64
	MaxSizeBytes   *int64
	RepoGlob       string
	Formats        []string
	PathGlob       string
	CreatedAt      time.Time
	UpdatedAt      time.Time
}

StoragePolicy is one ordered lifecycle rule: the first enabled policy whose conditions match a blob names the tier the blob belongs on. Unset (nil / "" / empty) conditions match everything.

type StorageQuota

type StorageQuota struct {
	ID                   string
	RepositoryID         string
	MaxSizeBytes         int64
	MaxArtifactCount     int
	WarnThresholdPercent int
	CurrentSizeBytes     int64
	CurrentArtifactCount int
	CreatedAt            time.Time
	UpdatedAt            time.Time
}

func (*StorageQuota) IsExceeded

func (q *StorageQuota) IsExceeded() bool

func (*StorageQuota) UsagePercent

func (q *StorageQuota) UsagePercent() float64

type StorageTier added in v0.7.0

type StorageTier struct {
	ID            string
	Name          string
	BackendID     string
	BackendName   string
	BackendKind   string
	BackendStatus string
	Rank          int
	PromoteOnRead bool
	CreatedAt     time.Time
	UpdatedAt     time.Time
}

StorageTier is a named placement target. BackendID "" is the primary store the server is configured with; every other tier maps to a storage backend.

type StorageTierMove added in v0.7.0

type StorageTierMove struct {
	SHA256        string
	FromBackendID string
	ToBackendID   string
	State         string
	Reason        string
	SizeBytes     int64
	Attempts      int
	LastError     string
	CreatedAt     time.Time
	UpdatedAt     time.Time
}

StorageTierMove is a row of the mover's crash-recovery journal. Backend ids are "" for the primary store.

type StoredPackage added in v0.14.0

type StoredPackage struct {
	RepositoryID string
	// ArtifactID is the row id the version is scanned under (the package
	// listing's id; the lowest one when a version has several files).
	ArtifactID string
	Name       string
	Version    string
	// AddedAt is when the newest row of the version was stored.
	AddedAt time.Time
}

StoredPackage is a package version held by a repository (hosted rows or the proxy cache): what a re-match evaluates.

type StoredVersion added in v0.24.0

type StoredVersion struct {
	VersionHolds

	Index  int
	RepoID string
}

StoredVersion is a live version of the package version Index of a batch lookup names, stored in hosted repository RepoID, with its holds.

type SwiftManifest added in v0.26.0

type SwiftManifest struct {
	Filename     string `json:"filename"`
	SwiftVersion string `json:"swiftVersion,omitempty"` //nolint:tagliatelle // same names as the registry documents
	ToolsVersion string `json:"toolsVersion,omitempty"` //nolint:tagliatelle // same names as the registry documents
	Content      string `json:"content"`
}

SwiftManifest is a manifest extracted from a release's source archive.

type SwiftRelease added in v0.26.0

type SwiftRelease struct {
	ID           string
	RepositoryID string
	// Scope and Name are the identity as first published; lookups ignore case.
	Scope   string
	Name    string
	Version string
	// Filename is the archive file name, "<name>-<version>.zip".
	Filename string

	BlobKey   string
	SizeBytes int64
	// SHA256 is the lower-case hexadecimal SHA-256 of the archive, the checksum
	// SwiftPM verifies.
	SHA256 string

	// Metadata is the metadata JSON object the release was published with.
	Metadata json.RawMessage
	// RepositoryURLs are the declared repository URLs in normalized form.
	RepositoryURLs []string
	// Manifests are Package.swift (first) and the version-specific manifests.
	Manifests []SwiftManifest
	// SignatureFormat, Signature and MetadataSignature are the base64 signatures
	// the publisher sent; the server stores them and does not verify them.
	SignatureFormat   string
	Signature         string
	MetadataSignature string

	CreatedAt time.Time
	UpdatedAt time.Time
}

SwiftRelease is one published release of a Swift package: the source archive and what the publisher declared about it.

type SwiftReleaseVersion added in v0.26.0

type SwiftReleaseVersion struct {
	Version   string
	CreatedAt time.Time
}

SwiftReleaseVersion is a release in the version list of a package.

type TerraformModule added in v0.13.0

type TerraformModule struct {
	ID           string
	RepositoryID string
	Name         string
	System       string
	Version      string
	// ArchiveExt is the stored archive kind, "zip" or "tar.gz".
	ArchiveExt string
	BlobKey    string
	// Checksum is the lowercase hex SHA-256 of the archive.
	Checksum      string
	SizeBytes     int64
	DownloadCount int64
	CreatedAt     time.Time
	UpdatedAt     time.Time
}

TerraformModule is one published version of a Terraform/OpenTofu module. The registry namespace of a module is the name of its repository, so a module is addressed as REPO/Name/System.

type TerraformProvider added in v0.13.0

type TerraformProvider struct {
	ID           string
	RepositoryID string
	Type         string
	Version      string
	OS           string
	Arch         string
	// Protocols are the plugin protocol versions the provider speaks ("5.0",
	// "6.0"); the same for every platform of a version.
	Protocols []string
	BlobKey   string
	// Checksum is the lowercase hex SHA-256 of the zip, the value of its line in
	// the version's SHA256SUMS file.
	Checksum      string
	SizeBytes     int64
	DownloadCount int64
	CreatedAt     time.Time
	UpdatedAt     time.Time
}

TerraformProvider is one platform zip of a provider version, addressed as REPO/Type with Version, OS and Arch.

type TierScanClause added in v0.7.0

type TierScanClause struct {
	TargetBackendID string
	// FromBackend restricts the source placement when HasFrom is set.
	HasFrom       bool
	FromBackendID string
	CreatedBefore *time.Time // created_at <= value
	IdleBefore    *time.Time // COALESCE(last_accessed_at, created_at) <= value
	MinSizeBytes  *int64
	MaxSizeBytes  *int64
}

TierScanClause is the SQL-expressible part of one policy: a blob is a candidate for it when every set bound holds and it is not already on TargetBackendID. The exact policy semantics (repository, format and path conditions, first match wins) are evaluated in Go on the returned page.

type TierUsage added in v0.7.0

type TierUsage struct {
	BackendID string
	Blobs     int64
	Bytes     int64
}

TierUsage is the blob count and byte total placed on one backend ("" = primary store).

type Token

type Token struct {
	ID         string
	UserID     string
	Name       string
	Kind       string
	TokenHash  string
	Scopes     []string
	ExpiresAt  *time.Time
	LastUsedAt *time.Time
	CreatedAt  time.Time
	RevokedAt  *time.Time

	// Project tokens (service accounts): the project, the user who minted the
	// token and its role (viewer or developer). All nil for personal tokens.
	ProjectID   *string
	CreatedBy   *string
	ProjectRole *string
	// ProjectName and CreatedByName are read-only: filled by reads.
	ProjectName   string
	CreatedByName string
}

type TokenListItem added in v0.11.0

type TokenListItem struct {
	ID         string
	Type       string
	Name       string
	Owner      string
	Project    string
	Repository string
	Role       string
	Scopes     []string
	CreatedAt  time.Time
	ExpiresAt  *time.Time
	LastUsedAt *time.Time
}

TokenListItem is one row of the unified token list. It never carries the token hash.

type TokenListParams added in v0.11.0

type TokenListParams struct {
	// Types keeps only these kinds (empty: all three).
	Types []string
	// ExpiresBefore keeps only tokens that carry an expiry earlier than it
	// (already expired ones included; tokens without an expiry never match).
	ExpiresBefore *time.Time
	// Query is a case-insensitive substring of the token name or owner.
	Query string
	// Project keeps only the tokens of the project with this name: its project
	// tokens and the federation tokens of its repositories (empty: any).
	Project string
	// Admin lists every token. Otherwise the viewer's own personal tokens plus
	// the project and federation tokens of ProjectIDs are listed.
	Admin      bool
	ViewerID   string
	ProjectIDs []string
	Page       int
	Limit      int
}

TokenListParams selects a page of the unified token list. Visibility is part of the query: it is never filtered after the fact, so Total stays exact.

type TrashFilter added in v0.5.0

type TrashFilter struct {
	// RepositoryID restricts the listing to one repository (its trashed items;
	// the repository itself is never listed in a per-repository view).
	RepositoryID string
	// Kind, when non-empty, restricts the listing to one kind.
	Kind TrashKind
	// IncludeRepositories adds trashed repositories to the listing (global,
	// admin-only view).
	IncludeRepositories bool
	Page                int
	Limit               int
}

TrashFilter selects trash listing rows.

type TrashItem added in v0.5.0

type TrashItem struct {
	// ID is the primary key of the trashed row (the repository id for
	// TrashKindRepository). Together with Kind it addresses the item.
	ID   string
	Kind TrashKind
	// RepositoryID/RepositoryName identify the owning repository (the trashed
	// repository itself for TrashKindRepository).
	RepositoryID   string
	RepositoryName string
	Format         string
	// Name is the human-readable identity of the item: package name, file
	// path, image:tag, or the repository name.
	Name string
	// Version is empty for kinds without a version (raw files, repositories).
	Version   string
	SizeBytes int64
	DeletedAt time.Time
	DeletedBy string
	// PurgeAt is when the purge worker removes the item
	// (DeletedAt + the repository's effective retention).
	PurgeAt time.Time
}

TrashItem is one entry of the trash listing: a soft-deleted repository or package row.

type TrashKind added in v0.5.0

type TrashKind string

TrashKind names a kind of soft-deletable row. The value is the stable identifier used in the trash API (/api/v1/trash/{kind}/{id}) and in audit details. The kind of a package format is its storage.Trash.Kind descriptor value (one per format); only docker keeps two kinds of its own.

const (
	// TrashKindRepository is a whole repository (repositories.deleted_at).
	TrashKindRepository TrashKind = "repository"

	TrashKindMaven             TrashKind = "maven_artifact"
	TrashKindIvy               TrashKind = "ivy_artifact"
	TrashKindSBT               TrashKind = "sbt_artifact"
	TrashKindNPM               TrashKind = "npm_version"
	TrashKindPyPI              TrashKind = "pypi_package"
	TrashKindNuGet             TrashKind = "nuget_package"
	TrashKindGoMod             TrashKind = "go_module"
	TrashKindCargo             TrashKind = "cargo_crate"
	TrashKindComposer          TrashKind = "composer"
	TrashKindRubyGems          TrashKind = "rubygems_gem"
	TrashKindConda             TrashKind = "conda_package"
	TrashKindPacman            TrashKind = "pacman"
	TrashKindAnsible           TrashKind = "ansible"
	TrashKindPub               TrashKind = "pub"
	TrashKindConan             TrashKind = "conan_package"
	TrashKindTerraformModule   TrashKind = "terraform_module"
	TrashKindTerraformProvider TrashKind = "terraform_provider"
	TrashKindNix               TrashKind = "nix_path"
	TrashKindApk               TrashKind = "apk_package"
	TrashKindHelm              TrashKind = "helm_chart"
	TrashKindRaw               TrashKind = "raw_artifact"
	TrashKindDockerManifest    TrashKind = "docker_manifest"
	TrashKindDockerTag         TrashKind = "docker_tag"
	TrashKindRPM               TrashKind = "rpm_package"
	TrashKindDeb               TrashKind = "deb_package"
	TrashKindGitLFS            TrashKind = "gitlfs_object"
	TrashKindCRAN              TrashKind = "cran_package"
	TrashKindSwift             TrashKind = "swift_release"
)

type TrashPurgeResult added in v0.5.0

type TrashPurgeResult struct {
	Kind           TrashKind
	ID             string
	RepositoryID   string
	RepositoryName string
	Format         string
	Name           string
	Version        string
	SizeBytes      int64
	// BlobSHA256 lists every blob the purged rows referenced; the caller frees
	// them with storage.SafeDeleteBlob (which keeps blobs still referenced
	// elsewhere).
	BlobSHA256 []string
	// MetadataBlobSHA256 lists the generated-metadata blobs (repodata, dists,
	// maven-metadata.xml) of a purged repository. They have no blobs row, so
	// the caller frees them with storage.ReclaimMetadataBlob.
	MetadataBlobSHA256 []string
	// QuotaArtifacts is the number of quota-counted package rows removed
	// (0 for formats that do not enforce quotas); QuotaBytes their size.
	QuotaArtifacts int
	QuotaBytes     int64
}

TrashPurgeResult describes a purged item so the caller can free blobs, release quota and report the event.

type TrashRef added in v0.5.0

type TrashRef struct {
	Kind TrashKind
	ID   string
}

TrashRef identifies one expired item for the purge worker.

type User

type User struct {
	ID                 string
	Username           string
	Email              *string
	PasswordHash       *string
	FullName           *string
	Disabled           bool
	MustChangePassword bool
	LastLoginAt        *time.Time
	CreatedAt          time.Time
	UpdatedAt          time.Time
	ExternalID         *string
	ProviderSlug       *string
	SSOManagedGroups   bool
	// Kind is UserKindHuman, UserKindService or UserKindServiceAccount. A
	// service user is the account behind one project token: no password, no
	// login, one project. A service account is an administrator-managed
	// non-human principal: no password, no login, no project.
	Kind string
	// ProjectID is the service user's project (nil for humans).
	ProjectID *string
}

func (*User) IsHuman added in v0.16.0

func (u *User) IsHuman() bool

IsHuman reports whether the user is a person (the kind of every row that is neither a project-token account nor a service account): the only kind that has a password, a session and a place in the users API.

func (*User) IsService added in v0.6.0

func (u *User) IsService() bool

IsService reports whether the user is the account behind a project token.

func (*User) IsServiceAccount added in v0.16.0

func (u *User) IsServiceAccount() bool

IsServiceAccount reports whether the user is an administrator-managed service account.

type UserGroup

type UserGroup struct {
	UserID  string
	GroupID string
	// SSOManaged marks memberships an SSO login derives from IdP claims.
	SSOManaged bool
}

type VEXFeed added in v0.22.0

type VEXFeed struct {
	ID               string
	Name             string
	URL              string
	Enabled          bool
	RequireSignature bool
	PGPKeys          string // armored OpenPGP public keys pinned for the feed
	IntervalHours    int
	CursorAt         *time.Time
	LastAttemptAt    *time.Time
	LastSuccessAt    *time.Time
	LastError        string
	DocumentsTotal   int
	RejectedTotal    int
	// StatementCount and AppliedCount are read-only: the rows of the feed in
	// vex_feed_statements and in vex_statements.
	StatementCount int
	AppliedCount   int
	CreatedAt      time.Time
	UpdatedAt      time.Time
}

VEXFeed is a vendor CSAF 2.0 VEX provider and its import state.

type VEXFeedStatement added in v0.22.0

type VEXFeedStatement struct {
	DocumentURL     string
	TrackingID      string
	VulnID          string
	PURL            string
	CPE             string
	Status          string
	Justification   string
	ImpactStatement string
	ActionStatement string
	ReleasedAt      *time.Time
}

VEXFeedStatement is one not_affected / fixed statement of an imported CSAF document for one product, identified by a normalized PURL or else a CPE.

type VEXFeedSyncResult added in v0.22.0

type VEXFeedSyncResult struct {
	Success bool
	// Error is a client-safe summary; "" on a clean run.
	Error string
	// CursorAt is the new cursor; nil keeps the current one.
	CursorAt  *time.Time
	Documents int
	Rejected  int
}

VEXFeedSyncResult is the outcome of one sync of a feed.

type VEXStatement added in v0.7.0

type VEXStatement struct {
	ID              string    `json:"id"`
	RepositoryID    string    `json:"repository_id"`
	ArtifactID      string    `json:"artifact_id"`
	VulnID          string    `json:"vuln_id"`
	Status          string    `json:"status"`
	Justification   string    `json:"justification"`
	ImpactStatement string    `json:"impact_statement"`
	ActionStatement string    `json:"action_statement"`
	CreatedBy       string    `json:"created_by"`
	CreatedAt       time.Time `json:"created_at"`
	UpdatedAt       time.Time `json:"updated_at"`
	// SourceKind is VEXSourceLocal, VEXSourceCSAF or VEXSourcePeer; empty is
	// stored as local.
	SourceKind string `json:"source_kind"`
	// SourceName is the feed or peer name; empty for local.
	SourceName string `json:"source_name"`
	// SourceRef is the CSAF document URL (csaf) or the peer base URL (peer).
	SourceRef string `json:"source_ref"`
	// FeedID and PeerID are the feed / peer the statement came from, "" when none.
	FeedID string `json:"feed_id,omitempty"`
	PeerID string `json:"peer_id,omitempty"`
}

VEXStatement is a decision about one vulnerability in one artifact: an operator's (local), a vendor feed's (csaf) or a federated peer's (peer).

type VEXSuggestion added in v0.22.0

type VEXSuggestion struct {
	ID              string
	RepositoryID    string
	PeerID          string
	PeerName        string
	PeerBaseURL     string
	ArtifactID      string
	VulnID          string
	Status          string
	Justification   string
	ImpactStatement string
	ActionStatement string
	PeerUpdatedAt   *time.Time
	State           string
	DecidedBy       string
	DecidedAt       *time.Time
	CreatedAt       time.Time
	UpdatedAt       time.Time
	// LocalStatus and LocalSourceKind describe the vex_statements row of the
	// same (repository, artifact, vulnerability), "" when none (read-only).
	LocalStatus     string
	LocalSourceKind string
}

VEXSuggestion is a federated peer's VEX decision about an artifact of the pulling repository, advisory until accepted or dismissed.

type VEXTarget added in v0.22.0

type VEXTarget struct {
	RepositoryID     string
	RepositoryFormat string
	ArtifactID       string
	Vulns            []Vulnerability
}

VEXTarget is the latest completed or partial vulnerability scan, with findings, of one artifact.

type VersionHolds added in v0.16.0

type VersionHolds struct {
	Quarantined    bool
	LicenseBlocked bool
}

VersionHolds reports which scan-based holds apply to the stored files of one package version: Quarantined by a vulnerability or secret scan result, LicenseBlocked by a license scan result the repository's license policy flagged.

type VulnExploitAggregate added in v0.14.0

type VulnExploitAggregate struct {
	ResultID string
	KEVCount int
	// MaxEPSS is nil when no finding of the result has a score.
	MaxEPSS *float64
}

VulnExploitAggregate is the recomputed kev_count and max_epss of a result.

type VulnExploitCandidate added in v0.14.0

type VulnExploitCandidate struct {
	ResultID        string
	Vulnerabilities []Vulnerability
}

VulnExploitCandidate is a stored vulnerability result whose exploitation aggregates are recomputed.

type VulnScanCursor added in v0.7.0

type VulnScanCursor struct {
	// Rank is the priority rank (6..0) of the scan; only the priority sort uses it.
	Rank          int
	CriticalCount int
	HighCount     int
	MediumCount   int
	LowCount      int
	// SortAt is the scan's completion time, or its creation time while it has
	// none.
	SortAt time.Time
	ID     string
}

VulnScanCursor is a keyset position in the overview order (critical_count DESC, high_count DESC, medium_count DESC, low_count DESC, SortAt DESC, id ASC), or, for the priority sort, the same keys led by the priority Rank DESC.

type VulnScanListParams added in v0.7.0

type VulnScanListParams struct {
	// Repo is a repository name.
	Repo string
	// Severity keeps scans with at least one finding of that severity or worse:
	// critical, high, medium or low.
	Severity string
	// Status is completed, partial, failed or scanning.
	Status string
	// Scanner is osv, trivy or grype; a scan run by several matches each.
	Scanner string
	// Quarantined, when set, keeps scans whose quarantine flag equals it.
	Quarantined *bool
	// Sort is "" or "severity" (worst severity counts first) or "priority"
	// (priority rank first, then the severity order).
	Sort string
	// KEV, when set, keeps scans with (true) or without (false) a finding in
	// the CISA KEV catalog.
	KEV *bool
	// EPSSMin, when set, keeps scans whose highest EPSS score is at least it.
	EPSSMin *float64
	// Priority, when set (kev, epss, critical, high, medium or low), keeps
	// scans whose priority rank equals that of the named priority.
	Priority string
	// EPSSThreshold is the EPSS score from which a scan ranks as "epss"; the
	// priority sort and filter use it.
	EPSSThreshold float64
	Limit         int
	// After, when set, returns only scans strictly after this position.
	After *VulnScanCursor
}

VulnScanListParams selects a page of the cross-repository scan overview. Empty filters match everything.

type VulnScanOverviewPage added in v0.7.0

type VulnScanOverviewPage struct {
	Scans []*VulnScanOverviewRow
	// Next is the position of the last scan when more follow, nil on the last
	// page.
	Next *VulnScanCursor
}

VulnScanOverviewPage is one page of the overview.

type VulnScanOverviewRow added in v0.7.0

type VulnScanOverviewRow struct {
	VulnScanResult

	RepositoryName   string
	RepositoryFormat string
	// SortAt is the row's keyset time (see VulnScanCursor).
	SortAt time.Time
}

VulnScanOverviewRow is a scan result without its findings, with the repository it belongs to.

type VulnScanResult

type VulnScanResult struct {
	ID              string
	RepositoryID    string
	ArtifactID      string
	PackageName     string
	PackageVersion  string
	Ecosystem       string
	Scanner         string // "osv", "trivy", "grype", or several joined by "," (sorted)
	ScanStatus      string // "pending", "scanning", "completed", "partial", "failed"
	Vulnerabilities []Vulnerability
	VulnCount       int
	CriticalCount   int
	HighCount       int
	MediumCount     int
	LowCount        int
	Quarantined     bool
	ScanError       string // sanitized: never contains raw scanner or upstream error text
	FailedScanners  []string
	// KEVCount is the number of findings whose CVE is in the CISA KEV catalog
	// and MaxEPSS the highest EPSS score among them (nil: none scored), as of
	// the last scan or feed import.
	KEVCount  int
	MaxEPSS   *float64
	ScannedAt *time.Time
	CreatedAt time.Time
	UpdatedAt time.Time
}

VulnScanResult represents a vulnerability scan result for an artifact.

type VulnScanSummary added in v0.7.0

type VulnScanSummary struct {
	Total       int
	Completed   int
	Partial     int
	Failed      int
	Scanning    int
	Quarantined int
	// With<Severity> counts scans that have at least one finding of that
	// severity or worse (the Severity filter's meaning).
	WithCritical int
	WithHigh     int
	WithMedium   int
	WithLow      int
}

VulnScanSummary counts the scans of the overview.

type Vulnerability

type Vulnerability struct {
	ID          string   `json:"id"` // CVE-2021-1234 or GHSA-xxxx
	Summary     string   `json:"summary"`
	Severity    string   `json:"severity"` // CRITICAL, HIGH, MEDIUM, LOW, UNKNOWN
	CVSS        float64  `json:"cvss"`
	FixedIn     string   `json:"fixed_in"` // version that fixes it
	References  []string `json:"references"`
	PublishedAt string   `json:"published_at"`
	// CWEs are the weakness ids ("CWE-79") the scanner reported; empty when it gave none.
	CWEs []string `json:"cwes,omitempty"`
	// Aliases are the other ids the scanner knows the vulnerability by (a GHSA
	// id lists its CVE); the exploitation feeds are keyed by CVE id.
	Aliases []string `json:"aliases,omitempty"`
	// Package is the affected package ("name@version") of a finding in a scan
	// of a container image, which covers many packages; empty in the scan of one
	// package.
	Package string `json:"package,omitempty"`
}

Vulnerability represents a single vulnerability finding.

type Webhook

type Webhook struct {
	ID             string    `json:"id"`
	RepositoryID   string    `json:"repository_id"` // empty = global
	Name           string    `json:"name"`
	URL            string    `json:"url"`
	SecretEnc      string    `json:"-"` // AES-256-GCM encrypted HMAC signing secret (internal/crypto); never serialised
	Enabled        bool      `json:"enabled"`
	Events         []string  `json:"events"` // ["artifact.uploaded", "artifact.deleted", ...]
	ContentType    string    `json:"content_type"`
	PayloadFormat  string    `json:"payload_format"` // one of the PayloadFormat* constants; empty (older backups) means openartifact
	SSLVerify      bool      `json:"ssl_verify"`
	MaxRetries     int       `json:"max_retries"`
	TimeoutSeconds int       `json:"timeout_seconds"`
	CreatedAt      time.Time `json:"created_at"`
	UpdatedAt      time.Time `json:"updated_at"`
}

type WebhookDelivery

type WebhookDelivery struct {
	ID             string         `json:"id"`
	WebhookID      string         `json:"webhook_id"`
	EventType      string         `json:"event_type"`
	Payload        map[string]any `json:"payload"`
	Status         string         `json:"status"` // "pending", "success", "failed"
	ResponseStatus int            `json:"response_status"`
	ResponseBody   string         `json:"response_body"`
	AttemptCount   int            `json:"attempt_count"`
	NextRetryAt    *time.Time     `json:"next_retry_at"`
	DeliveredAt    *time.Time     `json:"delivered_at"`
	CreatedAt      time.Time      `json:"created_at"`
	UpdatedAt      time.Time      `json:"updated_at"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL