services

package
v1.18.0 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2022 License: Apache-2.0 Imports: 14 Imported by: 20

Documentation

Index

Constants

View Source
const (
	// ReportsAPI refer to: https://www.jfrog.com/confluence/display/JFROG/Xray+REST+API#XrayRESTAPI-REPORTS
	ReportsAPI         = "api/v1/reports"
	VulnerabilitiesAPI = ReportsAPI + "/vulnerabilities"
)
View Source
const (
	XrayScanBuildNoFailBuildPolicy = "No Xray “Fail build in case of a violation” policy rule has been defined on this build"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Artifact added in v1.12.0

type Artifact struct {
	General  General          `json:"general,omitempty"`
	Issues   []Issue          `json:"issues,omitempty"`
	Licenses []SummaryLicense `json:"licenses,omitempty"`
}

type ArtifactSummaryParams added in v1.12.0

type ArtifactSummaryParams struct {
	Checksums []string `json:"checksums,omitempty"`
	Paths     []string `json:"paths,omitempty"`
}

type ArtifactSummaryResponse added in v1.12.0

type ArtifactSummaryResponse struct {
	Artifacts []Artifact `json:"artifacts,omitempty"`
	Errors    []Error    `json:"errors,omitempty"`
}

type BinMgrService added in v0.20.1

type BinMgrService struct {
	XrayDetails auth.ServiceDetails
	// contains filtered or unexported fields
}

BinMgrService defines the http client and Xray details

func NewBinMgrService added in v0.20.1

func NewBinMgrService(client *jfroghttpclient.JfrogHttpClient) *BinMgrService

NewBinMgrService creates a new Xray Binary Manager Service

func (*BinMgrService) AddBuildsToIndexing added in v0.20.1

func (xbms *BinMgrService) AddBuildsToIndexing(buildNames []string) error

AddBuildsToIndexing will add builds to indexing configuration

func (*BinMgrService) GetJfrogHttpClient added in v0.20.1

func (xbms *BinMgrService) GetJfrogHttpClient() *jfroghttpclient.JfrogHttpClient

GetJfrogHttpClient returns the http client

func (*BinMgrService) GetXrayDetails added in v0.20.1

func (xbms *BinMgrService) GetXrayDetails() auth.ServiceDetails

GetXrayDetails returns the Xray details

type BuildScanResponse added in v1.6.4

type BuildScanResponse struct {
	Status          string          `json:"status,omitempty"`
	MoreDetailsUrl  string          `json:"more_details_url,omitempty"`
	FailBuild       bool            `json:"fail_build,omitempty"`
	Violations      []Violation     `json:"violations,omitempty"`
	Vulnerabilities []Vulnerability `json:"vulnerabilities,omitempty"`
	Info            string          `json:"info,omitempty"`
}

type BuildScanService added in v1.6.4

type BuildScanService struct {
	XrayDetails auth.ServiceDetails
	// contains filtered or unexported fields
}

func NewBuildScanService added in v1.6.4

func NewBuildScanService(client *jfroghttpclient.JfrogHttpClient) *BuildScanService

NewBuildScanService creates a new service to scan build dependencies.

func (*BuildScanService) GetBuildScanResults added in v1.6.4

func (bs *BuildScanService) GetBuildScanResults(params XrayBuildParams, includeVulnerabilities bool) (*BuildScanResponse, error)

func (*BuildScanService) Scan added in v1.6.4

func (bs *BuildScanService) Scan(params XrayBuildParams) error

type Component added in v0.25.0

type Component struct {
	FixedVersions []string           `json:"fixed_versions,omitempty"`
	ImpactPaths   [][]ImpactPathNode `json:"impact_paths,omitempty"`
}

type Cve added in v0.25.0

type Cve struct {
	Id           string `json:"cve,omitempty"`
	CvssV2Score  string `json:"cvss_v2_score,omitempty"`
	CvssV2Vector string `json:"cvss_v2_vector,omitempty"`
	CvssV3Score  string `json:"cvss_v3_score,omitempty"`
	CvssV3Vector string `json:"cvss_v3_vector,omitempty"`
}

type CvssScore added in v1.6.0

type CvssScore struct {
	MinScore float32 `json:"min_score,omitempty"`
	MaxScore float32 `json:"max_score,omitempty"`
}

type Error added in v1.6.4

type Error struct {
	Error      string `json:"error,omitempty"`
	Identifier string `json:"identifier,omitempty"`
}

type ExtendedInformation added in v1.12.3

type ExtendedInformation struct {
	ShortDescription             string                        `json:"short_description,omitempty"`
	FullDescription              string                        `json:"full_description,omitempty"`
	JfrogResearchSeverity        string                        `json:"jfrog_research_severity,omitempty"`
	JfrogResearchSeverityReasons []JfrogResearchSeverityReason `json:"jfrog_research_severity_reasons,omitempty"`
	Remediation                  string                        `json:"remediation,omitempty"`
}

type Filter added in v1.6.0

type Filter struct {
	HasRemediation *bool     `json:"has_remediation,omitempty"`
	CvssScore      CvssScore `json:"cvss_score,omitempty"`
	Severity       []string  `json:"severities,omitempty"`
}

type General added in v1.12.0

type General struct {
	ComponentId string `json:"component_id,omitempty"`
	Name        string `json:"name,omitempty"`
	Path        string `json:"path,omitempty"`
	PkgType     string `json:"pkg_type,omitempty"`
	Sha256      string `json:"sha256,omitempty"`
}

type GraphNode added in v0.25.0

type GraphNode struct {
	// Component Id in the JFrog standard.
	// For instance, for maven: gav://<groupId>:<artifactId>:<version>
	// For detailed format examples please see:
	// https://www.jfrog.com/confluence/display/JFROG/Xray+REST+API#XrayRESTAPI-ComponentIdentifiers
	Id string `json:"component_id,omitempty"`
	// Sha of the binary representing the component.
	Sha256 string `json:"sha256,omitempty"`
	Sha1   string `json:"sha1,omitempty"`
	// For root file shall be the file name.
	// For internal components shall be the internal path. (Relevant only for binary scan).
	Path string `json:"path,omitempty"`
	// List of license names
	Licenses []string `json:"licenses,omitempty"`
	// Component properties
	Properties map[string]string `json:"properties,omitempty"`
	// List of sub components.
	Nodes []*GraphNode `json:"nodes,omitempty"`
	// Node parent (for internal use)
	Parent *GraphNode `json:"-"`
}

func (*GraphNode) NodeHasLoop added in v1.5.0

func (currNode *GraphNode) NodeHasLoop() bool

type ImpactPathNode added in v1.0.1

type ImpactPathNode struct {
	ComponentId string `json:"component_id,omitempty"`
	FullPath    string `json:"full_path,omitempty"`
}

type Issue added in v1.6.4

type Issue struct {
	IssueId                string             `json:"issue_id,omitempty"`
	Summary                string             `json:"summary,omitempty"`
	Description            string             `json:"description,omitempty"`
	IssueType              string             `json:"issue_type,omitempty"`
	Severity               string             `json:"severity,omitempty"`
	Provider               string             `json:"provider,omitempty"`
	Cves                   []SummaryCve       `json:"cves,omitempty"`
	Created                string             `json:"created,omitempty"`
	ImpactPath             []string           `json:"impact_path,omitempty"`
	Components             []SummaryComponent `json:"components,omitempty"`
	ComponentPhysicalPaths []string           `json:"component_physical_paths,omitempty"`
}

type JfrogResearchSeverityReason added in v1.12.3

type JfrogResearchSeverityReason struct {
	Name        string `json:"name,omitempty"`
	Description string `json:"description,omitempty"`
	IsPositive  bool   `json:"is_positive,omitempty"`
}

type License added in v0.25.0

type License struct {
	Key        string               `json:"license_key,omitempty"`
	Name       string               `json:"name,omitempty"`
	Components map[string]Component `json:"components,omitempty"`
	Custom     bool                 `json:"custom,omitempty"`
	References []string             `json:"references,omitempty"`
}

type PolicyAlreadyExistsError added in v0.21.0

type PolicyAlreadyExistsError struct {
	InnerError error
}

func (*PolicyAlreadyExistsError) Error added in v0.21.0

type PolicyService added in v0.20.1

type PolicyService struct {
	XrayDetails auth.ServiceDetails
	// contains filtered or unexported fields
}

PolicyService defines the http client and Xray details

func NewPolicyService added in v0.20.1

func NewPolicyService(client *jfroghttpclient.JfrogHttpClient) *PolicyService

NewPolicyService creates a new Xray Policy Service

func (*PolicyService) Create added in v0.20.1

func (xps *PolicyService) Create(params utils.PolicyParams) error

Create will create a new Xray policy

func (*PolicyService) Delete added in v0.20.1

func (xps *PolicyService) Delete(policyName string) error

Delete will delete an existing policy by name It will error if no policy can be found by that name.

func (*PolicyService) Get added in v0.20.1

func (xps *PolicyService) Get(policyName string) (policyResp *utils.PolicyParams, err error)

Get retrieves the details about an Xray policy by its name It will error if no policy can be found by that name.

func (*PolicyService) GetJfrogHttpClient added in v0.20.1

func (xps *PolicyService) GetJfrogHttpClient() *jfroghttpclient.JfrogHttpClient

GetJfrogHttpClient returns the http client

func (*PolicyService) GetXrayDetails added in v0.20.1

func (xps *PolicyService) GetXrayDetails() auth.ServiceDetails

GetXrayDetails returns the Xray details

func (*PolicyService) Update added in v0.20.1

func (xps *PolicyService) Update(params utils.PolicyParams) error

Update will update an existing Xray policy by name It will error if no policy can be found by that name.

type ReportContent added in v1.6.0

type ReportContent struct {
	TotalRows int   `json:"total_rows"`
	Rows      []Row `json:"rows"`
}

ReportContent defines a report content response

type ReportContentRequestParams added in v1.6.0

type ReportContentRequestParams struct {
	ReportId  string
	Direction string
	PageNum   int
	NumRows   int
	OrderBy   string
}

ReportContentRequestParams defines a report content request

type ReportCve added in v1.7.1

type ReportCve struct {
	Id           string  `json:"cve,omitempty"`
	CvssV2Score  float64 `json:"cvss_v2_score,omitempty"`
	CvssV2Vector string  `json:"cvss_v2_vector,omitempty"`
	CvssV3Score  float64 `json:"cvss_v3_score,omitempty"`
	CvssV3Vector string  `json:"cvss_v3_vector,omitempty"`
}

type ReportDetails added in v1.6.0

type ReportDetails struct {
	Id                 int    `json:"id,omitempty"`
	Name               string `json:"name,omitempty"`
	Type               string `json:"report_type,omitempty"`
	Status             string `json:"status,omitempty"`
	TotalArtifacts     int    `json:"total_artifacts,omitempty"`
	ProcessedArtifacts int    `json:"num_of_processed_artifacts,omitempty"`
	Progress           int    `json:"progress,omitempty"`
	RowCount           int    `json:"number_of_rows,omitempty"`
	StartTime          string `json:"start_time,omitempty"`
	EndTime            string `json:"end_time,omitempty"`
	Author             string `json:"author,omitempty"`
}

ReportDetails defines the detail response for an Xray report

type ReportRequestParams added in v1.6.0

type ReportRequestParams struct {
	Name      string   `json:"name,omitempty"`
	Filters   Filter   `json:"filters,omitempty"`
	Resources Resource `json:"resources,omitempty"`
}

ReportRequestParams defines a report request

type ReportResponse added in v1.6.0

type ReportResponse struct {
	ReportId int    `json:"report_id"`
	Status   string `json:"status"`
}

ReportResponse defines a report request response

type ReportService added in v1.6.0

type ReportService struct {
	XrayDetails auth.ServiceDetails
	// contains filtered or unexported fields
}

ReportService defines the Http client and Xray details

func NewReportService added in v1.6.0

func NewReportService(client *jfroghttpclient.JfrogHttpClient) *ReportService

NewReportService creates a new Xray Report Service

func (*ReportService) Content added in v1.6.0

Content retrieves the report content for the provided request

func (*ReportService) Delete added in v1.6.0

func (rs *ReportService) Delete(reportId string) error

Delete deletes the report that has an id matching reportId

func (*ReportService) Details added in v1.6.0

func (rs *ReportService) Details(reportId string) (*ReportDetails, error)

Details retrieves the details for a report

func (*ReportService) Vulnerabilities added in v1.6.0

func (rs *ReportService) Vulnerabilities(req ReportRequestParams) (*ReportResponse, error)

Vulnerabilities requests a new Xray scan for vulnerabilities

type Repository added in v1.6.0

type Repository struct {
	Name string `json:"name,omitempty"`
}

type RequestBuildScanResponse added in v1.6.4

type RequestBuildScanResponse struct {
	Info string `json:"info,omitempty"`
}

type RequestScanResponse added in v0.25.0

type RequestScanResponse struct {
	ScanId string `json:"scan_id,omitempty"`
}

type Resource added in v1.6.0

type Resource struct {
	IncludePathPatterns []string     `json:"include_path_patterns,omitempty"`
	Repositories        []Repository `json:"repositories,omitempty"`
}

type Row added in v1.6.0

type Row struct {
	Cves                     []ReportCve `json:"cves,omitempty"`
	Cvsv2MaxScore            float64     `json:"cvss2_max_score,omitempty"`
	Cvsv3MaxScore            float64     `json:"cvss3_max_score,omitempty"`
	Summary                  string      `json:"summary,omitempty"`
	Severity                 string      `json:"severity,omitempty"`
	SeveritySource           string      `json:"severity_source,omitempty"`
	VulnerableComponent      string      `json:"vulnerable_component,omitempty"`
	ImpactedArtifact         string      `json:"impacted_artifact,omitempty"`
	ImpactPath               []string    `json:"impact_path,omitempty"`
	Path                     string      `json:"path,omitempty"`
	FixedVersions            []string    `json:"fixed_versions,omitempty"`
	Published                string      `json:"published,omitempty"`
	IssueId                  string      `json:"issue_id,omitempty"`
	PackageType              string      `json:"package_type,omitempty"`
	Provider                 string      `json:"provider,omitempty"`
	Description              string      `json:"description,omitempty"`
	References               []string    `json:"references,omitempty"`
	ExternalAdvisorySource   string      `json:"external_advisory_source,omitempty"`
	ExternalAdvisorySeverity string      `json:"external_advisory_severity,omitempty"`
}

Row defines an entry of the report content

type ScanErrorJson added in v1.12.3

type ScanErrorJson struct {
	Error string `json:"error"`
}

type ScanResponse added in v0.25.0

type ScanResponse struct {
	ScanId             string          `json:"scan_id,omitempty"`
	XrayDataUrl        string          `json:"xray_data_url,omitempty"`
	Violations         []Violation     `json:"violations,omitempty"`
	Vulnerabilities    []Vulnerability `json:"vulnerabilities,omitempty"`
	Licenses           []License       `json:"licenses,omitempty"`
	ScannedComponentId string          `json:"component_id,omitempty"`
	ScannedPackageType string          `json:"package_type,omitempty"`
	ScannedStatus      string          `json:"status,omitempty"`
}

type ScanService added in v0.25.0

type ScanService struct {
	XrayDetails auth.ServiceDetails
	// contains filtered or unexported fields
}

func NewScanService added in v0.25.0

func NewScanService(client *jfroghttpclient.JfrogHttpClient) *ScanService

NewScanService creates a new service to scan binaries and audit code projects' dependencies.

func (*ScanService) GetScanGraphResults added in v0.25.0

func (ss *ScanService) GetScanGraphResults(scanId string, includeVulnerabilities, includeLicenses bool) (*ScanResponse, error)

func (*ScanService) ScanGraph added in v0.25.0

func (ss *ScanService) ScanGraph(scanParams XrayGraphScanParams) (string, error)

type ScanType added in v1.6.1

type ScanType string
const (

	// ScanType values
	Dependency ScanType = "dependency"
	Binary     ScanType = "binary"
)

type SummaryComponent added in v1.11.2

type SummaryComponent struct {
	ComponentId   string   `json:"component_id,omitempty"`
	FixedVersions []string `json:"fixed_versions,omitempty"`
}

type SummaryCve added in v1.11.2

type SummaryCve struct {
	Id          string   `json:"cve,omitempty"`
	CvssV2Score string   `json:"cvss_v2,omitempty"`
	CvssV3Score string   `json:"cvss_v3,omitempty"`
	Cwe         []string `json:"cwe,omitempty"`
}

type SummaryLicense added in v1.12.0

type SummaryLicense struct {
	Components  []string `json:"components,omitempty"`
	FullName    string   `json:"full_name,omitempty"`
	MoreInfoUrl []string `json:"more_info_url,omitempty"`
	Name        string   `json:"name,omitempty"`
}

type SummaryResponse added in v1.6.4

type SummaryResponse struct {
	Issues []Issue
	Errors []Error
}

type SummaryService added in v1.6.4

type SummaryService struct {
	XrayDetails auth.ServiceDetails
	// contains filtered or unexported fields
}

SummaryService returns the https client and Xray details

func NewSummaryService added in v1.6.4

func NewSummaryService(client *jfroghttpclient.JfrogHttpClient) *SummaryService

NewSummaryService creates a new service to retrieve the version of Xray

func (*SummaryService) GetArtifactSummary added in v1.12.0

func (ss *SummaryService) GetArtifactSummary(params ArtifactSummaryParams) (*ArtifactSummaryResponse, error)

func (*SummaryService) GetBuildSummary added in v1.6.4

func (ss *SummaryService) GetBuildSummary(params XrayBuildParams) (*SummaryResponse, error)

type VersionService

type VersionService struct {
	XrayDetails auth.ServiceDetails
	// contains filtered or unexported fields
}

VersionService returns the https client and Xray details

func NewVersionService

func NewVersionService(client *jfroghttpclient.JfrogHttpClient) *VersionService

NewVersionService creates a new service to retrieve the version of Xray

func (*VersionService) GetVersion

func (vs *VersionService) GetVersion() (string, error)

GetVersion returns the version of Xray

func (*VersionService) GetXrayDetails

func (vs *VersionService) GetXrayDetails() auth.ServiceDetails

GetXrayDetails returns the Xray details

type Violation added in v0.25.0

type Violation struct {
	Summary             string               `json:"summary,omitempty"`
	Severity            string               `json:"severity,omitempty"`
	ViolationType       string               `json:"type,omitempty"`
	Components          map[string]Component `json:"components,omitempty"`
	WatchName           string               `json:"watch_name,omitempty"`
	IssueId             string               `json:"issue_id,omitempty"`
	Cves                []Cve                `json:"cves,omitempty"`
	References          []string             `json:"references,omitempty"`
	FailBuild           bool                 `json:"fail_build,omitempty"`
	LicenseKey          string               `json:"license_key,omitempty"`
	LicenseName         string               `json:"license_name,omitempty"`
	IgnoreUrl           string               `json:"ignore_url,omitempty"`
	RiskReason          string               `json:"risk_reason,omitempty"`
	IsEol               *bool                `json:"is_eol,omitempty"`
	EolMessage          string               `json:"eol_message,omitempty"`
	LatestVersion       string               `json:"latest_version,omitempty"`
	NewerVersions       *int                 `json:"newer_versions,omitempty"`
	Cadence             *float64             `json:"cadence,omitempty"`
	Commits             *int64               `json:"commits,omitempty"`
	Committers          *int                 `json:"committers,omitempty"`
	ExtendedInformation *ExtendedInformation `json:"extended_information,omitempty"`
}

type Vulnerability added in v0.25.0

type Vulnerability struct {
	Cves                []Cve                `json:"cves,omitempty"`
	Summary             string               `json:"summary,omitempty"`
	Severity            string               `json:"severity,omitempty"`
	Components          map[string]Component `json:"components,omitempty"`
	IssueId             string               `json:"issue_id,omitempty"`
	References          []string             `json:"references,omitempty"`
	ExtendedInformation *ExtendedInformation `json:"extended_information,omitempty"`
}

type WatchAlreadyExistsError added in v0.21.0

type WatchAlreadyExistsError struct {
	InnerError error
}

func (*WatchAlreadyExistsError) Error added in v0.21.0

type WatchService

type WatchService struct {
	XrayDetails auth.ServiceDetails
	// contains filtered or unexported fields
}

WatchService defines the http client and Xray details

func NewWatchService

func NewWatchService(client *jfroghttpclient.JfrogHttpClient) *WatchService

NewWatchService creates a new Xray Watch Service

func (*WatchService) Create

func (xws *WatchService) Create(params utils.WatchParams) error

Create will create a new Xray watch

func (*WatchService) Delete

func (xws *WatchService) Delete(watchName string) error

Delete will delete an existing watch by name It will error if no watch can be found by that name.

func (*WatchService) Get

func (xws *WatchService) Get(watchName string) (watchResp *utils.WatchParams, err error)

Get retrieves the details about an Xray watch by its name It will error if no watch can be found by that name.

func (*WatchService) GetJfrogHttpClient

func (xws *WatchService) GetJfrogHttpClient() *jfroghttpclient.JfrogHttpClient

GetJfrogHttpClient returns the http client

func (*WatchService) GetXrayDetails

func (xws *WatchService) GetXrayDetails() auth.ServiceDetails

GetXrayDetails returns the Xray details

func (*WatchService) Update

func (xws *WatchService) Update(params utils.WatchParams) error

Update will update an existing Xray watch by name It will error if no watch can be found by that name.

type XrayBuildParams added in v1.6.4

type XrayBuildParams struct {
	BuildName   string `json:"build_name,omitempty"`
	BuildNumber string `json:"build_number,omitempty"`
	Project     string `json:"project,omitempty"`
	Rescan      bool   `json:"rescan,omitempty"`
}

type XrayGraphScanParams added in v0.25.0

type XrayGraphScanParams struct {
	// A path in Artifactory that this Artifact is intended to be deployed to.
	// This will provide a way to extract the watches that should be applied on this graph
	RepoPath               string
	ProjectKey             string
	Watches                []string
	ScanType               ScanType
	Graph                  *GraphNode
	IncludeVulnerabilities bool
	IncludeLicenses        bool
}

func (*XrayGraphScanParams) GetProjectKey added in v0.25.0

func (gp *XrayGraphScanParams) GetProjectKey() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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