Documentation
¶
Index ¶
- Constants
- func CreateSarifResultFile(vulns *Vulnerabilities, projectName, projectVersion, projectLink string) *format.SARIF
- func WriteSarifFile(sarif *format.SARIF, utils piperutils.FileUtils) ([]piperutils.Path, error)
- func WriteVulnerabilityReports(scanReport reporting.ScanReport, utils piperutils.FileUtils) ([]piperutils.Path, error)
- type Client
- func (b *Client) GetComponents(projectName, versionName string) (*Components, error)
- func (b *Client) GetComponentsWithLicensePolicyRule(projectName, versionName string) (*Components, error)
- func (b *Client) GetPolicyStatus(projectName, versionName string) (*PolicyStatus, error)
- func (b *Client) GetProject(projectName string) (*Project, error)
- func (b *Client) GetProjectVersion(projectName, projectVersion string) (*ProjectVersion, error)
- func (b *Client) GetProjectVersionLink(projectName, versionName string) (string, error)
- func (b *Client) GetVulnerabilities(projectName, versionName string) (*Vulnerabilities, error)
- type Component
- type ComponentOrigin
- type Components
- type Link
- type Metadata
- type PolicyStatus
- type PolicyVersionDetails
- type Project
- type ProjectVersion
- type ProjectVersions
- type Projects
- type SeverityLevels
- type Vulnerabilities
- type Vulnerability
- type VulnerabilityWithRemediation
Constants ¶
const ( HEADER_PROJECT_DETAILS_V4 = "application/vnd.blackducksoftware.project-detail-4+json" HEADER_USER_V4 = "application/vnd.blackducksoftware.user-4+json" HEADER_BOM_V6 = "application/vnd.blackducksoftware.bill-of-materials-6+json" )
const ReportsDirectory = "blackduck"
ReportsDirectory defines the subfolder for the BlackDuck reports which are generated
Variables ¶
This section is empty.
Functions ¶
func CreateSarifResultFile ¶ added in v1.204.0
func CreateSarifResultFile(vulns *Vulnerabilities, projectName, projectVersion, projectLink string) *format.SARIF
CreateSarifResultFile creates a SARIF result from the Vulnerabilities that were brought up by the scan
func WriteSarifFile ¶ added in v1.204.0
func WriteSarifFile(sarif *format.SARIF, utils piperutils.FileUtils) ([]piperutils.Path, error)
WriteSarifFile write a JSON sarif format file for upload into e.g. GCP
func WriteVulnerabilityReports ¶ added in v1.204.0
func WriteVulnerabilityReports(scanReport reporting.ScanReport, utils piperutils.FileUtils) ([]piperutils.Path, error)
WriteVulnerabilityReports writes vulnerability information from ScanReport into dedicated outputs e.g. HTML
Types ¶
type Client ¶
type Client struct {
BearerToken string `json:"bearerToken,omitempty"`
BearerExpiresInMilliseconds int64 `json:"expiresInMilliseconds,omitempty"`
// contains filtered or unexported fields
}
Client defines a BlackDuck client
func (*Client) GetComponents ¶
func (b *Client) GetComponents(projectName, versionName string) (*Components, error)
func (*Client) GetComponentsWithLicensePolicyRule ¶ added in v1.165.0
func (b *Client) GetComponentsWithLicensePolicyRule(projectName, versionName string) (*Components, error)
func (*Client) GetPolicyStatus ¶
func (b *Client) GetPolicyStatus(projectName, versionName string) (*PolicyStatus, error)
func (*Client) GetProject ¶
GetProject returns a project with a given name
func (*Client) GetProjectVersion ¶
func (b *Client) GetProjectVersion(projectName, projectVersion string) (*ProjectVersion, error)
GetProjectVersion returns a project version with a given name
func (*Client) GetProjectVersionLink ¶ added in v1.165.0
func (*Client) GetVulnerabilities ¶
func (b *Client) GetVulnerabilities(projectName, versionName string) (*Vulnerabilities, error)
type Component ¶
type Component struct {
Name string `json:"componentName,omitempty"`
Version string `json:"componentVersionName,omitempty"`
ComponentOriginName string `json:"componentVersionOriginName,omitempty"`
PrimaryLanguage string `json:"primaryLanguage,omitempty"`
PolicyStatus string `json:"policyStatus,omitempty"`
MatchTypes []string `json:"matchTypes,omitempty"`
Origins []ComponentOrigin `json:"origins,omitempty"`
Metadata `json:"_meta,omitempty"`
}
func (*Component) MatchedType ¶ added in v1.260.0
MatchedType returns matched type of component: direct/transitive
func (*Component) ToPackageUrl ¶ added in v1.238.0
func (c *Component) ToPackageUrl() *packageurl.PackageURL
ToPackageUrl creates the package URL for the component
type ComponentOrigin ¶ added in v1.260.0
type Components ¶
type PolicyStatus ¶
type PolicyStatus struct {
OverallStatus string `json:"overallStatus,omitempty"`
PolicyVersionDetails `json:"componentVersionPolicyViolationDetails,omitempty"`
}
type PolicyVersionDetails ¶
type PolicyVersionDetails struct {
Name string `json:"name,omitempty"`
SeverityLevels []SeverityLevels `json:"severityLevels,omitEmpty"`
}
type ProjectVersion ¶
type ProjectVersion struct {
Name string `json:"versionName,omitempty"`
Metadata `json:"_meta,omitempty"`
}
ProjectVersion defines a version of a BlackDuck project
type ProjectVersions ¶
type ProjectVersions struct {
TotalCount int `json:"totalCount,omitempty"`
Items []ProjectVersion `json:"items,omitempty"`
}
ProjectVersions defines the response to a BlackDuck project version API request
type Projects ¶
type Projects struct {
TotalCount int `json:"totalCount,omitempty"`
Items []Project `json:"items,omitempty"`
}
Projects defines the response to a BlackDuck project API request
type SeverityLevels ¶
type Vulnerabilities ¶
type Vulnerabilities struct {
TotalCount int `json:"totalCount,omitempty"`
Items []Vulnerability `json:"items,omitempty"`
}
type Vulnerability ¶
type Vulnerability struct {
Name string `json:"componentName,omitempty"`
Version string `json:"componentVersionName,omitempty"`
ComponentVersionOriginID string `json:"componentVersionOriginId,omitempty"`
ComponentVersionOriginName string `json:"componentVersionOriginName,omitempty"`
Ignored bool `json:"ignored,omitempty"`
VulnerabilityWithRemediation `json:"vulnerabilityWithRemediation,omitempty"`
Component *Component
// contains filtered or unexported fields
}
func (Vulnerability) Title ¶ added in v1.204.0
func (v Vulnerability) Title() string
Title returns the issue title representation of the contents
func (Vulnerability) ToMarkdown ¶ added in v1.204.0
func (v Vulnerability) ToMarkdown() ([]byte, error)
ToMarkdown returns the markdown representation of the contents
func (Vulnerability) ToTxt ¶ added in v1.204.0
func (v Vulnerability) ToTxt() string
ToTxt returns the textual representation of the contents
type VulnerabilityWithRemediation ¶
type VulnerabilityWithRemediation struct {
VulnerabilityName string `json:"vulnerabilityName,omitempty"`
BaseScore float32 `json:"baseScore,omitempty"`
Severity string `json:"severity,omitempty"`
RemediationStatus string `json:"remediationStatus,omitempty"`
RemediationComment string `json:"remediationComment,omitempty"`
Description string `json:"description,omitempty"`
OverallScore float32 `json:"overallScore,omitempty"`
CweID string `json:"cweId,omitempty"`
ExploitabilitySubscore float32 `json:"exploitabilitySubscore,omitempty"`
ImpactSubscore float32 `json:"impactSubscore,omitempty"`
RelatedVulnerability string `json:"relatedVulnerability,omitempty"`
RemidiatedBy string `json:"remediationCreatedBy,omitempty"`
}