Documentation
¶
Index ¶
- Constants
- func RepositoryToResponse(r *models.Repository) responses.RepositoryResponse
- func ValidateAIArtifactIdentity(format, name, version string) string
- type AIHandler
- type AdminAIHandler
- type AdminAuditHandler
- type AdminDeclarativeHandler
- type AdminGPGHandler
- type AdminGroupsHandler
- type AdminPermissionsHandler
- type AdminRecoveryHandler
- type AdminReplicationHandler
- type AdminSSOHandler
- type AdminStorageHandler
- type AdminTieringHandler
- type AdminTokensHandler
- type AdminUsersHandler
- type ApkKeyHandler
- type AttestationAttachHandler
- type AttestationAttacher
- func (a *AttestationAttacher) AttachSBOM(ctx context.Context, repo *models.Repository, report *models.SBOMReport, ...) (*responses.AttestationAttachResponse, error)
- func (a *AttestationAttacher) AttachVEX(ctx context.Context, repo *models.Repository, artifactID, format string) (*responses.AttestationAttachResponse, error)
- func (a *AttestationAttacher) Enabled(ctx context.Context, repo *models.Repository) bool
- func (a *AttestationAttacher) OnSBOMGenerated(ctx context.Context, repo *models.Repository, report *models.SBOMReport, ...)
- func (a *AttestationAttacher) OnScan(ctx context.Context, repoID, artifactID string)
- type AttestationHandler
- type AuthHandler
- type BackupHandler
- type BrandingHandler
- type BundleKeyResolver
- type BundlesHandler
- type CleanupHandler
- type CleanupRunner
- type CompletePresignedUploadResponse
- type CreatePresignedUploadRequest
- type CreatePresignedUploadResponse
- type DTrackPusher
- type DTrackSources
- type DebUploadHandler
- type DeltaHandler
- type DependencyTrackHandler
- type DockerGCHandler
- type DockerGCRunner
- type ErrorResponse
- type FederationDeferredResponse
- type FederationHandler
- type FederationPeerResponse
- type FederationStatusResponse
- type FederationTokenCreatedResponse
- type FederationTokenResponse
- type GroupMetadataNotifier
- type HTTPServer
- func (s *HTTPServer) AddMiddleware(middleware func(http.Handler) http.Handler)
- func (s *HTTPServer) DisableKeepAlives()
- func (s *HTTPServer) EnableTLS(certFile, keyFile string)
- func (s *HTTPServer) GetRouter() chi.Router
- func (s *HTTPServer) ServeErrors() <-chan error
- func (s *HTTPServer) SetTimeouts(readTimeout, writeTimeout, readHeaderTimeout time.Duration)
- func (s *HTTPServer) Start(ctx context.Context) error
- func (s *HTTPServer) Stop(ctx context.Context) error
- type LicenseHandler
- type MavenUploadHandler
- type NPMUploadHandler
- func (h *NPMUploadHandler) HandlePublish(w http.ResponseWriter, r *http.Request)
- func (h *NPMUploadHandler) Register(router chi.Router)
- func (h *NPMUploadHandler) RegisterRepoRoutes(r chi.Router)
- func (h *NPMUploadHandler) SetNPMWorker(w *worker.NPMMetadataWorker)
- func (h *NPMUploadHandler) SetPublisher(p webhook.Publisher)
- type NixKeyHandler
- type OIDCHandler
- type OpenAPIHandler
- type PackageDeleter
- type PresignedPart
- type PresignedPartsRequest
- type PresignedPartsResponse
- type PresignedUploadHandler
- type ProjectCleanupPreviewer
- type ProjectsHandler
- type PropertiesHandler
- type QuotasHandler
- type RPMUploadHandler
- func (h *RPMUploadHandler) Register(router chi.Router)
- func (h *RPMUploadHandler) SetDebWorker(w *worker.DebMetadataWorker)
- func (h *RPMUploadHandler) SetKeyResolver(r gpg.Resolver)
- func (h *RPMUploadHandler) SetPackageDeleter(d PackageDeleter)
- func (h *RPMUploadHandler) SetPublisher(p webhook.Publisher)
- func (h *RPMUploadHandler) SetRPMWorker(w *worker.RPMetadataWorker)
- type RecoveryStatusSource
- type ReferrerRegistry
- type ReplicationService
- type RepositoriesHandler
- func (h *RepositoriesHandler) RegisterAuthed(r chi.Router)
- func (h *RepositoriesHandler) WithBlobStore(store storage.BlobStore) *RepositoriesHandler
- func (h *RepositoriesHandler) WithFederation(store *federation.Store) *RepositoriesHandler
- func (h *RepositoriesHandler) WithGroupMetadata(n GroupMetadataNotifier) *RepositoriesHandler
- func (h *RepositoriesHandler) WithPublisher(p webhook.Publisher) *RepositoriesHandler
- func (h *RepositoriesHandler) WithTasks(tasks *bgtask.Runner) *RepositoriesHandler
- type RepositoryActivityHandler
- type Response
- type SAMLHandler
- type SBOMHandler
- type SecretsHandler
- type SecurityHandler
- type SelfTokensHandler
- type SystemInfoHandler
- func (h *SystemInfoHandler) RegisterAuthed(r chi.Router)
- func (h *SystemInfoHandler) RegisterPublic(r chi.Router)
- func (h *SystemInfoHandler) ServeHTTP(w http.ResponseWriter, _ *http.Request)
- func (h *SystemInfoHandler) WithAPIReference(enabled bool) *SystemInfoHandler
- func (h *SystemInfoHandler) WithDocsBaseURL(base string) *SystemInfoHandler
- type TierPlanner
- type TierRegistry
- type TierRunner
- type TieringAdminDB
- type TrashHandler
- func (h *TrashHandler) RegisterAuthed(r chi.Router)
- func (h *TrashHandler) WithBlobStore(store storage.BlobStore) *TrashHandler
- func (h *TrashHandler) WithGroupMetadata(n GroupMetadataNotifier) *TrashHandler
- func (h *TrashHandler) WithPublisher(p webhook.Publisher) *TrashHandler
- func (h *TrashHandler) WithRegenerator(r TrashRegenerator) *TrashHandler
- func (h *TrashHandler) WithTasks(tasks *bgtask.Runner) *TrashHandler
- type TrashRegenerator
- type VEXHandler
- type VulnHandler
- func (h *VulnHandler) RegisterOverviewRoutes(authedRouter chi.Router)
- func (h *VulnHandler) RegisterRoutes(authedRouter chi.Router, pathPrefix string)
- func (h *VulnHandler) WithExploit(e *exploit.Enricher) *VulnHandler
- func (h *VulnHandler) WithOSVMirror(cfg config.OSVMirrorConfig) *VulnHandler
- func (h *VulnHandler) WithScanHook(f func(repoID, artifactID string)) *VulnHandler
- func (h *VulnHandler) WithTasks(tasks *bgtask.Runner) *VulnHandler
- type WebhooksHandler
Constants ¶
const AttestationKeyPath = "/.well-known/openartifact/attestation-key.pem"
AttestationKeyPath is where the public key verifying the attestations is served, unauthenticated.
const MaxMavenUploadBytes int64 = 1 << 30 // 1 GiB
const MaxNPMUploadBytes int64 = 200 << 20
Variables ¶
This section is empty.
Functions ¶
func RepositoryToResponse ¶ added in v0.3.0
func RepositoryToResponse(r *models.Repository) responses.RepositoryResponse
RepositoryToResponse converts a repository to its public API shape. It never includes upstream credentials; the MCP server reuses it.
func ValidateAIArtifactIdentity ¶ added in v0.6.0
ValidateAIArtifactIdentity checks the artifact_format, artifact_name and artifact_version a caller supplies when triggering an analysis (REST and MCP share it) and returns a message for the first problem, "" when acceptable. The format is one of the repository formats, which are also the ids package listings report.
Types ¶
type AIHandler ¶
type AIHandler struct {
// contains filtered or unexported fields
}
AIHandler handles AI analysis REST endpoints.
type AdminAIHandler ¶
type AdminAIHandler struct {
// contains filtered or unexported fields
}
func NewAdminAIHandler ¶
func (*AdminAIHandler) Register ¶
func (h *AdminAIHandler) Register(r chi.Router)
func (*AdminAIHandler) WithRuntime ¶ added in v0.6.0
func (h *AdminAIHandler) WithRuntime(w *worker.AIAnalysisWorker, env ai.Settings) *AdminAIHandler
WithRuntime makes configuration changes take effect immediately: after every saved change the worker's client and auto-analysis switch are rebuilt from the stored settings layered over env (the env/YAML defaults).
type AdminAuditHandler ¶
type AdminAuditHandler struct {
// contains filtered or unexported fields
}
func NewAdminAuditHandler ¶
func (*AdminAuditHandler) Register ¶
func (h *AdminAuditHandler) Register(r chi.Router)
type AdminDeclarativeHandler ¶ added in v0.8.1
type AdminDeclarativeHandler struct {
// contains filtered or unexported fields
}
AdminDeclarativeHandler stores the ownership markers of `oa apply`: which objects it created or adopted, so --prune only deletes managed objects.
Markers are deliberately not part of backups: a restored instance has none, so prune touches nothing until the next apply re-adopts the objects.
func NewAdminDeclarativeHandler ¶ added in v0.8.1
func (*AdminDeclarativeHandler) Register ¶ added in v0.8.1
func (h *AdminDeclarativeHandler) Register(r chi.Router)
type AdminGPGHandler ¶
type AdminGPGHandler struct {
// contains filtered or unexported fields
}
AdminGPGHandler manages the GPG keys that sign deb/rpm metadata and sealed release bundles (docs/security/signing.md). Every route needs an admin.
func NewAdminGPGHandler ¶
func (*AdminGPGHandler) Register ¶
func (h *AdminGPGHandler) Register(r chi.Router)
type AdminGroupsHandler ¶
type AdminGroupsHandler struct {
// contains filtered or unexported fields
}
func NewAdminGroupsHandler ¶
func (*AdminGroupsHandler) Register ¶
func (h *AdminGroupsHandler) Register(r chi.Router)
type AdminPermissionsHandler ¶
type AdminPermissionsHandler struct {
// contains filtered or unexported fields
}
func (*AdminPermissionsHandler) Register ¶
func (h *AdminPermissionsHandler) Register(r chi.Router)
type AdminRecoveryHandler ¶ added in v0.9.0
type AdminRecoveryHandler struct {
// contains filtered or unexported fields
}
AdminRecoveryHandler serves /api/v1/admin/recovery: the state of the row journal that makes `openartifact rebuild` possible.
func NewAdminRecoveryHandler ¶ added in v0.9.0
func NewAdminRecoveryHandler(src RecoveryStatusSource, log *logger.Logger, evaluator *auth.Evaluator) *AdminRecoveryHandler
NewAdminRecoveryHandler creates the handler.
func (*AdminRecoveryHandler) Register ¶ added in v0.9.0
func (h *AdminRecoveryHandler) Register(r chi.Router)
Register mounts the routes.
type AdminReplicationHandler ¶ added in v0.9.0
type AdminReplicationHandler struct {
// contains filtered or unexported fields
}
AdminReplicationHandler serves the replication status and verify endpoints.
func NewAdminReplicationHandler ¶ added in v0.9.0
func NewAdminReplicationHandler(svc ReplicationService, log *logger.Logger, evaluator *auth.Evaluator) *AdminReplicationHandler
NewAdminReplicationHandler creates the handler. svc is nil when no replica is configured: the status endpoint then reports enabled=false.
func (*AdminReplicationHandler) Register ¶ added in v0.9.0
func (h *AdminReplicationHandler) Register(r chi.Router)
Register mounts the routes. They are static paths, so they win over the parameterized /api/v1/admin/storage/{name}: a record that was named "replication" before the name was reserved is listed, but reads and tests of it reach these endpoints instead (see reservedStorageBackendName).
type AdminSSOHandler ¶
type AdminSSOHandler struct {
// contains filtered or unexported fields
}
func NewAdminSSOHandler ¶
func (*AdminSSOHandler) RegisterAuthed ¶
func (h *AdminSSOHandler) RegisterAuthed(authed chi.Router)
func (*AdminSSOHandler) RegisterPublic ¶
func (h *AdminSSOHandler) RegisterPublic(r chi.Router)
type AdminStorageHandler ¶
type AdminStorageHandler struct {
// contains filtered or unexported fields
}
func NewAdminStorageHandler ¶
func (*AdminStorageHandler) Register ¶
func (h *AdminStorageHandler) Register(r chi.Router)
func (*AdminStorageHandler) WithPrimary ¶ added in v0.13.0
func (h *AdminStorageHandler) WithPrimary(cfg storage.StorageConfig, store storage.BlobStore) *AdminStorageHandler
WithPrimary makes the configured primary store (cfg, opened as store) show up in the storage admin API. Only the non-secret location is ever exposed.
type AdminTieringHandler ¶ added in v0.7.0
type AdminTieringHandler struct {
// contains filtered or unexported fields
}
AdminTieringHandler serves /api/v1/admin/tiering: tiers, lifecycle policies, dry runs and the mover status.
func NewAdminTieringHandler ¶ added in v0.7.0
func NewAdminTieringHandler( db TieringAdminDB, reg TierRegistry, planner TierPlanner, runner TierRunner, log *logger.Logger, evaluator *auth.Evaluator, ) *AdminTieringHandler
NewAdminTieringHandler creates the handler.
func (*AdminTieringHandler) Register ¶ added in v0.7.0
func (h *AdminTieringHandler) Register(r chi.Router)
Register mounts the routes.
type AdminTokensHandler ¶
type AdminTokensHandler struct {
// contains filtered or unexported fields
}
func NewAdminTokensHandler ¶
func (*AdminTokensHandler) Register ¶
func (h *AdminTokensHandler) Register(r chi.Router)
type AdminUsersHandler ¶
type AdminUsersHandler struct {
// contains filtered or unexported fields
}
func NewAdminUsersHandler ¶
func (*AdminUsersHandler) Register ¶
func (h *AdminUsersHandler) Register(r chi.Router)
type ApkKeyHandler ¶ added in v0.13.0
type ApkKeyHandler struct {
// contains filtered or unexported fields
}
ApkKeyHandler manages the RSA key that signs the APKINDEX of an apk repository (docs/formats/apk.md). Every route needs an admin.
func NewApkKeyHandler ¶ added in v0.13.0
func NewApkKeyHandler(db database.Database, log *logger.Logger, evaluator *auth.Evaluator, keys *apkkeys.Service) *ApkKeyHandler
NewApkKeyHandler builds the handler.
func (*ApkKeyHandler) Register ¶ added in v0.13.0
func (h *ApkKeyHandler) Register(r chi.Router)
Register registers the routes on the authenticated REST router.
type AttestationAttachHandler ¶ added in v0.8.0
type AttestationAttachHandler struct {
// contains filtered or unexported fields
}
AttestationAttachHandler serves the attach endpoints and the per-repository switch.
func NewAttestationAttachHandler ¶ added in v0.8.0
func NewAttestationAttachHandler( db database.Database, log *logger.Logger, evaluator *auth.Evaluator, attacher *AttestationAttacher, blobs storage.BlobStore, ) *AttestationAttachHandler
NewAttestationAttachHandler builds the handler.
func (*AttestationAttachHandler) RegisterAuthed ¶ added in v0.8.0
func (h *AttestationAttachHandler) RegisterAuthed(r chi.Router)
RegisterAuthed registers the admin routes.
type AttestationAttacher ¶ added in v0.8.0
type AttestationAttacher struct {
// contains filtered or unexported fields
}
AttestationAttacher signs SBOMs and VEX documents and attaches them to the image they describe as OCI referrers, so `cosign verify-attestation`, `cosign tree` and `oras discover` find them next to the image.
func NewAttestationAttacher ¶ added in v0.8.0
func NewAttestationAttacher( db database.Database, log *logger.Logger, gen *sbom.Generator, svc *attest.Service, reg ReferrerRegistry, ) *AttestationAttacher
NewAttestationAttacher builds the attacher.
func (*AttestationAttacher) AttachSBOM ¶ added in v0.8.0
func (a *AttestationAttacher) AttachSBOM( ctx context.Context, repo *models.Repository, report *models.SBOMReport, doc []byte, ) (*responses.AttestationAttachResponse, error)
AttachSBOM attaches the stored SBOM report's document (JSON formats only).
func (*AttestationAttacher) AttachVEX ¶ added in v0.8.0
func (a *AttestationAttacher) AttachVEX( ctx context.Context, repo *models.Repository, artifactID, format string, ) (*responses.AttestationAttachResponse, error)
AttachVEX builds the VEX document of one artifact and attaches it.
func (*AttestationAttacher) Enabled ¶ added in v0.8.0
func (a *AttestationAttacher) Enabled(ctx context.Context, repo *models.Repository) bool
Enabled reports whether the repository attaches attestations automatically.
func (*AttestationAttacher) OnSBOMGenerated ¶ added in v0.8.0
func (a *AttestationAttacher) OnSBOMGenerated(ctx context.Context, repo *models.Repository, report *models.SBOMReport, doc []byte)
OnSBOMGenerated attaches a freshly generated SBOM when the repository opted in.
type AttestationHandler ¶ added in v0.8.0
type AttestationHandler struct {
// contains filtered or unexported fields
}
AttestationHandler exposes the public key that verifies SBOM and VEX attestations.
func NewAttestationHandler ¶ added in v0.8.0
func NewAttestationHandler(svc *attest.Service, log *logger.Logger, evaluator *auth.Evaluator) *AttestationHandler
NewAttestationHandler creates the handler; svc may be nil when attestations are unavailable.
func (*AttestationHandler) RegisterAuthed ¶ added in v0.8.0
func (h *AttestationHandler) RegisterAuthed(r chi.Router)
RegisterAuthed registers the admin description of the signing key.
func (*AttestationHandler) RegisterPublic ¶ added in v0.8.0
func (h *AttestationHandler) RegisterPublic(r chi.Router)
RegisterPublic serves the PEM public key without authentication: a verifier has to be able to fetch it before it trusts anything.
type AuthHandler ¶
type AuthHandler struct {
// contains filtered or unexported fields
}
func NewAuthHandler ¶
func NewAuthHandler( db database.Database, log *logger.Logger, evaluator *auth.Evaluator, trustedProxies *middleware.TrustedProxies, ) *AuthHandler
func (*AuthHandler) RegisterAuthed ¶
func (h *AuthHandler) RegisterAuthed(r chi.Router)
func (*AuthHandler) RegisterPublic ¶
func (h *AuthHandler) RegisterPublic(r chi.Router)
func (*AuthHandler) WithBaseURL ¶ added in v0.6.0
func (h *AuthHandler) WithBaseURL(baseURL string) *AuthHandler
WithBaseURL sets the public base URL; an https value forces Secure cookies.
type BackupHandler ¶
type BackupHandler struct {
// contains filtered or unexported fields
}
func NewBackupHandler ¶
func (*BackupHandler) RegisterAuthed ¶
func (h *BackupHandler) RegisterAuthed(r chi.Router)
func (*BackupHandler) WithTasks ¶ added in v0.11.0
func (h *BackupHandler) WithTasks(tasks *bgtask.Runner) *BackupHandler
WithTasks runs the async backups and restores under the server lifecycle: they are cancelled and awaited when the runner shuts down.
type BrandingHandler ¶ added in v0.10.0
type BrandingHandler struct {
// contains filtered or unexported fields
}
BrandingHandler serves the public white-label settings and lets global administrators change them at runtime.
func NewBrandingHandler ¶ added in v0.10.0
func NewBrandingHandler(mgr *branding.Manager, log *logger.Logger, evaluator *auth.Evaluator) *BrandingHandler
NewBrandingHandler returns the branding handler.
func (*BrandingHandler) RegisterAuthed ¶ added in v0.10.0
func (h *BrandingHandler) RegisterAuthed(r chi.Router)
RegisterAuthed registers the admin endpoints behind the RBAC middleware.
func (*BrandingHandler) RegisterPublic ¶ added in v0.10.0
func (h *BrandingHandler) RegisterPublic(r chi.Router)
RegisterPublic registers the unauthenticated endpoints on the bare router: the login page needs them before anyone is signed in.
type BundleKeyResolver ¶ added in v0.8.0
type BundleKeyResolver interface {
SignerByRef(ctx context.Context, ref string) (gpg.Signer, *models.GPGKey, error)
}
BundleKeyResolver finds the signer for a seal request's gpg_key_id (a stored key id, a fingerprint, or "config").
type BundlesHandler ¶
type BundlesHandler struct {
// contains filtered or unexported fields
}
func NewBundlesHandler ¶
func (*BundlesHandler) RegisterAuthed ¶
func (h *BundlesHandler) RegisterAuthed(r chi.Router)
func (*BundlesHandler) WithGPGKeys ¶ added in v0.8.0
func (h *BundlesHandler) WithGPGKeys(keys BundleKeyResolver) *BundlesHandler
WithGPGKeys enables sealing with gpg_key_id: the sealed bundle's manifest is signed with the referenced key.
func (*BundlesHandler) WithPublisher ¶ added in v0.8.0
func (h *BundlesHandler) WithPublisher(p webhook.Publisher) *BundlesHandler
WithPublisher enables the bundle.promoted webhook event.
func (*BundlesHandler) WithRegenerator ¶ added in v0.8.0
func (h *BundlesHandler) WithRegenerator(r TrashRegenerator) *BundlesHandler
WithRegenerator enqueues the refresh of generated metadata (deb, rpm and npm indexes) in the target repository after a promotion.
type CleanupHandler ¶
type CleanupHandler struct {
// contains filtered or unexported fields
}
func NewCleanupHandler ¶
func NewCleanupHandler(db database.Database, log *logger.Logger, evaluator *auth.Evaluator, runner CleanupRunner) *CleanupHandler
func (*CleanupHandler) RegisterAuthed ¶
func (h *CleanupHandler) RegisterAuthed(r chi.Router)
type CleanupRunner ¶ added in v0.2.0
type CleanupRunner interface {
TriggerPolicy(ctx context.Context, policyID string) error
// PreviewPolicy reports what a run would remove, removing nothing.
PreviewPolicy(ctx context.Context, policyID string) (*worker.CleanupPreview, error)
}
CleanupRunner starts an immediate run of a cleanup policy. It is satisfied by *worker.CleanupWorker.
type CompletePresignedUploadResponse ¶ added in v0.5.0
type CompletePresignedUploadResponse struct {
ID string `json:"id"`
Path string `json:"path"`
SHA256 string `json:"sha256"`
Size int64 `json:"size"`
}
CompletePresignedUploadResponse mirrors the response of a raw PUT.
type CreatePresignedUploadRequest ¶ added in v0.5.0
type CreatePresignedUploadRequest struct {
Path string `json:"path"`
Size int64 `json:"size"`
SHA256 string `json:"sha256"`
ContentType string `json:"content_type,omitempty"`
// Multipart asks for a multipart upload: the client PUTs the object in
// parts to URLs fetched from the parts endpoint. Required above the
// single-upload limit (5 GiB).
Multipart bool `json:"multipart,omitempty"`
// PartSize is the part size in bytes of a multipart upload (5 MiB to
// 4000 MiB); 0 lets the server choose.
PartSize int64 `json:"part_size,omitempty"`
}
CreatePresignedUploadRequest is the body of POST /repositories/{name}/uploads.
type CreatePresignedUploadResponse ¶ added in v0.5.0
type CreatePresignedUploadResponse struct {
ID string `json:"id"`
// UploadURL accepts one PUT of exactly Size bytes. Do not log it: the
// query string is the credential. Absent for a multipart upload.
UploadURL string `json:"upload_url,omitempty"`
Method string `json:"method,omitempty"`
// Headers must be sent with the PUT.
Headers map[string]string `json:"headers,omitempty"`
ExpiresAt time.Time `json:"expires_at"`
// Multipart, PartSize and PartCount describe a multipart upload: PUT each
// part (all PartSize bytes but the last) to a URL from the parts endpoint.
Multipart bool `json:"multipart,omitempty"`
PartSize int64 `json:"part_size,omitempty"`
PartCount int `json:"part_count,omitempty"`
}
CreatePresignedUploadResponse tells the client where and how to upload.
type DTrackPusher ¶ added in v0.8.0
DTrackPusher is what the handler needs from the background pusher.
type DTrackSources ¶ added in v0.8.0
type DTrackSources struct {
// contains filtered or unexported fields
}
DTrackSources builds the documents pushed to Dependency-Track from stored state.
func NewDTrackSources ¶ added in v0.8.0
func NewDTrackSources(db database.Database, gen *sbom.Generator) *DTrackSources
NewDTrackSources creates the sources over db and the SBOM generator.
func (*DTrackSources) BOM ¶ added in v0.8.0
func (s *DTrackSources) BOM(ctx context.Context, repo *models.Repository, artifactID string) ([]byte, int, error)
BOM implements dtrack.Sources: the CycloneDX SBOM without its vulnerabilities (Dependency-Track runs its own analysis and receives the decisions as VEX).
func (*DTrackSources) VEX ¶ added in v0.8.0
func (s *DTrackSources) VEX(ctx context.Context, repo *models.Repository, artifactID string, opts sbom.VEXOptions) ([]byte, int, error)
VEX implements dtrack.Sources.
type DebUploadHandler ¶
type DebUploadHandler struct {
// contains filtered or unexported fields
}
func NewDebUploadHandler ¶
func (*DebUploadHandler) Register ¶
func (h *DebUploadHandler) Register(router chi.Router)
func (*DebUploadHandler) SetDebWorker ¶
func (h *DebUploadHandler) SetDebWorker(w *worker.DebMetadataWorker)
func (*DebUploadHandler) SetPublisher ¶ added in v0.2.0
func (h *DebUploadHandler) SetPublisher(p webhook.Publisher)
SetPublisher wires the webhook publisher used for artifact events.
type DeltaHandler ¶
type DeltaHandler struct {
// contains filtered or unexported fields
}
DeltaHandler handles package delta requests.
func NewDeltaHandler ¶
func NewDeltaHandler(log *logger.Logger, db database.Database, blobStore storage.BlobStore) *DeltaHandler
NewDeltaHandler creates a new DeltaHandler.
func (*DeltaHandler) Register ¶
func (h *DeltaHandler) Register(router chi.Router)
Register registers the delta routes on the given router.
type DependencyTrackHandler ¶ added in v0.8.0
type DependencyTrackHandler struct {
// contains filtered or unexported fields
}
DependencyTrackHandler manages the Dependency-Track integration: the global settings, per-repository overrides, connection tests and manual pushes.
func NewDependencyTrackHandler ¶ added in v0.8.0
func NewDependencyTrackHandler( db database.Database, log *logger.Logger, evaluator *auth.Evaluator, pusher DTrackPusher, ) *DependencyTrackHandler
NewDependencyTrackHandler creates the handler; pusher may be nil (manual pushes then answer 501).
func (*DependencyTrackHandler) RegisterAuthed ¶ added in v0.8.0
func (h *DependencyTrackHandler) RegisterAuthed(r chi.Router)
RegisterAuthed registers the admin routes.
type DockerGCHandler ¶ added in v0.4.0
type DockerGCHandler struct {
// contains filtered or unexported fields
}
DockerGCHandler serves the admin endpoint that runs Docker registry garbage collection (untagged manifests and the blobs only they referenced) on demand.
func NewDockerGCHandler ¶ added in v0.4.0
func NewDockerGCHandler(db database.Database, log *logger.Logger, evaluator *auth.Evaluator, runner DockerGCRunner) *DockerGCHandler
func (*DockerGCHandler) RegisterAuthed ¶ added in v0.4.0
func (h *DockerGCHandler) RegisterAuthed(r chi.Router)
type DockerGCRunner ¶ added in v0.4.0
type DockerGCRunner interface {
RunRepo(ctx context.Context, repo *models.Repository, opts worker.DockerGCOptions) (*worker.DockerGCReport, error)
DefaultGrace() time.Duration
}
DockerGCRunner runs Docker registry garbage collection. It is satisfied by *worker.DockerGCWorker.
type ErrorResponse ¶
type ErrorResponse struct {
Error string `json:"error"`
Code string `json:"code"`
Details string `json:"details,omitempty"`
}
ErrorResponse represents an error response.
type FederationDeferredResponse ¶ added in v0.9.0
type FederationDeferredResponse struct {
UnitKey string `json:"unit_key"`
Seq int64 `json:"seq"`
Attempts int `json:"attempts"`
Reason string `json:"reason"`
LastError string `json:"last_error"`
FirstSeenAt time.Time `json:"first_seen_at"`
NextAttemptAt time.Time `json:"next_attempt_at"`
}
FederationDeferredResponse is a unit set aside after failing to apply.
type FederationHandler ¶ added in v0.9.0
type FederationHandler struct {
// contains filtered or unexported fields
}
FederationHandler serves the federation admin API of a repository.
func NewFederationHandler ¶ added in v0.9.0
func NewFederationHandler( db database.Database, log *logger.Logger, evaluator *auth.Evaluator, store *federation.Store, serverEnabled bool, kick func(), ) *FederationHandler
NewFederationHandler creates the handler.
func (*FederationHandler) RegisterAuthed ¶ added in v0.9.0
func (h *FederationHandler) RegisterAuthed(r chi.Router)
RegisterAuthed mounts the routes on the authenticated API router.
type FederationPeerResponse ¶ added in v0.9.0
type FederationPeerResponse struct {
ID string `json:"id"`
Name string `json:"name"`
BaseURL string `json:"base_url"`
Enabled bool `json:"enabled"`
State string `json:"state"`
CursorSeq int64 `json:"cursor_seq"`
RemoteHeadSeq int64 `json:"remote_head_seq"`
BacklogUnits int64 `json:"backlog_units"`
LagSeconds float64 `json:"lag_seconds"`
LastAttemptAt *time.Time `json:"last_attempt_at,omitempty"`
LastSuccessAt *time.Time `json:"last_success_at,omitempty"`
NextAttemptAt *time.Time `json:"next_attempt_at,omitempty"`
LastError string `json:"last_error"`
ErrorCount int `json:"error_count"`
AppliedTotal int64 `json:"applied_total"`
ConflictsTotal int64 `json:"conflicts_total"`
DeferredUnits int `json:"deferred_units"`
ResyncRequested bool `json:"resync_requested"`
HasCAPEM bool `json:"has_ca_pem"`
HasClientCert bool `json:"has_client_cert"`
CreatedAt time.Time `json:"created_at"`
}
FederationPeerResponse is a federation peer with its replication state.
type FederationStatusResponse ¶ added in v0.9.0
type FederationStatusResponse struct {
Enabled bool `json:"enabled"`
Supported bool `json:"supported"`
// ServerEnabled is federation.enabled; Supported is false while it is off.
ServerEnabled bool `json:"server_enabled"`
InstanceID string `json:"instance_id"`
LogID string `json:"log_id"`
HeadSeq int64 `json:"head_seq"`
Units int64 `json:"units"`
Tombstones int64 `json:"tombstones"`
Peers []FederationPeerResponse `json:"peers"`
Tokens []FederationTokenResponse `json:"tokens"`
}
FederationStatusResponse is the federation state of a repository.
type FederationTokenCreatedResponse ¶ added in v0.9.0
type FederationTokenCreatedResponse struct {
ID string `json:"id"`
Name string `json:"name"`
Token string `json:"token"`
CreatedAt time.Time `json:"created_at"`
}
FederationTokenCreatedResponse carries the new token's secret.
type FederationTokenResponse ¶ added in v0.9.0
type FederationTokenResponse struct {
ID string `json:"id"`
Name string `json:"name"`
CreatedAt time.Time `json:"created_at"`
LastUsedAt *time.Time `json:"last_used_at,omitempty"`
RevokedAt *time.Time `json:"revoked_at,omitempty"`
}
FederationTokenResponse is a peer token; the secret is shown once, at creation.
type GroupMetadataNotifier ¶ added in v0.8.0
type GroupMetadataNotifier interface {
// NotifyStale marks a group's metadata stale and schedules its regeneration.
NotifyStale(groupID string)
// NotifyMemberChanged does so for every deb/rpm/apk group listing the repository.
NotifyMemberChanged(repoID string)
}
GroupMetadataNotifier invalidates the generated metadata of deb, rpm and apk group repositories (worker.GroupMetadataWorker).
type HTTPServer ¶
type HTTPServer struct {
// contains filtered or unexported fields
}
HTTPServer implements the Server interface.
func NewHTTPServer ¶
func NewHTTPServer(addr string, log *logger.Logger) *HTTPServer
NewHTTPServer creates a new HTTP server. Defaults favor never truncating large artifact transfers: no read/write timeout, with only header reads bounded (slowloris mitigation) until SetTimeouts overrides them from config.
func (*HTTPServer) AddMiddleware ¶
func (s *HTTPServer) AddMiddleware(middleware func(http.Handler) http.Handler)
AddMiddleware adds a middleware to the server.
func (*HTTPServer) DisableKeepAlives ¶ added in v0.13.2
func (s *HTTPServer) DisableKeepAlives()
DisableKeepAlives makes the server close each connection after its current request, so clients reconnect (to another replica) while the pod drains.
func (*HTTPServer) EnableTLS ¶ added in v0.2.0
func (s *HTTPServer) EnableTLS(certFile, keyFile string)
EnableTLS makes Start serve HTTPS using the given certificate and key files.
func (*HTTPServer) GetRouter ¶
func (s *HTTPServer) GetRouter() chi.Router
GetRouter returns the underlying chi router.
func (*HTTPServer) ServeErrors ¶ added in v0.4.0
func (s *HTTPServer) ServeErrors() <-chan error
ServeErrors delivers the error that ended the accept loop unexpectedly (anything but a graceful Stop). The caller must treat it as fatal.
func (*HTTPServer) SetTimeouts ¶
func (s *HTTPServer) SetTimeouts(readTimeout, writeTimeout, readHeaderTimeout time.Duration)
SetTimeouts configures read, write, and read-header timeouts on the HTTP server. readTimeout/writeTimeout of 0 mean "no limit" (relevant for large artifact transfers); readHeaderTimeout should stay non-zero regardless — it bounds only the header-read phase, so it never truncates a body.
func (*HTTPServer) Start ¶
func (s *HTTPServer) Start(ctx context.Context) error
Start binds the listen address and serves in the background. Everything that can be checked up front (the TLS key pair, the bind itself) fails here, so a misconfigured server never reports a successful start. A later failure of the accept loop is delivered on ServeErrors.
type LicenseHandler ¶
type LicenseHandler struct {
// contains filtered or unexported fields
}
func NewLicenseHandler ¶
func NewLicenseHandler( db database.Database, log *logger.Logger, evaluator *auth.Evaluator, detector *license.Detector, blobs storage.BlobStore, ) *LicenseHandler
NewLicenseHandler returns the license scan and policy handler. blobs is the store the scan reads artifact files from to find their declared licenses.
func (*LicenseHandler) RegisterRoutes ¶
func (h *LicenseHandler) RegisterRoutes(authedRouter chi.Router)
type MavenUploadHandler ¶
type MavenUploadHandler struct {
// contains filtered or unexported fields
}
func NewMavenUploadHandler ¶
func (*MavenUploadHandler) Register ¶
func (h *MavenUploadHandler) Register(router chi.Router)
Register mounts PUT/DELETE using a true chi wildcard ("/*"), not a regexp param: chi's {name:regexp} params never span "/" (the tail delimiter defaults to '/', so the regexp is only ever tested against a single path segment), so {path:.*} can never match a multi-segment GAV path and silently 404s every real upload/delete.
func (*MavenUploadHandler) SetMavenWorker ¶
func (h *MavenUploadHandler) SetMavenWorker(w *worker.MavenMetadataWorker)
SetMavenWorker wires the debounced maven-metadata.xml regeneration worker. Call NotifyStale(repoID, groupID, artifactID) after each successful upload.
func (*MavenUploadHandler) SetPublisher ¶ added in v0.2.0
func (h *MavenUploadHandler) SetPublisher(p webhook.Publisher)
SetPublisher wires the webhook publisher for artifact.* events.
type NPMUploadHandler ¶
type NPMUploadHandler struct {
// contains filtered or unexported fields
}
func NewNPMUploadHandler ¶
func (*NPMUploadHandler) HandlePublish ¶ added in v0.2.0
func (h *NPMUploadHandler) HandlePublish(w http.ResponseWriter, r *http.Request)
HandlePublish serves an npm publish (or `-rev` unpublish) PUT. It is exported for routers that share PUT "/*" with another format.
func (*NPMUploadHandler) Register ¶
func (h *NPMUploadHandler) Register(router chi.Router)
Register mounts the publish/unpublish routes under /repos/{name} on a router that has no other /repos/{name} subrouter (tests). Production code shares the /repos/{name} subrouter with the other formats and calls RegisterRepoRoutes.
func (*NPMUploadHandler) RegisterRepoRoutes ¶ added in v0.2.0
func (h *NPMUploadHandler) RegisterRepoRoutes(r chi.Router)
RegisterRepoRoutes registers the routes relative to a /repos/{name} subrouter. They must live inside that subrouter: a sibling /repos/{repo}/* route is shadowed by the mount and every PUT/DELETE 404s.
func (*NPMUploadHandler) SetNPMWorker ¶
func (h *NPMUploadHandler) SetNPMWorker(w *worker.NPMMetadataWorker)
SetNPMWorker wires the debounced npm packument regeneration worker. Call NotifyStale(packageID) after each successful publish.
func (*NPMUploadHandler) SetPublisher ¶ added in v0.2.0
func (h *NPMUploadHandler) SetPublisher(p webhook.Publisher)
SetPublisher wires the webhook publisher used for artifact.uploaded and artifact.deleted events. It must be called before the handler serves requests.
type NixKeyHandler ¶ added in v0.14.0
type NixKeyHandler struct {
// contains filtered or unexported fields
}
NixKeyHandler manages the ed25519 key that signs the narinfo of a Nix repository (docs/formats/nix.md). Every route needs an admin.
func NewNixKeyHandler ¶ added in v0.14.0
func NewNixKeyHandler(db database.Database, log *logger.Logger, evaluator *auth.Evaluator, keys *nixkeys.Service) *NixKeyHandler
NewNixKeyHandler builds the handler.
func (*NixKeyHandler) Register ¶ added in v0.14.0
func (h *NixKeyHandler) Register(r chi.Router)
Register registers the routes on the authenticated REST router.
type OIDCHandler ¶
type OIDCHandler struct {
// contains filtered or unexported fields
}
func NewOIDCHandler ¶
func (*OIDCHandler) RegisterPublic ¶
func (h *OIDCHandler) RegisterPublic(public chi.Router)
func (*OIDCHandler) WithTrustedProxies ¶ added in v0.2.0
func (h *OIDCHandler) WithTrustedProxies(tp *middleware.TrustedProxies) *OIDCHandler
WithTrustedProxies sets the reverse-proxy allowlist used to resolve the client IP recorded on new sessions. Without it the TCP peer address is used.
type OpenAPIHandler ¶
type OpenAPIHandler struct {
// contains filtered or unexported fields
}
OpenAPIHandler serves the OpenAPI spec and the interactive API reference.
func NewOpenAPIHandler ¶
func NewOpenAPIHandler(version string, docsEnabled bool) *OpenAPIHandler
NewOpenAPIHandler returns a handler stamping version into the spec. The spec routes are always served; the API reference and the legacy /swagger redirects only when docsEnabled.
func (*OpenAPIHandler) RegisterRoutes ¶
func (h *OpenAPIHandler) RegisterRoutes(router chi.Router)
type PackageDeleter ¶ added in v0.8.0
type PackageDeleter interface {
DeletePackage(
ctx context.Context,
repo *models.Repository,
id string,
guard func(worker.DeletedPackage) error,
actor string,
) (*worker.DeletedPackage, error)
}
PackageDeleter deletes a package row of any hosted format by its listing id. It is satisfied by *worker.CleanupWorker.
type PresignedPart ¶ added in v0.8.0
type PresignedPart struct {
PartNumber int `json:"part_number"`
// UploadURL accepts one PUT of exactly Size bytes. Do not log it: the
// query string is the credential.
UploadURL string `json:"upload_url"`
Method string `json:"method"`
// Headers must be sent with the PUT.
Headers map[string]string `json:"headers"`
// Size is the exact size of the part in bytes.
Size int64 `json:"size"`
}
PresignedPart is the upload target of one part.
type PresignedPartsRequest ¶ added in v0.8.0
type PresignedPartsRequest struct {
// PartNumbers are the 1-based parts to sign, at most 100 per call.
PartNumbers []int `json:"part_numbers"`
}
PresignedPartsRequest is the body of POST /repositories/{name}/uploads/{id}/parts.
type PresignedPartsResponse ¶ added in v0.8.0
type PresignedPartsResponse struct {
Parts []PresignedPart `json:"parts"`
ExpiresAt time.Time `json:"expires_at"`
}
PresignedPartsResponse carries the signed part URLs.
type PresignedUploadHandler ¶ added in v0.5.0
PresignedUploadHandler implements client-direct uploads: the client PUTs the bytes straight to the object store using a short-lived presigned URL, then calls complete so the server can verify size and sha256 and record the artifact. Only raw hosted repositories are supported.
func NewPresignedUploadHandler ¶ added in v0.5.0
func NewPresignedUploadHandler(log *logger.Logger, db database.Database, blobStore storage.BlobStore, evaluator *auth.Evaluator, urlTTL time.Duration, maxPending int, reg *metrics.Registry, ) *PresignedUploadHandler
NewPresignedUploadHandler builds the handler. blobStore may or may not support staging uploads; an unsupported backend answers 501 without recording anything. maxPending caps one user's outstanding uploads (0 = unlimited).
func (*PresignedUploadHandler) Register ¶ added in v0.5.0
func (h *PresignedUploadHandler) Register(router chi.Router)
Register mounts the routes.
type ProjectCleanupPreviewer ¶ added in v0.8.0
type ProjectCleanupPreviewer interface {
PreviewProjectPolicy(ctx context.Context, policyID string) ([]*worker.CleanupPreview, error)
}
ProjectCleanupPreviewer evaluates a project default cleanup policy without running it. It is satisfied by *worker.CleanupWorker.
type ProjectsHandler ¶ added in v0.6.0
type ProjectsHandler struct {
// contains filtered or unexported fields
}
ProjectsHandler serves /api/v1/projects: projects, their members and the groups attached to them. The RBAC middleware is the first gate (project scope, 404 for non-members, 403 below the required role); the handler re-checks the same decision from the evaluator, so a route reached any other way is still protected, and adds the escalation guards the middleware cannot know (which role is granted to whom).
func NewProjectsHandler ¶ added in v0.6.0
func NewProjectsHandler( db database.Database, log *logger.Logger, evaluator *auth.Evaluator, settings *auth.ProjectSettings, ) *ProjectsHandler
NewProjectsHandler returns the projects handler. evaluator decides roles and who is a global admin (implicit owner of every project); settings holds the projects.self_create switch.
func (*ProjectsHandler) RegisterRoutes ¶ added in v0.6.0
func (h *ProjectsHandler) RegisterRoutes(r chi.Router)
func (*ProjectsHandler) SetCleanupPreviewer ¶ added in v0.8.0
func (h *ProjectsHandler) SetCleanupPreviewer(p ProjectCleanupPreviewer)
SetCleanupPreviewer wires the dry run of project default cleanup policies.
type PropertiesHandler ¶
type PropertiesHandler struct {
// contains filtered or unexported fields
}
func NewPropertiesHandler ¶
func NewPropertiesHandler(log *logger.Logger, db database.Database, blobs storage.BlobStore) *PropertiesHandler
NewPropertiesHandler returns the artifact properties handler. blobs is the store read to re-evaluate license policies on the artifact's own declared licenses when a license property changes.
func (*PropertiesHandler) RegisterRoutes ¶
func (h *PropertiesHandler) RegisterRoutes(r chi.Router, pathPrefix string)
type QuotasHandler ¶
type QuotasHandler struct {
// contains filtered or unexported fields
}
func NewQuotasHandler ¶
func (*QuotasHandler) RegisterAdminRoutes ¶ added in v0.11.0
func (h *QuotasHandler) RegisterAdminRoutes(r chi.Router)
RegisterAdminRoutes registers the instance-wide quota overview.
func (*QuotasHandler) RegisterRoutes ¶
func (h *QuotasHandler) RegisterRoutes(r chi.Router, pathPrefix string)
type RPMUploadHandler ¶
type RPMUploadHandler struct {
// contains filtered or unexported fields
}
func NewRPMUploadHandler ¶
func (*RPMUploadHandler) Register ¶
func (h *RPMUploadHandler) Register(router chi.Router)
func (*RPMUploadHandler) SetDebWorker ¶
func (h *RPMUploadHandler) SetDebWorker(w *worker.DebMetadataWorker)
func (*RPMUploadHandler) SetKeyResolver ¶ added in v0.8.0
func (h *RPMUploadHandler) SetKeyResolver(r gpg.Resolver)
SetKeyResolver wires the signing keys used by repositories with sign_packages.
func (*RPMUploadHandler) SetPackageDeleter ¶ added in v0.8.0
func (h *RPMUploadHandler) SetPackageDeleter(d PackageDeleter)
SetPackageDeleter wires the deleter behind DELETE /repositories/{name}/packages/{id} for every format but deb and rpm, which have handlers of their own.
func (*RPMUploadHandler) SetPublisher ¶ added in v0.2.0
func (h *RPMUploadHandler) SetPublisher(p webhook.Publisher)
SetPublisher wires the webhook publisher used for artifact events. It also covers the embedded deb handler that serves deb repositories on the same routes.
func (*RPMUploadHandler) SetRPMWorker ¶
func (h *RPMUploadHandler) SetRPMWorker(w *worker.RPMetadataWorker)
type RecoveryStatusSource ¶ added in v0.9.0
RecoveryStatusSource reports the disaster-recovery journal state.
type ReferrerRegistry ¶ added in v0.8.0
type ReferrerRegistry interface {
AttachReferrer(ctx context.Context, repo *models.Repository, req docker.ReferrerRequest) (*docker.ReferrerResult, error)
FindReferrer(
ctx context.Context,
repo *models.Repository,
image, subjectDigest, artifactType string,
annotations map[string]string,
) (string, error)
}
ReferrerRegistry is the docker registry's way of storing a referrer.
type ReplicationService ¶ added in v0.9.0
type ReplicationService interface {
Status(ctx context.Context) (replication.Status, error)
// RequestVerify asks for a verify pass; false when one is running or requested.
RequestVerify(ctx context.Context) (bool, error)
}
ReplicationService is blob replication as the admin API sees it; *replication.Service implements it.
type RepositoriesHandler ¶
type RepositoriesHandler struct {
// contains filtered or unexported fields
}
func NewRepositoriesHandler ¶
func (*RepositoriesHandler) RegisterAuthed ¶
func (h *RepositoriesHandler) RegisterAuthed(r chi.Router)
func (*RepositoriesHandler) WithBlobStore ¶ added in v0.2.0
func (h *RepositoriesHandler) WithBlobStore(store storage.BlobStore) *RepositoriesHandler
WithBlobStore enables the package download endpoint.
func (*RepositoriesHandler) WithFederation ¶ added in v0.9.0
func (h *RepositoriesHandler) WithFederation(store *federation.Store) *RepositoriesHandler
WithFederation lets repositories be created federated (federation.enabled).
func (*RepositoriesHandler) WithGroupMetadata ¶ added in v0.8.0
func (h *RepositoriesHandler) WithGroupMetadata(n GroupMetadataNotifier) *RepositoriesHandler
WithGroupMetadata makes changes to deb and rpm repositories regenerate the metadata of the groups they belong to.
func (*RepositoriesHandler) WithPublisher ¶ added in v0.2.0
func (h *RepositoriesHandler) WithPublisher(p webhook.Publisher) *RepositoriesHandler
WithPublisher enables repository.created / repository.deleted webhook events.
func (*RepositoriesHandler) WithTasks ¶ added in v0.11.0
func (h *RepositoriesHandler) WithTasks(tasks *bgtask.Runner) *RepositoriesHandler
WithTasks runs the background orphan-blob collections under the server lifecycle: they are cancelled and awaited when the runner shuts down.
type RepositoryActivityHandler ¶ added in v0.11.0
type RepositoryActivityHandler struct {
// contains filtered or unexported fields
}
RepositoryActivityHandler serves the audit feed of one repository.
func NewRepositoryActivityHandler ¶ added in v0.11.0
func (*RepositoryActivityHandler) RegisterAuthed ¶ added in v0.11.0
func (h *RepositoryActivityHandler) RegisterAuthed(r chi.Router)
type Response ¶
type Response struct {
Success bool `json:"success"`
Data any `json:"data,omitempty"`
Error string `json:"error,omitempty"`
Code string `json:"code,omitempty"`
}
Response represents a standard API response.
type SAMLHandler ¶
type SAMLHandler struct {
// contains filtered or unexported fields
}
func NewSAMLHandler ¶
func (*SAMLHandler) RegisterPublic ¶
func (h *SAMLHandler) RegisterPublic(public chi.Router)
func (*SAMLHandler) WithTrustedProxies ¶ added in v0.2.0
func (h *SAMLHandler) WithTrustedProxies(tp *middleware.TrustedProxies) *SAMLHandler
WithTrustedProxies overrides the reverse-proxy allowlist (default: the configured server.trustedProxies) used to resolve the client IP recorded on new sessions.
type SBOMHandler ¶
type SBOMHandler struct {
// contains filtered or unexported fields
}
func NewSBOMHandler ¶
func (*SBOMHandler) RegisterAuthed ¶
func (h *SBOMHandler) RegisterAuthed(r chi.Router)
func (*SBOMHandler) WithAttacher ¶ added in v0.8.0
func (h *SBOMHandler) WithAttacher(a *AttestationAttacher) *SBOMHandler
WithAttacher attaches each generated SBOM to its docker image as an OCI referrer in repositories that enabled it.
func (*SBOMHandler) WithAttestation ¶ added in v0.8.0
func (h *SBOMHandler) WithAttestation(svc *attest.Service) *SBOMHandler
WithAttestation enables signed downloads (`?attest=true`).
type SecretsHandler ¶
type SecretsHandler struct {
// contains filtered or unexported fields
}
func NewSecretsHandler ¶
func (*SecretsHandler) RegisterRoutes ¶
func (h *SecretsHandler) RegisterRoutes(authedRouter chi.Router, pathPrefix string)
type SecurityHandler ¶ added in v0.11.0
type SecurityHandler struct {
// contains filtered or unexported fields
}
SecurityHandler serves the cross-type security findings (vulnerabilities, licenses, secrets, AI analysis) of every repository, the admin security health and the counts-only security summary of one repository (docs/security/findings.md).
func NewSecurityHandler ¶ added in v0.11.0
func NewSecurityHandler(db database.Database, log *logger.Logger, evaluator *auth.Evaluator, scanners *vuln.Registry, generator *sbom.Generator, envAI ai.Settings, ) *SecurityHandler
NewSecurityHandler builds the handler. scanners reports the scanner readiness and generator builds the VEX export; envAI are the env/YAML AI defaults.
func (*SecurityHandler) RegisterRoutes ¶ added in v0.11.0
func (h *SecurityHandler) RegisterRoutes(authedRouter chi.Router)
RegisterRoutes registers the security routes on the authenticated router. Findings are for global admins and project maintainers or owners (each sees their projects' repositories); health is administrative; the repository summary needs read access to the repository.
func (*SecurityHandler) WithExploit ¶ added in v0.14.0
func (h *SecurityHandler) WithExploit(e *exploit.Enricher) *SecurityHandler
WithExploit sets the enricher whose EPSS threshold derives the finding priority.
type SelfTokensHandler ¶
type SelfTokensHandler struct {
// contains filtered or unexported fields
}
func NewSelfTokensHandler ¶
func (*SelfTokensHandler) Register ¶
func (h *SelfTokensHandler) Register(r chi.Router)
type SystemInfoHandler ¶
type SystemInfoHandler struct {
// contains filtered or unexported fields
}
func NewSystemInfoHandler ¶
func (*SystemInfoHandler) RegisterAuthed ¶ added in v0.2.0
func (h *SystemInfoHandler) RegisterAuthed(r chi.Router)
RegisterAuthed registers the detailed endpoint (behind the admin RBAC check).
func (*SystemInfoHandler) RegisterPublic ¶
func (h *SystemInfoHandler) RegisterPublic(r chi.Router)
RegisterPublic registers the unauthenticated, trimmed endpoint: version and an overall status only.
func (*SystemInfoHandler) ServeHTTP ¶
func (h *SystemInfoHandler) ServeHTTP(w http.ResponseWriter, _ *http.Request)
func (*SystemInfoHandler) WithAPIReference ¶ added in v0.11.0
func (h *SystemInfoHandler) WithAPIReference(enabled bool) *SystemInfoHandler
WithAPIReference sets whether the public info endpoint advertises the interactive API reference (api_reference_enabled), so the UI links it only when it is served.
func (*SystemInfoHandler) WithDocsBaseURL ¶ added in v0.9.0
func (h *SystemInfoHandler) WithDocsBaseURL(base string) *SystemInfoHandler
WithDocsBaseURL sets the documentation site root the public info endpoint advertises as docs_url, resolved against the server version.
type TierPlanner ¶ added in v0.7.0
type TierPlanner interface {
Plan(ctx context.Context, draft *tiering.Policy, sampleLimit int) (*tiering.Plan, error)
}
TierPlanner simulates policies (the tiering engine).
type TierRegistry ¶ added in v0.7.0
TierRegistry is the tier registry as the admin API sees it.
type TierRunner ¶ added in v0.7.0
type TierRunner interface {
// Trigger asks for an immediate pass; it reports false when one is already running.
Trigger() bool
Status() tiering.RunnerStatus
}
TierRunner is the background mover as the admin API sees it.
type TieringAdminDB ¶ added in v0.7.0
type TieringAdminDB interface {
ListStorageTiers(ctx context.Context) ([]*models.StorageTier, error)
GetStorageTierByName(ctx context.Context, name string) (*models.StorageTier, error)
CreateStorageTier(ctx context.Context, t *models.StorageTier) error
UpdateStorageTier(ctx context.Context, t *models.StorageTier) error
// DeleteStorageTierIfUnused checks and deletes atomically; it returns the
// reason the tier is still in use, or "" once it is deleted.
DeleteStorageTierIfUnused(ctx context.Context, id string) (string, error)
GetStorageBackend(ctx context.Context, name string) (*models.StorageBackend, error)
ListStoragePolicies(ctx context.Context) ([]*models.StoragePolicy, error)
GetStoragePolicy(ctx context.Context, id string) (*models.StoragePolicy, error)
CreateStoragePolicy(ctx context.Context, p *models.StoragePolicy) error
UpdateStoragePolicy(ctx context.Context, p *models.StoragePolicy) error
DeleteStoragePolicy(ctx context.Context, id string) (bool, error)
StorageTierUsage(ctx context.Context) ([]models.TierUsage, error)
ListStorageTierMoves(ctx context.Context, limit int) ([]*models.StorageTierMove, error)
CountStorageTierMoves(ctx context.Context) (int64, error)
}
TieringAdminDB is the persistence the tiering admin API needs.
type TrashHandler ¶ added in v0.5.0
type TrashHandler struct {
// contains filtered or unexported fields
}
TrashHandler serves the trash API: listing, restoring and purging soft-deleted packages and repositories.
The global routes (/api/v1/trash...) are admin only. The repository routes (/api/v1/repositories/{name}/trash...) need the repository-scoped `delete` permission and only ever touch items of that repository; emptying a repository's trash needs the repository-scoped `manage` permission.
func NewTrashHandler ¶ added in v0.5.0
func (*TrashHandler) RegisterAuthed ¶ added in v0.5.0
func (h *TrashHandler) RegisterAuthed(r chi.Router)
func (*TrashHandler) WithBlobStore ¶ added in v0.5.0
func (h *TrashHandler) WithBlobStore(store storage.BlobStore) *TrashHandler
WithBlobStore enables freeing blobs when an item is purged.
func (*TrashHandler) WithGroupMetadata ¶ added in v0.8.0
func (h *TrashHandler) WithGroupMetadata(n GroupMetadataNotifier) *TrashHandler
WithGroupMetadata makes restoring a deb or rpm repository regenerate the merged metadata of the groups it belongs to (or its own, for a group).
func (*TrashHandler) WithPublisher ¶ added in v0.5.0
func (h *TrashHandler) WithPublisher(p webhook.Publisher) *TrashHandler
WithPublisher enables the artifact.restored/purged and repository.restored/purged events.
func (*TrashHandler) WithRegenerator ¶ added in v0.5.0
func (h *TrashHandler) WithRegenerator(r TrashRegenerator) *TrashHandler
WithRegenerator enables the metadata refresh after a restore.
func (*TrashHandler) WithTasks ¶ added in v0.11.0
func (h *TrashHandler) WithTasks(tasks *bgtask.Runner) *TrashHandler
WithTasks runs the background orphan-blob collections under the server lifecycle: they are cancelled and awaited when the runner shuts down.
type TrashRegenerator ¶ added in v0.5.0
type TrashRegenerator interface {
NotifyDebStale(repoID string)
NotifyRPMStale(repoID string)
NotifyPacmanStale(repoID string)
NotifyApkStale(repoID string)
NotifyMavenStale(repoID, groupID, artifactID string)
NotifyNPMStale(packageID string)
}
TrashRegenerator schedules the metadata refresh a restored item needs: a row that left the trash changes what the format's generated metadata lists, exactly like a fresh upload. Every method only enqueues work.
func NewWorkerRegenerator ¶ added in v0.5.0
func NewWorkerRegenerator(deb, rpm, apk, pacman repoStaleNotifier, maven mavenStaleNotifier, npm npmStaleNotifier) TrashRegenerator
NewWorkerRegenerator builds the TrashRegenerator over the metadata workers constructed in main.go. Pass nil for a worker that is not running.
type VEXHandler ¶ added in v0.7.0
type VEXHandler struct {
// contains filtered or unexported fields
}
VEXHandler serves VEX documents built from the scan results and manages the admin VEX decisions.
func NewVEXHandler ¶ added in v0.7.0
func (*VEXHandler) RegisterAuthed ¶ added in v0.7.0
func (h *VEXHandler) RegisterAuthed(r chi.Router)
func (*VEXHandler) WithAttestation ¶ added in v0.8.0
func (h *VEXHandler) WithAttestation(svc *attest.Service) *VEXHandler
WithAttestation enables signed documents (`?attest=true`).
type VulnHandler ¶
type VulnHandler struct {
// contains filtered or unexported fields
}
VulnHandler handles vulnerability scanning endpoints.
func NewVulnHandler ¶
func NewVulnHandler(db database.Database, log *logger.Logger, evaluator *auth.Evaluator, scanners *vuln.Registry) *VulnHandler
NewVulnHandler creates a new vulnerability handler. scanners provides the scanner backends and their availability; nil means the defaults (trivy and grype from PATH, no database refresh).
func (*VulnHandler) RegisterOverviewRoutes ¶ added in v0.7.0
func (h *VulnHandler) RegisterOverviewRoutes(authedRouter chi.Router)
RegisterOverviewRoutes registers the cross-repository scan overview, which is not scoped to one repository. Administrative like every scan route: the RBAC middleware requires "manage" on /api/v1/ paths and the handlers check the admin flag again.
func (*VulnHandler) RegisterRoutes ¶
func (h *VulnHandler) RegisterRoutes(authedRouter chi.Router, pathPrefix string)
RegisterRoutes registers vulnerability scanning routes.
func (*VulnHandler) WithExploit ¶ added in v0.14.0
func (h *VulnHandler) WithExploit(e *exploit.Enricher) *VulnHandler
WithExploit sets the enricher that marks findings with the CISA KEV and FIRST EPSS signals (the default has no feeds: findings carry their severity as priority).
func (*VulnHandler) WithOSVMirror ¶ added in v0.14.0
func (h *VulnHandler) WithOSVMirror(cfg config.OSVMirrorConfig) *VulnHandler
WithOSVMirror tells the handler how the local OSV mirror is configured, for the status endpoint.
func (*VulnHandler) WithScanHook ¶ added in v0.8.0
func (h *VulnHandler) WithScanHook(f func(repoID, artifactID string)) *VulnHandler
WithScanHook sets a function called after each completed (or partial) scan was stored; the Dependency-Track integration uses it to push fresh results.
func (*VulnHandler) WithTasks ¶ added in v0.11.0
func (h *VulnHandler) WithTasks(tasks *bgtask.Runner) *VulnHandler
WithTasks runs the background scans under the server lifecycle: they are cancelled and awaited when the runner shuts down.
type WebhooksHandler ¶
type WebhooksHandler struct {
// contains filtered or unexported fields
}
func NewWebhooksHandler ¶
func NewWebhooksHandler( db database.Database, log *logger.Logger, evaluator *auth.Evaluator, dispatcher *webhook.Dispatcher, ) *WebhooksHandler
func (*WebhooksHandler) RegisterAuthed ¶
func (h *WebhooksHandler) RegisterAuthed(r chi.Router)
Source Files
¶
- admin_ai.go
- admin_apk_key.go
- admin_audit.go
- admin_audit_cursor.go
- admin_declarative.go
- admin_gpg.go
- admin_groups.go
- admin_mutation_audit.go
- admin_nix_key.go
- admin_permissions.go
- admin_recovery.go
- admin_replication.go
- admin_signing_key.go
- admin_sso.go
- admin_sso_oidc.go
- admin_storage.go
- admin_storage_primary.go
- admin_tiering.go
- admin_tokens.go
- admin_users.go
- ai.go
- artifact_detail.go
- attestation.go
- attestation_attach.go
- audit_export.go
- audit_subjects.go
- auth_handlers.go
- auth_helpers.go
- backup.go
- branding.go
- bundles.go
- bundles_authz.go
- bundles_promote.go
- bundles_signing.go
- cleanup.go
- cookie.go
- delta.go
- dependency_track.go
- docker_gc.go
- federation.go
- interfaces.go
- license.go
- license_artifact.go
- maven_parent_license.go
- openapi.go
- package_delete.go
- presigned_multipart.go
- presigned_uploads.go
- projects.go
- projects_activity.go
- projects_audit.go
- projects_cleanup.go
- projects_groups.go
- projects_members.go
- projects_quota.go
- projects_repos.go
- projects_tokens.go
- properties.go
- quotas.go
- quotas_overview.go
- repo_access.go
- repositories.go
- repositories_activity.go
- repositories_catalog_list.go
- repositories_catalog_packages.go
- repositories_project.go
- sbom.go
- scan_export.go
- scan_helpers.go
- secrets.go
- security_export.go
- security_findings.go
- security_health.go
- self_tokens.go
- server.go
- sso_common.go
- sso_oidc_handlers.go
- sso_saml_handlers.go
- system_info.go
- tokens_unified.go
- trash.go
- trash_regen.go
- upload_deb.go
- upload_maven.go
- upload_npm.go
- upload_npm_body.go
- upload_npm_deprecate.go
- upload_rpm.go
- vex.go
- vuln.go
- vuln_distro.go
- vuln_exploit.go
- vuln_osv_mirror.go
- vuln_overview.go
- vuln_overview_cursor.go
- webhooks.go