dtrack

package module
v0.18.0 Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2026 License: Apache-2.0 Imports: 19 Imported by: 28

README ¶

client-go

CI PkgGoDev License

Go client library for OWASP Dependency-Track

Introduction

client-go is a Go library to interact with Dependency-Track's REST API, making it easy to implement custom automation around Dependency-Track.

Example use-cases include:

  • Interacting with Dependency-Track in CI/CD pipelines
    • e.g. to implement quality gates, or generate build reports
  • Uploading BOMs of various origins
    • e.g. from all containers running in a Kubernetes cluster, see sbom-operator
  • Reacting to Webhook notifications
    • e.g. to automate analysis decisions on findings, see dtapac
  • Reporting and tracking of portfolio metrics in specialized systems

Installation

go get github.com/DependencyTrack/client-go

Compatibility

client-go Version Go Version Dependency-Track Version
v0.8.0 1.18+ 4.0.0+
v0.9.0+ 1.19+ 4.0.0+

Usage

Please refer to the documentation.

API Coverage

client-go primarily covers those parts of the Dependency-Track API that the community has an explicit need for. If you'd like to use this library, and your desired functionality is not yet available, please consider creating a PR.

Documentation ¶

Overview ¶

Example (FetchAllFindings) ¶

This example demonstrates how to fetch all findings for a given project.

client, _ := dtrack.NewClient("https://dtrack.example.com", dtrack.WithAPIKey("..."))
projectUUID := uuid.MustParse("2d16089e-6d3a-437e-b334-f27eb2cbd7f4")

_, err := dtrack.FetchAll(func(po dtrack.PageOptions) (dtrack.Page[dtrack.Finding], error) {
	return client.Finding.GetAll(context.TODO(), projectUUID, false, po)
})
if err != nil {
	panic(err)
}
Example (UploadBOM) ¶

This example demonstrates how to upload a Bill of Materials and wait for its processing to complete.

client, _ := dtrack.NewClient("https://dtrack.example.com", dtrack.WithAPIKey("..."))

bomContent, err := os.ReadFile("bom.xml")
if err != nil {
	panic(err)
}

uploadToken, err := client.BOM.Upload(context.TODO(), dtrack.BOMUploadRequest{
	ProjectName:    "acme-app",
	ProjectVersion: "1.0.0",
	AutoCreate:     true,
	BOM:            base64.StdEncoding.EncodeToString(bomContent),
})
if err != nil {
	panic(err)
}

var (
	doneChan = make(chan struct{})
	errChan  = make(chan error)
	ticker   = time.NewTicker(1 * time.Second)
	timeout  = time.After(30 * time.Second)
)

go func() {
	defer func() {
		close(doneChan)
		close(errChan)
	}()

	for {
		select {
		case <-ticker.C:
			processing, err := client.Event.IsBeingProcessed(context.TODO(), dtrack.EventToken(uploadToken))
			if err != nil {
				errChan <- err
				return
			}
			if !processing {
				doneChan <- struct{}{}
				return
			}
		case <-timeout:
			errChan <- fmt.Errorf("timeout exceeded")
			return
		}
	}
}()

select {
case <-doneChan:
	fmt.Println("bom processing completed")
case err = <-errChan:
	fmt.Printf("failed to wait for bom processing: %v\n", err)
}

Index ¶

Examples ¶

Constants ¶

View Source
const (
	DefaultTimeout   = 10 * time.Second
	DefaultUserAgent = "github.com/DependencyTrack/client-go"
)
View Source
const (
	PermissionAccessManagement        = "ACCESS_MANAGEMENT"
	PermissionBOMUpload               = "BOM_UPLOAD"
	PermissionPolicyManagement        = "POLICY_MANAGEMENT"
	PermissionPolicyViolationAnalysis = "POLICY_VIOLATION_ANALYSIS"
	PermissionPortfolioManagement     = "PORTFOLIO_MANAGEMENT"
	PermissionProjectCreationUpload   = "PROJECT_CREATION_UPLOAD"
	PermissionSystemConfiguration     = "SYSTEM_CONFIGURATION"
	PermissionTagManagement           = "TAG_MANAGEMENT"
	PermissionViewBadges              = "VIEW_BADGES"
	PermissionViewPolicyViolation     = "VIEW_POLICY_VIOLATION"
	PermissionViewPortfolio           = "VIEW_PORTFOLIO"
	PermissionViewVulnerability       = "VIEW_VULNERABILITY"
	PermissionVulnerabilityAnalysis   = "VULNERABILITY_ANALYSIS"
	PermissionVulnerabilityManagement = "VULNERABILITY_MANAGEMENT"
)
View Source
const (
	RepositoryTypeCargo       = "CARGO"
	RepositoryTypeComposer    = "COMPOSER"
	RepositoryTypeCpan        = "CPAN"
	RepositoryTypeGem         = "GEM"
	RepositoryTypeGithub      = "GITHUB"
	RepositoryTypeGoModules   = "GO_MODULES"
	RepositoryTypeHex         = "HEX"
	RepositoryTypeMaven       = "MAVEN"
	RepositoryTypeNpm         = "NPM"
	RepositoryTypeNuget       = "NUGET"
	RepositoryTypePypi        = "PYPI"
	RepositoryTypeUnsupported = "UNSUPPORTED"
)

Variables ¶

This section is empty.

Functions ¶

func FetchAll ¶

func FetchAll[T any](pageFetchFunc func(po PageOptions) (Page[T], error)) (items []T, err error)

FetchAll is a convenience function to retrieve all items of a paginated API resource.

func ForEach ¶

func ForEach[T any](pageFetchFunc func(po PageOptions) (Page[T], error), handlerFunc func(item T) error) (err error)

ForEach is a convenience function to perform an action on every item of a paginated API resource.

func OptionalBool ¶ added in v0.14.0

func OptionalBool() *bool

func OptionalBoolOf ¶ added in v0.14.0

func OptionalBoolOf(value bool) *bool

Types ¶

type ACLMappingRequest ¶ added in v0.17.0

type ACLMappingRequest struct {
	Team    uuid.UUID `json:"team"`
	Project uuid.UUID `json:"project"`
}

type ACLService ¶ added in v0.17.0

type ACLService struct {
	// contains filtered or unexported fields
}

func (ACLService) AddProjectMapping ¶ added in v0.17.0

func (as ACLService) AddProjectMapping(ctx context.Context, mapping ACLMappingRequest) (err error)

func (ACLService) GetAllProjects ¶ added in v0.17.0

func (as ACLService) GetAllProjects(ctx context.Context, team uuid.UUID, po PageOptions) (p Page[Project], err error)

func (ACLService) RemoveProjectMapping ¶ added in v0.17.0

func (as ACLService) RemoveProjectMapping(ctx context.Context, team, project uuid.UUID) (err error)

type APIError ¶

type APIError struct {
	StatusCode int
	Message    string
}

func (APIError) Error ¶

func (e APIError) Error() string

type APIKey ¶

type APIKey struct {
	Key       string `json:"key"`
	Comment   string `json:"comment"`
	Created   int    `json:"created"`
	LastUsed  int    `json:"lastUsed"`
	MaskedKey string `json:"maskedKey"`
	PublicId  string `json:"publicId"` // Since 4.13
	Legacy    bool   `json:"legacy"`   // Since 4.13
}

type About ¶

type About struct {
	UUID        uuid.UUID      `json:"uuid"`
	SystemUUID  uuid.UUID      `json:"systemUuid"`
	Application string         `json:"application"`
	Version     string         `json:"version"`
	Timestamp   string         `json:"timestamp"`
	Framework   AboutFramework `json:"framework"`
}

type AboutFramework ¶

type AboutFramework struct {
	UUID      uuid.UUID `json:"uuid"`
	Name      string    `json:"name"`
	Version   string    `json:"version"`
	Timestamp string    `json:"timestamp"`
}

type AboutService ¶

type AboutService struct {
	// contains filtered or unexported fields
}

func (AboutService) Get ¶

func (as AboutService) Get(ctx context.Context) (a About, err error)

type Analysis ¶

type Analysis struct {
	Comments      []AnalysisComment     `json:"analysisComments"`
	State         AnalysisState         `json:"analysisState"`
	Justification AnalysisJustification `json:"analysisJustification"`
	Response      AnalysisResponse      `json:"analysisResponse"`
	Details       string                `json:"analysisDetails"`
	Suppressed    bool                  `json:"isSuppressed"`
}

type AnalysisComment ¶

type AnalysisComment struct {
	Comment   string `json:"comment"`
	Commenter string `json:"commenter"`
	Timestamp int    `json:"timestamp"`
}

type AnalysisJustification ¶

type AnalysisJustification string
const (
	AnalysisJustificationCodeNotPresent               AnalysisJustification = "CODE_NOT_PRESENT"
	AnalysisJustificationCodeNotReachable             AnalysisJustification = "CODE_NOT_REACHABLE"
	AnalysisJustificationNotSet                       AnalysisJustification = "NOT_SET"
	AnalysisJustificationProtectedAtPerimeter         AnalysisJustification = "PROTECTED_AT_PERIMETER"
	AnalysisJustificationProtectedAtRuntime           AnalysisJustification = "PROTECTED_AT_RUNTIME"
	AnalysisJustificationProtectedByCompiler          AnalysisJustification = "PROTECTED_BY_COMPILER"
	AnalysisJustificationProtectedByMitigatingControl AnalysisJustification = "PROTECTED_BY_MITIGATING_CONTROL"
	AnalysisJustificationRequiresConfiguration        AnalysisJustification = "REQUIRES_CONFIGURATION"
	AnalysisJustificationRequiresDependency           AnalysisJustification = "REQUIRES_DEPENDENCY"
	AnalysisJustificationRequiresEnvironment          AnalysisJustification = "REQUIRES_ENVIRONMENT"
)

type AnalysisRequest ¶

type AnalysisRequest struct {
	Component     uuid.UUID             `json:"component"`
	Project       uuid.UUID             `json:"project"`
	Vulnerability uuid.UUID             `json:"vulnerability"`
	Comment       string                `json:"comment,omitempty"`
	State         AnalysisState         `json:"analysisState,omitempty"`
	Justification AnalysisJustification `json:"analysisJustification,omitempty"`
	Response      AnalysisResponse      `json:"analysisResponse,omitempty"`
	Details       string                `json:"analysisDetails,omitempty"`
	Suppressed    *bool                 `json:"isSuppressed,omitempty"`
}

type AnalysisResponse ¶

type AnalysisResponse string
const (
	AnalysisResponseCanNotFix           AnalysisResponse = "CAN_NOT_FIX"
	AnalysisResponseNotSet              AnalysisResponse = "NOT_SET"
	AnalysisResponseRollback            AnalysisResponse = "ROLLBACK"
	AnalysisResponseUpdate              AnalysisResponse = "UPDATE"
	AnalysisResponseWillNotFix          AnalysisResponse = "WILL_NOT_FIX"
	AnalysisResponseWorkaroundAvailable AnalysisResponse = "WORKAROUND_AVAILABLE"
)

type AnalysisService ¶

type AnalysisService struct {
	// contains filtered or unexported fields
}

func (AnalysisService) Create ¶

func (as AnalysisService) Create(ctx context.Context, analysisReq AnalysisRequest) (a Analysis, err error)

func (AnalysisService) Get ¶

func (as AnalysisService) Get(ctx context.Context, component, project, vulnerability uuid.UUID) (a Analysis, err error)

type AnalysisState ¶

type AnalysisState string
const (
	AnalysisStateExploitable   AnalysisState = "EXPLOITABLE"
	AnalysisStateFalsePositive AnalysisState = "FALSE_POSITIVE"
	AnalysisStateInTriage      AnalysisState = "IN_TRIAGE"
	AnalysisStateNotAffected   AnalysisState = "NOT_AFFECTED"
	AnalysisStateNotSet        AnalysisState = "NOT_SET"
	AnalysisStateResolved      AnalysisState = "RESOLVED"
)

type BOMFormat ¶

type BOMFormat string
const (
	BOMFormatJSON BOMFormat = "JSON"
	BOMFormatXML  BOMFormat = "XML"
)

type BOMService ¶

type BOMService struct {
	// contains filtered or unexported fields
}

func (BOMService) ExportComponent ¶

func (bs BOMService) ExportComponent(ctx context.Context, componentUUID uuid.UUID, format BOMFormat) (bom string, err error)

func (BOMService) ExportProject ¶

func (bs BOMService) ExportProject(ctx context.Context, projectUUID uuid.UUID, format BOMFormat, variant BOMVariant) (bom string, err error)

func (BOMService) IsBeingProcessed deprecated

func (bs BOMService) IsBeingProcessed(ctx context.Context, token BOMUploadToken) (bool, error)

IsBeingProcessed checks whether the BOM associated with a given token is still being processed.

Deprecated: for server versions 4.11.0 and above, EventService.IsBeingProcessed should be used.

func (BOMService) PostBom ¶ added in v0.13.0

func (bs BOMService) PostBom(ctx context.Context, uploadReq BOMUploadRequest) (token BOMUploadToken, err error)

func (BOMService) Upload ¶

func (bs BOMService) Upload(ctx context.Context, uploadReq BOMUploadRequest) (token BOMUploadToken, err error)

type BOMUploadRequest ¶

type BOMUploadRequest struct {
	ProjectUUID    *uuid.UUID `json:"project,omitempty"`
	ProjectName    string     `json:"projectName,omitempty"`
	ProjectVersion string     `json:"projectVersion,omitempty"`
	ProjectTags    []Tag      `json:"projectTags,omitempty"`            // Since v4.12.0
	ParentUUID     *uuid.UUID `json:"parentUUID,omitempty"`             // Since v4.8.0
	ParentName     string     `json:"parentName,omitempty"`             // Since v4.8.0
	ParentVersion  string     `json:"parentVersion,omitempty"`          // Since v4.8.0
	IsLatest       *bool      `json:"isLatestProjectVersion,omitempty"` // Since v4.12.0
	AutoCreate     bool       `json:"autoCreate"`
	BOM            string     `json:"bom"`
}

type BOMUploadToken ¶

type BOMUploadToken string

type BOMVariant ¶

type BOMVariant string
const (
	BOMVariantInventory           BOMVariant = "inventory"
	BOMVariantVDR                 BOMVariant = "vdr" // Since v4.7.0
	BOMVariantWithVulnerabilities BOMVariant = "withVulnerabilities"
)

type CWE ¶

type CWE struct {
	ID   int    `json:"cweId"`
	Name string `json:"name"`
}

type Client ¶

type Client struct {
	About             AboutService
	ACL               ACLService
	Analysis          AnalysisService
	BOM               BOMService
	Component         ComponentService
	Config            ConfigService
	Event             EventService
	Finding           FindingService
	Health            HealthService
	LDAP              LDAPService
	License           LicenseService
	Metrics           MetricsService
	OIDC              OIDCService
	Permission        PermissionService
	Policy            PolicyService
	PolicyCondition   PolicyConditionService
	PolicyViolation   PolicyViolationService
	Project           ProjectService
	ProjectProperty   ProjectPropertyService
	Repository        RepositoryService
	Tag               TagService
	Team              TeamService
	User              UserService
	VEX               VEXService
	ViolationAnalysis ViolationAnalysisService
	Vulnerability     VulnerabilityService
	// contains filtered or unexported fields
}

func NewClient ¶

func NewClient(baseURL string, options ...ClientOption) (*Client, error)

func (Client) BaseURL ¶

func (c Client) BaseURL() *url.URL

BaseURL provides a copy of the Dependency-Track base URL.

type ClientOption ¶

type ClientOption func(*Client) error

func WithAPIKey ¶

func WithAPIKey(apiKey string) ClientOption

func WithBearerToken ¶

func WithBearerToken(token string) ClientOption

func WithDebug ¶

func WithDebug(debug bool) ClientOption

WithDebug toggles the debug mode. When enabled, HTTP requests and responses will be logged to stderr. DO NOT USE IN PRODUCTION, authorization headers are not cleared!

func WithHttpClient ¶ added in v0.11.0

func WithHttpClient(client *http.Client) ClientOption

WithHttpClient overrides the default HttpClient.

func WithMTLS ¶ added in v0.10.0

func WithMTLS(caCertFile string, clientCertFile string, clientKeyFile string) ClientOption

WithMTLS configures the http client to use client certificates

func WithTimeout ¶

func WithTimeout(timeout time.Duration) ClientOption

WithTimeout overrides the default timeout.

func WithUserAgent ¶

func WithUserAgent(userAgent string) ClientOption

WithUserAgent overrides the default user agent.

type CollectionLogic ¶ added in v0.18.0

type CollectionLogic string
var (
	CollectionLogicNone                           CollectionLogic = "NONE"
	CollectionLogicAggregateDirectChildren        CollectionLogic = "AGGREGATE_DIRECT_CHILDREN"
	CollectionLogicAggregateDirectChildrenWithTag CollectionLogic = "AGGREGATE_DIRECT_CHILDREN_WITH_TAG"
	CollectionLogicAggregateLatestVersionChildren CollectionLogic = "AGGREGATE_LATEST_VERSION_CHILDREN"
)

type Component ¶

type Component struct {
	UUID               uuid.UUID                `json:"uuid,omitempty"`
	Author             string                   `json:"author,omitempty"`
	Publisher          string                   `json:"publisher,omitempty"`
	Group              string                   `json:"group,omitempty"`
	Name               string                   `json:"name"`
	Version            string                   `json:"version"`
	Classifier         string                   `json:"classifier,omitempty"`
	FileName           string                   `json:"filename,omitempty"`
	Extension          string                   `json:"extension,omitempty"`
	MD5                string                   `json:"md5,omitempty"`
	SHA1               string                   `json:"sha1,omitempty"`
	SHA256             string                   `json:"sha256,omitempty"`
	SHA384             string                   `json:"sha384,omitempty"`
	SHA512             string                   `json:"sha512,omitempty"`
	SHA3_256           string                   `json:"sha3_256,omitempty"`
	SHA3_384           string                   `json:"sha3_384,omitempty"`
	SHA3_512           string                   `json:"sha3_512,omitempty"`
	BLAKE2b_256        string                   `json:"blake2b_256,omitempty"`
	BLAKE2b_384        string                   `json:"blake2b_384,omitempty"`
	BLAKE2b_512        string                   `json:"blake2b_512,omitempty"`
	BLAKE3             string                   `json:"blake3,omitempty"`
	CPE                string                   `json:"cpe,omitempty"`
	PURL               string                   `json:"purl,omitempty"`
	SWIDTagID          string                   `json:"swidTagId,omitempty"`
	Internal           bool                     `json:"isInternal,omitempty"`
	Description        string                   `json:"description,omitempty"`
	Copyright          string                   `json:"copyright,omitempty"`
	License            string                   `json:"license,omitempty"`
	ResolvedLicense    *License                 `json:"resolvedLicense,omitempty"`
	DirectDependencies string                   `json:"directDependencies,omitempty"`
	Notes              string                   `json:"notes,omitempty"`
	ExternalReferences []ExternalReference      `json:"externalReferences,omitempty"`
	Project            *Project                 `json:"project,omitempty"`
	RepositoryMeta     *RepositoryMetaComponent `json:"repositoryMeta,omitempty"`
}

type ComponentFilterOptions ¶ added in v0.18.0

type ComponentFilterOptions struct {
	OnlyOutdated bool
	OnlyDirect   bool
}

type ComponentIdentityQueryOptions ¶ added in v0.18.0

type ComponentIdentityQueryOptions struct {
	Group     string
	Name      string
	Version   string
	PURL      string
	CPE       string
	SWIDTagID string
	Project   uuid.UUID
}

type ComponentProperty ¶ added in v0.18.0

type ComponentProperty struct {
	Group       string    `json:"groupName,omitempty"`
	Name        string    `json:"propertyName,omitempty"`
	Value       string    `json:"propertyValue,omitempty"`
	Type        string    `json:"propertyType"`
	Description string    `json:"description,omitempty"`
	UUID        uuid.UUID `json:"uuid"`
}

type ComponentService ¶

type ComponentService struct {
	// contains filtered or unexported fields
}

func (ComponentService) Create ¶

func (cs ComponentService) Create(ctx context.Context, projectUUID uuid.UUID, component Component) (c Component, err error)

func (ComponentService) CreateProperty ¶ added in v0.18.0

func (cs ComponentService) CreateProperty(ctx context.Context, componentUUID uuid.UUID, property ComponentProperty) (p ComponentProperty, err error)

func (ComponentService) Delete ¶ added in v0.18.0

func (cs ComponentService) Delete(ctx context.Context, componentUUID uuid.UUID) (err error)

func (ComponentService) DeleteProperty ¶ added in v0.18.0

func (cs ComponentService) DeleteProperty(ctx context.Context, componentUUID, propertyUUID uuid.UUID) (err error)

func (ComponentService) Get ¶

func (cs ComponentService) Get(ctx context.Context, componentUUID uuid.UUID) (c Component, err error)

func (ComponentService) GetAll ¶

func (cs ComponentService) GetAll(ctx context.Context, projectUUID uuid.UUID, po PageOptions, filterOptions ComponentFilterOptions) (p Page[Component], err error)

func (ComponentService) GetByHash ¶ added in v0.18.0

func (cs ComponentService) GetByHash(ctx context.Context, hash string, po PageOptions, so SortOptions) (p Page[Component], err error)

func (ComponentService) GetByIdentity ¶ added in v0.18.0

func (ComponentService) GetProperties ¶ added in v0.18.0

func (cs ComponentService) GetProperties(ctx context.Context, componentUUID uuid.UUID) (ps []ComponentProperty, err error)

func (ComponentService) IdentifyInternal ¶ added in v0.18.0

func (cs ComponentService) IdentifyInternal(ctx context.Context) (err error)

func (ComponentService) Update ¶ added in v0.13.0

func (cs ComponentService) Update(ctx context.Context, component Component) (c Component, err error)

type ConfigProperty ¶ added in v0.15.0

type ConfigProperty struct {
	GroupName   string `json:"groupName"`
	Name        string `json:"propertyName"`
	Value       string `json:"propertyValue,omitempty"`
	Type        string `json:"propertyType"`
	Description string `json:"description,omitempty"`
}

type ConfigPropertyType ¶ added in v0.15.0

type ConfigPropertyType string

type ConfigService ¶ added in v0.15.0

type ConfigService struct {
	// contains filtered or unexported fields
}

func (ConfigService) Get ¶ added in v0.15.0

func (cs ConfigService) Get(ctx context.Context, groupName, propertyName string) (cp ConfigProperty, err error)

func (ConfigService) GetAll ¶ added in v0.15.0

func (cs ConfigService) GetAll(ctx context.Context) (cps []ConfigProperty, err error)

func (ConfigService) Update ¶ added in v0.15.0

func (cs ConfigService) Update(ctx context.Context, config ConfigProperty) (cp ConfigProperty, err error)

func (ConfigService) UpdateAll ¶ added in v0.15.0

func (cs ConfigService) UpdateAll(ctx context.Context, configs []ConfigProperty) (cps []ConfigProperty, err error)

type EventService ¶ added in v0.14.0

type EventService struct {
	// contains filtered or unexported fields
}

func (EventService) IsBeingProcessed ¶ added in v0.14.0

func (es EventService) IsBeingProcessed(ctx context.Context, token EventToken) (bool, error)

IsBeingProcessed checks whether the event associated with a given token is still being processed.

type EventToken ¶ added in v0.14.0

type EventToken string

type EventTokenResponse ¶ added in v0.14.0

type EventTokenResponse struct {
	Token EventToken `json:"token"`
}

type ExternalReference ¶ added in v0.13.0

type ExternalReference struct {
	Type    string `json:"type,omitempty"`
	URL     string `json:"url,omitempty"`
	Comment string `json:"comment,omitempty"`
}

type Finding ¶

type Finding struct {
	Attribution   FindingAttribution   `json:"attribution"`
	Analysis      FindingAnalysis      `json:"analysis"`
	Component     FindingComponent     `json:"component"`
	Matrix        string               `json:"matrix"`
	Vulnerability FindingVulnerability `json:"vulnerability"`
}

type FindingAnalysis ¶ added in v0.9.0

type FindingAnalysis struct {
	State      string `json:"state"`
	Suppressed bool   `json:"isSuppressed"`
}

type FindingAttribution ¶

type FindingAttribution struct {
	AlternateIdentifier string    `json:"alternateIdentifier"`
	AnalyzerIdentity    string    `json:"analyzerIdentity"`
	AttributedOn        int       `json:"attributedOn"`
	ReferenceURL        string    `json:"referenceUrl"`
	UUID                uuid.UUID `json:"uuid"`
}

type FindingComponent ¶ added in v0.9.0

type FindingComponent struct {
	UUID          uuid.UUID `json:"uuid"`
	Group         string    `json:"group"`
	Name          string    `json:"name"`
	Version       string    `json:"version"`
	CPE           string    `json:"cpe"`
	PURL          string    `json:"purl"`
	LatestVersion string    `json:"latestVersion"`
	Project       uuid.UUID `json:"project"`
}

type FindingService ¶

type FindingService struct {
	// contains filtered or unexported fields
}

func (FindingService) AnalyzeProject ¶ added in v0.9.0

func (f FindingService) AnalyzeProject(ctx context.Context, projectUUID uuid.UUID) (token BOMUploadToken, err error)

AnalyzeProject triggers an analysis for a given project. This feature is available in Dependency-Track v4.7.0 and newer.

func (FindingService) ExportFPF ¶ added in v0.9.0

func (f FindingService) ExportFPF(ctx context.Context, projectUUID uuid.UUID) (d []byte, err error)

ExportFPF exports the findings of a given project in the File Packaging Format (FPF).

func (FindingService) GetAll ¶

func (f FindingService) GetAll(ctx context.Context, projectUUID uuid.UUID, suppressed bool, po PageOptions) (p Page[Finding], err error)

GetAll fetches all findings for a given project.

type FindingVulnerability ¶ added in v0.9.0

type FindingVulnerability struct {
	UUID                        uuid.UUID            `json:"uuid"`
	VulnID                      string               `json:"vulnId"`
	Source                      string               `json:"source"`
	Aliases                     []VulnerabilityAlias `json:"aliases"`
	Title                       string               `json:"title"`
	SubTitle                    string               `json:"subTitle"`
	Description                 string               `json:"description"`
	Recommendation              string               `json:"recommendation"`
	CVSSV2BaseScore             float64              `json:"cvssV2BaseScore"`
	CVSSV3BaseScore             float64              `json:"cvssV3BaseScore"`
	Severity                    string               `json:"severity"`
	SeverityRank                int                  `json:"severityRank"`
	OWASPRRBusinessImpactScore  float64              `json:"owaspBusinessImpactScore"`
	OWASPRRLikelihoodScore      float64              `json:"owaspLikelihoodScore"`
	OWASPRRTechnicalImpactScore float64              `json:"owaspTechnicalImpactScore"`
	EPSSScore                   float64              `json:"epssScore"`
	EPSSPercentile              float64              `json:"epssPercentile"`
	CWEs                        []CWE                `json:"cwes"`
}

type Health ¶ added in v0.18.0

type Health struct {
	Status string        `json:"status"`
	Checks []HealthCheck `json:"checks"`
}

type HealthCheck ¶ added in v0.18.0

type HealthCheck struct {
	Name   string      `json:"name"`
	Status string      `json:"status"`
	Data   interface{} `json:"data,omitempty"`
}

type HealthService ¶ added in v0.18.0

type HealthService struct {
	// contains filtered or unexported fields
}

func (HealthService) Get ¶ added in v0.18.0

func (hs HealthService) Get(ctx context.Context) (h Health, err error)

type IdentifiableObject ¶ added in v0.18.0

type IdentifiableObject struct {
	UUID uuid.UUID `json:"uuid"`
}

type LDAPService ¶ added in v0.17.0

type LDAPService struct {
	// contains filtered or unexported fields
}

func (LDAPService) AddMapping ¶ added in v0.17.0

func (s LDAPService) AddMapping(ctx context.Context, mapping MappedLdapGroupRequest) (g MappedLdapGroup, err error)

func (LDAPService) CreateUser ¶ added in v0.17.0

func (s LDAPService) CreateUser(ctx context.Context, user LdapUser) (userOut LdapUser, err error)

func (LDAPService) DeleteUser ¶ added in v0.17.0

func (s LDAPService) DeleteUser(ctx context.Context, user LdapUser) (err error)

func (LDAPService) GetAllAccessibleGroups ¶ added in v0.17.0

func (s LDAPService) GetAllAccessibleGroups(ctx context.Context, po PageOptions) (gs Page[string], err error)

func (LDAPService) GetTeamMappings ¶ added in v0.17.0

func (s LDAPService) GetTeamMappings(ctx context.Context, teamUUID uuid.UUID) (gs []MappedLdapGroup, err error)

func (LDAPService) GetUsers ¶ added in v0.17.0

func (s LDAPService) GetUsers(ctx context.Context, po PageOptions) (us Page[LdapUser], err error)

func (LDAPService) RemoveMapping ¶ added in v0.17.0

func (s LDAPService) RemoveMapping(ctx context.Context, mappingId uuid.UUID) (err error)

type LdapUser ¶ added in v0.17.0

type LdapUser struct {
	Username          string       `json:"username,omitempty"`
	DistinguishedName string       `json:"dn,omitempty"`
	Teams             []Team       `json:"teams,omitempty"`
	Email             string       `json:"email,omitempty"`
	Permissions       []Permission `json:"permissions,omitempty"`
}

type License ¶

type License struct {
	UUID                uuid.UUID `json:"uuid"`
	Name                string    `json:"name"`
	Text                string    `json:"text"`
	Template            string    `json:"template"`
	Header              string    `json:"header"`
	Comment             string    `json:"comment"`
	LicenseID           string    `json:"licenseId"`
	OSIApproved         bool      `json:"isOsiApproved"`
	FSFLibre            bool      `json:"isFsfLibre"`
	DeprecatedLicenseID bool      `json:"isDeprecatedLicenseId"`
	SeeAlso             []string  `json:"seeAlso"`
}

type LicenseService ¶

type LicenseService struct {
	// contains filtered or unexported fields
}

func (LicenseService) GetAll ¶

func (l LicenseService) GetAll(ctx context.Context, po PageOptions) (p Page[License], err error)

type ManagedUser ¶ added in v0.18.0

type ManagedUser struct {
	Username            string       `json:"username"`
	LastPasswordChange  int          `json:"lastPasswordChange"`
	Fullname            string       `json:"fullname,omitempty"`
	Email               string       `json:"email,omitempty"`
	Suspended           bool         `json:"suspended,omitempty"`
	ForcePasswordChange bool         `json:"forcePasswordChange,omitempty"`
	NonExpiryPassword   bool         `json:"nonExpiryPassword,omitempty"`
	Teams               []Team       `json:"teams,omitempty"`
	Permissions         []Permission `json:"permissions,omitempty"`
	NewPassword         string       `json:"newPassword,omitempty"`
	ConfirmPassword     string       `json:"confirmPassword,omitempty"`
}

type MappedLdapGroup ¶ added in v0.17.0

type MappedLdapGroup struct {
	DistinguishedName string    `json:"dn,omitempty"`
	UUID              uuid.UUID `json:"uuid"`
}

type MappedLdapGroupRequest ¶ added in v0.17.0

type MappedLdapGroupRequest struct {
	Team              uuid.UUID `json:"team"`
	DistinguishedName string    `json:"dn"`
}

type MetricsService ¶

type MetricsService struct {
	// contains filtered or unexported fields
}

func (MetricsService) LatestPortfolioMetrics ¶

func (ms MetricsService) LatestPortfolioMetrics(ctx context.Context) (m PortfolioMetrics, err error)

func (MetricsService) LatestProjectMetrics ¶

func (ms MetricsService) LatestProjectMetrics(ctx context.Context, projectUUID uuid.UUID) (m ProjectMetrics, err error)

func (MetricsService) PortfolioMetricsSince ¶

func (ms MetricsService) PortfolioMetricsSince(ctx context.Context, date time.Time) (m []PortfolioMetrics, err error)

func (MetricsService) PortfolioMetricsSinceDays ¶

func (ms MetricsService) PortfolioMetricsSinceDays(ctx context.Context, days uint) (m []PortfolioMetrics, err error)

func (MetricsService) ProjectMetricsSince ¶

func (ms MetricsService) ProjectMetricsSince(ctx context.Context, projectUUID uuid.UUID, date time.Time) (m []ProjectMetrics, err error)

func (MetricsService) ProjectMetricsSinceDays ¶

func (ms MetricsService) ProjectMetricsSinceDays(ctx context.Context, projectUUID uuid.UUID, days uint) (m []ProjectMetrics, err error)

func (MetricsService) RefreshPortfolioMetrics ¶

func (ms MetricsService) RefreshPortfolioMetrics(ctx context.Context) (err error)

func (MetricsService) RefreshProjectMetrics ¶

func (ms MetricsService) RefreshProjectMetrics(ctx context.Context, projectUUID uuid.UUID) (err error)

type OIDCGroup ¶ added in v0.13.0

type OIDCGroup struct {
	Name string    `json:"name,omitempty"`
	UUID uuid.UUID `json:"uuid,omitempty"`
}

type OIDCMapping ¶ added in v0.13.0

type OIDCMapping struct {
	Group OIDCGroup `json:"group"`
	UUID  uuid.UUID `json:"uuid"`
}

type OIDCMappingRequest ¶ added in v0.13.0

type OIDCMappingRequest struct {
	Team  uuid.UUID `json:"team"`
	Group uuid.UUID `json:"group"`
}

type OIDCService ¶ added in v0.13.0

type OIDCService struct {
	// contains filtered or unexported fields
}

func (OIDCService) AddTeamMapping ¶ added in v0.13.0

func (s OIDCService) AddTeamMapping(ctx context.Context, mapping OIDCMappingRequest) (m OIDCMapping, err error)

func (OIDCService) Available ¶ added in v0.13.0

func (s OIDCService) Available(ctx context.Context) (available bool, err error)

func (OIDCService) CreateGroup ¶ added in v0.13.0

func (s OIDCService) CreateGroup(ctx context.Context, name string) (g OIDCGroup, err error)

func (OIDCService) CreateUser ¶ added in v0.18.0

func (s OIDCService) CreateUser(ctx context.Context, userReq OIDCUser) (userRes OIDCUser, err error)

func (OIDCService) DeleteGroup ¶ added in v0.13.0

func (s OIDCService) DeleteGroup(ctx context.Context, groupUUID uuid.UUID) (err error)

func (OIDCService) DeleteUser ¶ added in v0.18.0

func (s OIDCService) DeleteUser(ctx context.Context, user OIDCUser) (err error)

func (OIDCService) GetAllGroups ¶ added in v0.13.0

func (s OIDCService) GetAllGroups(ctx context.Context) (groups []OIDCGroup, err error)

func (OIDCService) GetAllTeamsOf ¶ added in v0.13.0

func (s OIDCService) GetAllTeamsOf(ctx context.Context, group OIDCGroup) (teams []Team, err error)

func (OIDCService) GetAllUsers ¶ added in v0.18.0

func (s OIDCService) GetAllUsers(ctx context.Context) (p Page[OIDCUser], err error)

func (OIDCService) Login ¶ added in v0.18.0

func (s OIDCService) Login(ctx context.Context, tokens OIDCTokens) (token string, err error)

func (OIDCService) RemoveTeamMapping ¶ added in v0.13.0

func (s OIDCService) RemoveTeamMapping(ctx context.Context, mappingID uuid.UUID) (err error)

func (OIDCService) RemoveTeamMapping2 ¶ added in v0.18.0

func (s OIDCService) RemoveTeamMapping2(ctx context.Context, groupID, teamID uuid.UUID) (err error)

func (OIDCService) UpdateGroup ¶ added in v0.13.0

func (s OIDCService) UpdateGroup(ctx context.Context, group OIDCGroup) (g OIDCGroup, err error)

type OIDCTokens ¶ added in v0.18.0

type OIDCTokens struct {
	ID     string `json:"idToken"`
	Access string `json:"accessToken,omitempty"`
}

type OIDCUser ¶ added in v0.18.0

type OIDCUser struct {
	Username          string       `json:"username"`
	SubjectIdentifier string       `json:"subjectIdentifier"`
	Email             string       `json:"email"`
	Teams             []Team       `json:"teams"`
	Permissions       []Permission `json:"permissions"`
}

type Page ¶

type Page[T any] struct {
	Items      []T // Items on this page
	TotalCount int // Total number of items
}

type PageOptions ¶

type PageOptions struct {
	Offset     int // Offset of the elements to return
	PageNumber int // Page to return
	PageSize   int // Amount of elements to return per page
}

type ParentRef ¶ added in v0.9.0

type ParentRef struct {
	UUID uuid.UUID `json:"uuid,omitempty"`
}

type Permission ¶ added in v0.9.0

type Permission struct {
	Name        string `json:"name"`
	Description string `json:"description"`
}

type PermissionService ¶ added in v0.9.0

type PermissionService struct {
	// contains filtered or unexported fields
}

func (PermissionService) AddPermissionToTeam ¶ added in v0.9.0

func (ps PermissionService) AddPermissionToTeam(ctx context.Context, permission Permission, team uuid.UUID) (t Team, err error)

func (PermissionService) AddPermissionToUser ¶ added in v0.18.0

func (ps PermissionService) AddPermissionToUser(ctx context.Context, permission Permission, username string) (user UserPrincipal, err error)

func (PermissionService) GetAll ¶ added in v0.9.0

func (ps PermissionService) GetAll(ctx context.Context, po PageOptions) (p Page[Permission], err error)

func (PermissionService) RemovePermissionFromTeam ¶ added in v0.13.0

func (ps PermissionService) RemovePermissionFromTeam(ctx context.Context, permission Permission, team uuid.UUID) (t Team, err error)

func (PermissionService) RemovePermissionFromUser ¶ added in v0.18.0

func (ps PermissionService) RemovePermissionFromUser(ctx context.Context, permission Permission, username string) (user UserPrincipal, err error)

type Policy ¶

type Policy struct {
	UUID             uuid.UUID            `json:"uuid,omitempty"`
	Name             string               `json:"name"`
	Operator         PolicyOperator       `json:"operator"`
	ViolationState   PolicyViolationState `json:"violationState"`
	PolicyConditions []PolicyCondition    `json:"policyConditions,omitempty"`
	IncludeChildren  bool                 `json:"includeChildren,omitempty"`
	Global           bool                 `json:"global,omitempty"`
	Projects         []Project            `json:"projects,omitempty"`
	Tags             []Tag                `json:"tags,omitempty"`
}

type PolicyCondition ¶

type PolicyCondition struct {
	UUID     uuid.UUID               `json:"uuid,omitempty"`
	Policy   *Policy                 `json:"policy,omitempty"`
	Operator PolicyConditionOperator `json:"operator"`
	Subject  PolicyConditionSubject  `json:"subject"`
	Value    string                  `json:"value"`
}

type PolicyConditionOperator ¶ added in v0.12.0

type PolicyConditionOperator string
const (
	PolicyConditionOperatorIs                        PolicyConditionOperator = "IS"
	PolicyConditionOperatorIsNot                     PolicyConditionOperator = "IS_NOT"
	PolicyConditionOperatorMatches                   PolicyConditionOperator = "MATCHES"
	PolicyConditionOperatorNoMatch                   PolicyConditionOperator = "NO_MATCH"
	PolicyConditionOperatorNumericGreaterThan        PolicyConditionOperator = "NUMERIC_GREATER_THAN"
	PolicyConditionOperatorNumericLessThan           PolicyConditionOperator = "NUMERIC_LESS_THAN"
	PolicyConditionOperatorNumericEqual              PolicyConditionOperator = "NUMERIC_EQUAL"
	PolicyConditionOperatorNumericNotEqual           PolicyConditionOperator = "NUMERIC_NOT_EQUAL"
	PolicyConditionOperatorNumericGreaterThanOrEqual PolicyConditionOperator = "NUMERIC_GREATER_THAN_OR_EQUAL"
	PolicyConditionOperatorNumericLesserThanOrEqual  PolicyConditionOperator = "NUMERIC_LESSER_THAN_OR_EQUAL"
	PolicyConditionOperatorContainsAll               PolicyConditionOperator = "CONTAINS_ALL"
	PolicyConditionOperatorContainsAny               PolicyConditionOperator = "CONTAINS_ANY"
)

type PolicyConditionService ¶ added in v0.12.0

type PolicyConditionService struct {
	// contains filtered or unexported fields
}

func (PolicyConditionService) Create ¶ added in v0.12.0

func (pcs PolicyConditionService) Create(ctx context.Context, policyUUID uuid.UUID, policyCondition PolicyCondition) (p PolicyCondition, err error)

func (PolicyConditionService) Delete ¶ added in v0.12.0

func (pcs PolicyConditionService) Delete(ctx context.Context, policyConditionUUID uuid.UUID) (err error)

func (PolicyConditionService) Update ¶ added in v0.12.0

func (pcs PolicyConditionService) Update(ctx context.Context, policyCondition PolicyCondition) (p PolicyCondition, err error)

type PolicyConditionSubject ¶ added in v0.12.0

type PolicyConditionSubject string
const (
	PolicyConditionSubjectAge             PolicyConditionSubject = "AGE"
	PolicyConditionSubjectCoordinates     PolicyConditionSubject = "COORDINATES"
	PolicyConditionSubjectCPE             PolicyConditionSubject = "CPE"
	PolicyConditionSubjectLicense         PolicyConditionSubject = "LICENSE"
	PolicyConditionSubjectLicenseGroup    PolicyConditionSubject = "LICENSE_GROUP"
	PolicyConditionSubjectPackageURL      PolicyConditionSubject = "PACKAGE_URL"
	PolicyConditionSubjectSeverity        PolicyConditionSubject = "SEVERITY"
	PolicyConditionSubjectSWIDTagID       PolicyConditionSubject = "SWID_TAGID"
	PolicyConditionSubjectVersion         PolicyConditionSubject = "VERSION"
	PolicyConditionSubjectComponentHash   PolicyConditionSubject = "COMPONENT_HASH"
	PolicyConditionSubjectCWE             PolicyConditionSubject = "CWE"
	PolicyConditionSubjectVulnerabilityID PolicyConditionSubject = "VULNERABILITY_ID"
)

type PolicyOperator ¶ added in v0.12.0

type PolicyOperator string
const (
	PolicyOperatorAll PolicyOperator = "ALL"
	PolicyOperatorAny PolicyOperator = "ANY"
)

type PolicyService ¶

type PolicyService struct {
	// contains filtered or unexported fields
}

func (PolicyService) AddProject ¶ added in v0.12.0

func (ps PolicyService) AddProject(ctx context.Context, policyUUID, projectUUID uuid.UUID) (p Policy, err error)

func (PolicyService) AddTag ¶ added in v0.12.0

func (ps PolicyService) AddTag(ctx context.Context, policyUUID uuid.UUID, tagName string) (p Policy, err error)

func (PolicyService) Create ¶ added in v0.12.0

func (ps PolicyService) Create(ctx context.Context, policy Policy) (p Policy, err error)

func (PolicyService) Delete ¶ added in v0.12.0

func (ps PolicyService) Delete(ctx context.Context, policyUUID uuid.UUID) (err error)

func (PolicyService) DeleteProject ¶ added in v0.12.0

func (ps PolicyService) DeleteProject(ctx context.Context, policyUUID, projectUUID uuid.UUID) (p Policy, err error)

func (PolicyService) DeleteTag ¶ added in v0.12.0

func (ps PolicyService) DeleteTag(ctx context.Context, policyUUID uuid.UUID, tagName string) (p Policy, err error)

func (PolicyService) Get ¶

func (ps PolicyService) Get(ctx context.Context, policyUUID uuid.UUID) (p Policy, err error)

func (PolicyService) GetAll ¶

func (ps PolicyService) GetAll(ctx context.Context, po PageOptions) (p Page[Policy], err error)

func (PolicyService) Update ¶ added in v0.12.0

func (ps PolicyService) Update(ctx context.Context, policy Policy) (p Policy, err error)

type PolicyViolation ¶

type PolicyViolation struct {
	UUID            uuid.UUID
	Component       Component          `json:"component"`
	Project         Project            `json:"project"`
	PolicyCondition *PolicyCondition   `json:"policyCondition,omitempty"`
	Type            string             `json:"type"`
	Text            string             `json:"text"`
	Analysis        *ViolationAnalysis `json:"analysis,omitempty"`
}

type PolicyViolationService ¶

type PolicyViolationService struct {
	// contains filtered or unexported fields
}

func (PolicyViolationService) GetAll ¶

func (pvs PolicyViolationService) GetAll(ctx context.Context, suppressed bool, po PageOptions) (p Page[PolicyViolation], err error)

func (PolicyViolationService) GetAllForComponent ¶

func (pvs PolicyViolationService) GetAllForComponent(ctx context.Context, componentUUID uuid.UUID, suppressed bool, po PageOptions) (p Page[PolicyViolation], err error)

func (PolicyViolationService) GetAllForProject ¶

func (pvs PolicyViolationService) GetAllForProject(ctx context.Context, projectUUID uuid.UUID, suppressed bool, po PageOptions) (p Page[PolicyViolation], err error)

type PolicyViolationState ¶ added in v0.12.0

type PolicyViolationState string
const (
	PolicyViolationStateInfo PolicyViolationState = "INFO"
	PolicyViolationStateWarn PolicyViolationState = "WARN"
	PolicyViolationStateFail PolicyViolationState = "FAIL"
)

type PortfolioMetrics ¶

type PortfolioMetrics struct {
	FirstOccurrence                      int     `json:"firstOccurrence"`
	LastOccurrence                       int     `json:"lastOccurrence"`
	InheritedRiskScore                   float64 `json:"inheritedRiskScore"`
	Vulnerabilities                      int     `json:"vulnerabilities"`
	VulnerableProjects                   int     `json:"vulnerableProjects"`
	VulnerableComponents                 int     `json:"vulnerableComponents"`
	Projects                             int     `json:"projects"`
	Components                           int     `json:"components"`
	Suppressed                           int     `json:"suppressed"`
	Critical                             int     `json:"critical"`
	High                                 int     `json:"high"`
	Medium                               int     `json:"medium"`
	Low                                  int     `json:"low"`
	Unassigned                           int     `json:"unassigned"`
	FindingsTotal                        int     `json:"findingsTotal"`
	FindingsAudited                      int     `json:"findingsAudited"`
	FindingsUnaudited                    int     `json:"findingsUnaudited"`
	PolicyViolationsTotal                int     `json:"policyViolationsTotal"`
	PolicyViolationsFail                 int     `json:"policyViolationsFail"`
	PolicyViolationsWarn                 int     `json:"policyViolationsWarn"`
	PolicyViolationsInfo                 int     `json:"policyViolationsInfo"`
	PolicyViolationsAudited              int     `json:"policyViolationsAudited"`
	PolicyViolationsUnaudited            int     `json:"policyViolationsUnaudited"`
	PolicyViolationsSecurityTotal        int     `json:"policyViolationsSecurityTotal"`
	PolicyViolationsSecurityAudited      int     `json:"policyViolationsSecurityAudited"`
	PolicyViolationsSecurityUnaudited    int     `json:"policyViolationsSecurityUnaudited"`
	PolicyViolationsLicenseTotal         int     `json:"policyViolationsLicenseTotal"`
	PolicyViolationsLicenseAudited       int     `json:"policyViolationsLicenseAudited"`
	PolicyViolationsLicenseUnaudited     int     `json:"policyViolationsLicenseUnaudited"`
	PolicyViolationsOperationalTotal     int     `json:"policyViolationsOperationalTotal"`
	PolicyViolationsOperationalAudited   int     `json:"policyViolationsOperationalAudited"`
	PolicyViolationsOperationalUnaudited int     `json:"policyViolationsOperationalUnaudited"`
}

type Project ¶

type Project struct {
	UUID               uuid.UUID           `json:"uuid,omitempty"`
	Author             string              `json:"author,omitempty"`
	Publisher          string              `json:"publisher,omitempty"`
	Group              string              `json:"group,omitempty"`
	Name               string              `json:"name,omitempty"`
	Description        string              `json:"description,omitempty"`
	Version            string              `json:"version,omitempty"`
	Classifier         string              `json:"classifier,omitempty"`
	CPE                string              `json:"cpe,omitempty"`
	PURL               string              `json:"purl,omitempty"`
	SWIDTagID          string              `json:"swidTagId,omitempty"`
	DirectDependencies string              `json:"directDependencies,omitempty"`
	Properties         []ProjectProperty   `json:"properties,omitempty"`
	Tags               []Tag               `json:"tags,omitempty"`
	Active             bool                `json:"active"`
	IsLatest           *bool               `json:"isLatest,omitempty"` // Since v4.12.0
	Metrics            ProjectMetrics      `json:"metrics"`
	ParentRef          *ParentRef          `json:"parent,omitempty"`
	LastBOMImport      int                 `json:"lastBomImport"`
	ExternalReferences []ExternalReference `json:"externalReferences,omitempty"`
	CollectionLogic    *CollectionLogic    `json:"collectionLogic,omitempty"` // Since v4.13.0
	CollectionTag      *Tag                `json:"collectionTag,omitempty"`   // Since v4.13.0
}

type ProjectCloneRequest ¶

type ProjectCloneRequest struct {
	ProjectUUID             uuid.UUID `json:"project"`
	Version                 string    `json:"version"`
	IncludeACL              bool      `json:"includeACL"`
	IncludeAuditHistory     bool      `json:"includeAuditHistory"`
	IncludeComponents       bool      `json:"includeComponents"`
	IncludePolicyViolations *bool     `json:"includePolicyViolations,omitempty"` // Since v4.11.0
	IncludeProperties       bool      `json:"includeProperties"`
	IncludeServices         bool      `json:"includeServices"`
	IncludeTags             bool      `json:"includeTags"`
	MakeCloneLatest         *bool     `json:"makeCloneLatest,omitempty"` // Since v4.12.0
}

type ProjectMetrics ¶

type ProjectMetrics struct {
	FirstOccurrence                      int     `json:"firstOccurrence"`
	LastOccurrence                       int     `json:"lastOccurrence"`
	InheritedRiskScore                   float64 `json:"inheritedRiskScore"`
	Vulnerabilities                      int     `json:"vulnerabilities"`
	VulnerableComponents                 int     `json:"vulnerableComponents"`
	Components                           int     `json:"components"`
	Suppressed                           int     `json:"suppressed"`
	Critical                             int     `json:"critical"`
	High                                 int     `json:"high"`
	Medium                               int     `json:"medium"`
	Low                                  int     `json:"low"`
	Unassigned                           int     `json:"unassigned"`
	FindingsTotal                        int     `json:"findingsTotal"`
	FindingsAudited                      int     `json:"findingsAudited"`
	FindingsUnaudited                    int     `json:"findingsUnaudited"`
	PolicyViolationsTotal                int     `json:"policyViolationsTotal"`
	PolicyViolationsFail                 int     `json:"policyViolationsFail"`
	PolicyViolationsWarn                 int     `json:"policyViolationsWarn"`
	PolicyViolationsInfo                 int     `json:"policyViolationsInfo"`
	PolicyViolationsAudited              int     `json:"policyViolationsAudited"`
	PolicyViolationsUnaudited            int     `json:"policyViolationsUnaudited"`
	PolicyViolationsSecurityTotal        int     `json:"policyViolationsSecurityTotal"`
	PolicyViolationsSecurityAudited      int     `json:"policyViolationsSecurityAudited"`
	PolicyViolationsSecurityUnaudited    int     `json:"policyViolationsSecurityUnaudited"`
	PolicyViolationsLicenseTotal         int     `json:"policyViolationsLicenseTotal"`
	PolicyViolationsLicenseAudited       int     `json:"policyViolationsLicenseAudited"`
	PolicyViolationsLicenseUnaudited     int     `json:"policyViolationsLicenseUnaudited"`
	PolicyViolationsOperationalTotal     int     `json:"policyViolationsOperationalTotal"`
	PolicyViolationsOperationalAudited   int     `json:"policyViolationsOperationalAudited"`
	PolicyViolationsOperationalUnaudited int     `json:"policyViolationsOperationalUnaudited"`
}

type ProjectProperty ¶

type ProjectProperty struct {
	Group       string `json:"groupName"`
	Name        string `json:"propertyName"`
	Value       string `json:"propertyValue"`
	Type        string `json:"propertyType"`
	Description string `json:"description"`
}

type ProjectPropertyService ¶

type ProjectPropertyService struct {
	// contains filtered or unexported fields
}

func (ProjectPropertyService) Create ¶

func (ps ProjectPropertyService) Create(ctx context.Context, projectUUID uuid.UUID, property ProjectProperty) (p ProjectProperty, err error)

func (ProjectPropertyService) Delete ¶

func (ps ProjectPropertyService) Delete(ctx context.Context, projectUUID uuid.UUID, groupName, propertyName string) (err error)

func (ProjectPropertyService) GetAll ¶

func (ps ProjectPropertyService) GetAll(ctx context.Context, projectUUID uuid.UUID, po PageOptions) (p Page[ProjectProperty], err error)

func (ProjectPropertyService) Update ¶

func (ps ProjectPropertyService) Update(ctx context.Context, projectUUID uuid.UUID, property ProjectProperty) (p ProjectProperty, err error)

type ProjectService ¶

type ProjectService struct {
	// contains filtered or unexported fields
}

func (ProjectService) Clone ¶

func (ps ProjectService) Clone(ctx context.Context, cloneReq ProjectCloneRequest) (token EventToken, err error)

Clone triggers a cloning operation. An EventToken is only returned for server versions 4.11.0 and newer.

func (ProjectService) Create ¶

func (ps ProjectService) Create(ctx context.Context, project Project) (p Project, err error)

func (ProjectService) Delete ¶

func (ps ProjectService) Delete(ctx context.Context, projectUUID uuid.UUID) (err error)

func (ProjectService) Get ¶

func (ps ProjectService) Get(ctx context.Context, projectUUID uuid.UUID) (p Project, err error)

func (ProjectService) GetAll ¶

func (ps ProjectService) GetAll(ctx context.Context, po PageOptions) (p Page[Project], err error)

func (ProjectService) GetAllByTag ¶ added in v0.11.0

func (ps ProjectService) GetAllByTag(ctx context.Context, tag string, excludeInactive, onlyRoot bool, po PageOptions) (p Page[Project], err error)

func (ProjectService) GetChildren ¶ added in v0.18.0

func (ps ProjectService) GetChildren(ctx context.Context, projectUUID uuid.UUID, po PageOptions) (p Page[Project], err error)

func (ProjectService) GetProjectsForName ¶ added in v0.9.0

func (ps ProjectService) GetProjectsForName(ctx context.Context, name string, excludeInactive, onlyRoot bool) (p []Project, err error)

func (ProjectService) Latest ¶ added in v0.16.0

func (ps ProjectService) Latest(ctx context.Context, name string) (p Project, err error)

func (ProjectService) Lookup ¶

func (ps ProjectService) Lookup(ctx context.Context, name, version string) (p Project, err error)

func (ProjectService) Patch ¶

func (ps ProjectService) Patch(ctx context.Context, projectUUID uuid.UUID, project Project) (p Project, err error)

func (ProjectService) Update ¶

func (ps ProjectService) Update(ctx context.Context, project Project) (p Project, err error)

type Repository ¶ added in v0.13.0

type Repository struct {
	Type                   RepositoryType `json:"type"`
	Identifier             string         `json:"identifier"`
	Url                    string         `json:"url"`
	ResolutionOrder        int            `json:"resolutionOrder"`
	Enabled                bool           `json:"enabled"`
	Internal               bool           `json:"internal"`
	AuthenticationRequired bool           `json:"authenticationRequired"`
	Username               string         `json:"username,omitempty"`
	Password               string         `json:"password,omitempty"`
	UUID                   uuid.UUID      `json:"uuid,omitempty"`
}

type RepositoryMetaComponent ¶

type RepositoryMetaComponent struct {
	RepositoryType string `json:"repositoryType"`
	Namespace      string `json:"namespace,omitempty"`
	Name           string `json:"name"`
	LatestVersion  string `json:"latestVersion"`
	Published      int    `json:"published"`
	LastCheck      int    `json:"lastCheck"`
}

type RepositoryService ¶

type RepositoryService struct {
	// contains filtered or unexported fields
}

func (RepositoryService) Create ¶ added in v0.13.0

func (rs RepositoryService) Create(ctx context.Context, repo Repository) (r Repository, err error)

func (RepositoryService) Delete ¶ added in v0.13.0

func (rs RepositoryService) Delete(ctx context.Context, reposUUID uuid.UUID) (err error)

func (RepositoryService) GetAll ¶ added in v0.13.0

func (rs RepositoryService) GetAll(ctx context.Context, po PageOptions) (p Page[Repository], err error)

func (RepositoryService) GetByType ¶ added in v0.13.0

func (rs RepositoryService) GetByType(ctx context.Context, repoType RepositoryType, po PageOptions) (p Page[Repository], err error)

func (RepositoryService) GetMetaComponent ¶

func (rs RepositoryService) GetMetaComponent(ctx context.Context, purl string) (r RepositoryMetaComponent, err error)

func (RepositoryService) Update ¶ added in v0.13.0

func (rs RepositoryService) Update(ctx context.Context, repo Repository) (r Repository, err error)

type RepositoryType ¶ added in v0.13.0

type RepositoryType string

type SortOptions ¶ added in v0.17.0

type SortOptions struct {
	Name  string `json:"sortName"`
	Order string `json:"sortOrder"`
}

type Tag ¶

type Tag struct {
	Name string `json:"name"`
}

type TagListResponseItem ¶ added in v0.17.0

type TagListResponseItem struct {
	Name                  string `json:"name,omitempty"`
	ProjectCount          int64  `json:"projectCount,omitempty"`
	PolicyCount           int64  `json:"policyCount,omitempty"`
	NotificationRuleCount int64  `json:"notificationRuleCount,omitempty"`
}

type TagService ¶ added in v0.17.0

type TagService struct {
	// contains filtered or unexported fields
}

func (TagService) Create ¶ added in v0.17.0

func (ts TagService) Create(ctx context.Context, names []string) (err error)

func (TagService) Delete ¶ added in v0.17.0

func (ts TagService) Delete(ctx context.Context, names []string) (err error)

func (TagService) GetAll ¶ added in v0.17.0

func (TagService) GetNotificationRules ¶ added in v0.17.0

func (ts TagService) GetNotificationRules(ctx context.Context, tag string, po PageOptions, so SortOptions) (p Page[TaggedPolicyListResponseItem], err error)

func (TagService) GetPolicies ¶ added in v0.17.0

func (ts TagService) GetPolicies(ctx context.Context, tag string, po PageOptions, so SortOptions) (p Page[TaggedPolicyListResponseItem], err error)

func (TagService) GetProjects ¶ added in v0.17.0

func (ts TagService) GetProjects(ctx context.Context, tag string, po PageOptions, so SortOptions) (p Page[TaggedProjectListResponseItem], err error)

func (TagService) GetTagsForPolicy ¶ added in v0.17.0

func (ts TagService) GetTagsForPolicy(ctx context.Context, policy uuid.UUID, po PageOptions, so SortOptions) (p Page[Tag], err error)

func (TagService) TagNotificationRules ¶ added in v0.17.0

func (ts TagService) TagNotificationRules(ctx context.Context, tag string, rules []uuid.UUID) (err error)

func (TagService) TagPolicies ¶ added in v0.17.0

func (ts TagService) TagPolicies(ctx context.Context, tag string, policies []uuid.UUID) (err error)

func (TagService) TagProjects ¶ added in v0.17.0

func (ts TagService) TagProjects(ctx context.Context, tag string, projects []uuid.UUID) (err error)

func (TagService) UntagNotificationRules ¶ added in v0.17.0

func (ts TagService) UntagNotificationRules(ctx context.Context, tag string, rules []uuid.UUID) (err error)

func (TagService) UntagPolicies ¶ added in v0.17.0

func (ts TagService) UntagPolicies(ctx context.Context, tag string, policies []uuid.UUID) (err error)

func (TagService) UntagProjects ¶ added in v0.17.0

func (ts TagService) UntagProjects(ctx context.Context, tag string, projects []uuid.UUID) (err error)

type TaggedPolicyListResponseItem ¶ added in v0.17.0

type TaggedPolicyListResponseItem struct {
	UUID uuid.UUID `json:"uuid,omitempty"`
	Name string    `json:"name,omitempty"`
}

type TaggedProjectListResponseItem ¶ added in v0.17.0

type TaggedProjectListResponseItem struct {
	UUID    uuid.UUID `json:"uuid,omitempty"`
	Name    string    `json:"name,omitempty"`
	Version string    `json:"version,omitempty"`
}

type Team ¶

type Team struct {
	UUID             uuid.UUID     `json:"uuid,omitempty"`
	Name             string        `json:"name,omitempty"`
	APIKeys          []APIKey      `json:"apiKeys,omitempty"`
	Permissions      []Permission  `json:"permissions,omitempty"`
	MappedOIDCGroups []OIDCMapping `json:"mappedOidcGroups,omitempty"`
}

type TeamService ¶

type TeamService struct {
	// contains filtered or unexported fields
}

func (TeamService) Create ¶ added in v0.9.0

func (ts TeamService) Create(ctx context.Context, team Team) (t Team, err error)

func (TeamService) Delete ¶ added in v0.9.0

func (ts TeamService) Delete(ctx context.Context, team Team) (err error)

func (TeamService) DeleteAPIKey ¶ added in v0.14.0

func (ts TeamService) DeleteAPIKey(ctx context.Context, publicIdOrKey string) (err error)

func (TeamService) GenerateAPIKey ¶

func (ts TeamService) GenerateAPIKey(ctx context.Context, teamUUID uuid.UUID) (apiKey APIKey, err error)

func (TeamService) Get ¶

func (ts TeamService) Get(ctx context.Context, teamUUID uuid.UUID) (t Team, err error)

func (TeamService) GetAPIKeys ¶ added in v0.14.0

func (ts TeamService) GetAPIKeys(ctx context.Context, teamUUID uuid.UUID) (keys []APIKey, err error)

func (TeamService) GetAll ¶

func (ts TeamService) GetAll(ctx context.Context, po PageOptions) (p Page[Team], err error)

func (TeamService) Update ¶ added in v0.13.0

func (ts TeamService) Update(ctx context.Context, team Team) (t Team, err error)

func (TeamService) UpdateAPIKeyComment ¶ added in v0.14.0

func (ts TeamService) UpdateAPIKeyComment(ctx context.Context, publicIdOrKey, comment string) (commentOut string, err error)

type UserPrincipal ¶ added in v0.18.0

type UserPrincipal struct {
	Teams       []Team       `json:"teams"`
	Username    string       `json:"username"`
	Email       string       `json:"email"`
	Id          int64        `json:"id,omitempty"`
	Permissions []Permission `json:"permissions"`
	Name        string       `json:"name"`
}

type UserService ¶

type UserService struct {
	// contains filtered or unexported fields
}

func (UserService) AddTeamToUser ¶ added in v0.18.0

func (us UserService) AddTeamToUser(ctx context.Context, username string, team uuid.UUID) (user UserPrincipal, err error)

func (UserService) CreateManaged ¶ added in v0.18.0

func (us UserService) CreateManaged(ctx context.Context, usr ManagedUser) (user ManagedUser, err error)

func (UserService) DeleteManaged ¶ added in v0.18.0

func (us UserService) DeleteManaged(ctx context.Context, user ManagedUser) (err error)

func (UserService) ForceChangePassword ¶

func (us UserService) ForceChangePassword(ctx context.Context, username, password, newPassword string) (err error)

func (UserService) GetAllManaged ¶ added in v0.18.0

func (us UserService) GetAllManaged(ctx context.Context, po PageOptions) (p Page[ManagedUser], err error)

func (UserService) GetSelf ¶ added in v0.18.0

func (us UserService) GetSelf(ctx context.Context) (user UserPrincipal, err error)

func (UserService) Login ¶

func (us UserService) Login(ctx context.Context, username, password string) (token string, err error)

func (UserService) RemoveTeamFromUser ¶ added in v0.18.0

func (us UserService) RemoveTeamFromUser(ctx context.Context, username string, team uuid.UUID) (user UserPrincipal, err error)

func (UserService) UpdateManaged ¶ added in v0.18.0

func (us UserService) UpdateManaged(ctx context.Context, usr ManagedUser) (user ManagedUser, err error)

func (UserService) UpdateSelf ¶ added in v0.18.0

func (us UserService) UpdateSelf(ctx context.Context, userReq ManagedUser) (userRes ManagedUser, err error)

type VEXService ¶

type VEXService struct {
	// contains filtered or unexported fields
}

func (VEXService) ExportCycloneDX ¶

func (vs VEXService) ExportCycloneDX(ctx context.Context, projectUUID uuid.UUID) (vex string, err error)

func (VEXService) Upload ¶

func (vs VEXService) Upload(ctx context.Context, uploadReq VEXUploadRequest) (token VEXUploadToken, err error)

type VEXUploadRequest ¶

type VEXUploadRequest struct {
	ProjectUUID    *uuid.UUID `json:"project,omitempty"`
	ProjectName    string     `json:"projectName,omitempty"`
	ProjectVersion string     `json:"projectVersion,omitempty"`
	VEX            string     `json:"vex"`
}

type VEXUploadToken ¶ added in v0.18.0

type VEXUploadToken string

type ViolationAnalysis ¶

type ViolationAnalysis struct {
	Comments   []ViolationAnalysisComment `json:"analysisComments"`
	State      ViolationAnalysisState     `json:"analysisState"`
	Suppressed bool                       `json:"isSuppressed"`
}

type ViolationAnalysisComment ¶

type ViolationAnalysisComment struct {
	Comment   string `json:"comment"`
	Commenter string `json:"commenter"`
	Timestamp int    `json:"timestamp"`
}

type ViolationAnalysisRequest ¶

type ViolationAnalysisRequest struct {
	Component       uuid.UUID              `json:"component"`
	PolicyViolation uuid.UUID              `json:"policyViolation"`
	Comment         string                 `json:"comment,omitempty"`
	State           ViolationAnalysisState `json:"analysisState,omitempty"`
	Suppressed      *bool                  `json:"isSuppressed,omitempty"`
}

type ViolationAnalysisService ¶

type ViolationAnalysisService struct {
	// contains filtered or unexported fields
}

func (ViolationAnalysisService) Get ¶

func (vas ViolationAnalysisService) Get(ctx context.Context, componentUUID, policyViolationUUID uuid.UUID) (va ViolationAnalysis, err error)

func (ViolationAnalysisService) Update ¶

type ViolationAnalysisState ¶

type ViolationAnalysisState string
const (
	ViolationAnalysisStateNotSet   ViolationAnalysisState = "NOT_SET"
	ViolationAnalysisStateApproved ViolationAnalysisState = "APPROVED"
	ViolationAnalysisStateRejected ViolationAnalysisState = "REJECTED"
)

type Vulnerability ¶

type Vulnerability struct {
	UUID                         uuid.UUID            `json:"uuid"`
	VulnID                       string               `json:"vulnId"`
	Source                       string               `json:"source"`
	Aliases                      []VulnerabilityAlias `json:"aliases"`
	Title                        string               `json:"title"`
	SubTitle                     string               `json:"subTitle"`
	Description                  string               `json:"description"`
	Recommendation               string               `json:"recommendation"`
	References                   string               `json:"references"`
	Credits                      string               `json:"credits"`
	Created                      string               `json:"created"`
	Published                    string               `json:"published"`
	Updated                      string               `json:"updated"`
	CWE                          CWE                  `json:"cwe"`
	CWEs                         []CWE                `json:"cwes"`
	CVSSV2BaseScore              float64              `json:"cvssV2BaseScore"`
	CVSSV2ImpactSubScore         float64              `json:"cvssV2ImpactSubScore"`
	CVSSV2ExploitabilitySubScore float64              `json:"cvssV2ExploitabilitySubScore"`
	CVSSV2Vector                 string               `json:"cvssV2Vector"`
	CVSSV3BaseScore              float64              `json:"cvssV3BaseScore"`
	CVSSV3ImpactSubScore         float64              `json:"cvssV3ImpactSubScore"`
	CVSSV3ExploitabilitySubScore float64              `json:"cvssV3ExploitabilitySubScore"`
	CVSSV3Vector                 string               `json:"cvssV3Vector"`
	OWASPRRBusinessImpactScore   float64              `json:"owaspRRBusinessImpactScore"`
	OWASPRRLikelihoodScore       float64              `json:"owaspRRLikelihoodScore"`
	OWASPRRTechnicalImpactScore  float64              `json:"owaspRRTechnicalImpactScore"`
	OWASPRRVector                string               `json:"owaspRRVector"`
	Severity                     string               `json:"severity"`
	EPSSScore                    float64              `json:"epssScore"`
	EPSSPercentile               float64              `json:"epssPercentile"`
	VulnerableVersions           string               `json:"vulnerableVersions"`
	PatchedVersions              string               `json:"patchedVersions"`
	Components                   *[]Component         `json:"components,omitempty"`
}

type VulnerabilityAlias ¶ added in v0.9.0

type VulnerabilityAlias struct {
	CveID      string `json:"cveId"`      // ID of the vuln in the NVD
	GhsaID     string `json:"ghsaId"`     // ID of the vuln in GitHub
	GsdID      string `json:"gsdId"`      // ID of the vuln in the GSD
	InternalID string `json:"internalId"` // ID of the vuln in DT's internal database
	OsvID      string `json:"osvId"`      // ID of the vuln in OSV
	SonatypeId string `json:"sonatypeId"` // ID of the vuln in Sonatype's database
	SnykID     string `json:"snykId"`     // ID of the vuln in Snyk's database
	VulnDbID   string `json:"vulnDbId"`   // ID of the vuln in VulnDB
}

type VulnerabilityService ¶

type VulnerabilityService struct {
	// contains filtered or unexported fields
}

func (VulnerabilityService) Assign ¶

func (vs VulnerabilityService) Assign(ctx context.Context, vulnUUID, componentUUID uuid.UUID) (err error)

func (VulnerabilityService) Get ¶

func (vs VulnerabilityService) Get(ctx context.Context, vulnUUID uuid.UUID) (v Vulnerability, err error)

func (VulnerabilityService) GetAllForComponent ¶

func (vs VulnerabilityService) GetAllForComponent(ctx context.Context, componentUUID uuid.UUID, suppressed bool, po PageOptions) (p Page[Vulnerability], err error)

func (VulnerabilityService) GetAllForProject ¶

func (vs VulnerabilityService) GetAllForProject(ctx context.Context, projectUUID uuid.UUID, suppressed bool, po PageOptions) (p Page[Vulnerability], err error)

func (VulnerabilityService) Unassign ¶

func (vs VulnerabilityService) Unassign(ctx context.Context, vulnUUID, componentUUID uuid.UUID) (err error)

Directories ¶

Path Synopsis
Package notification provides the functionality to process notifications sent by Dependency-Track.
Package notification provides the functionality to process notifications sent by Dependency-Track.

Jump to

Keyboard shortcuts

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