Help us shape the future of Go! Take the 2026 Go Developer Survey

formats

package
v1.41.0 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2026 License: Apache-2.0 Imports: 7 Imported by: 12

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertLicenseTableRowToScanTableRow

func ConvertLicenseTableRowToScanTableRow(tableRows []licenseTableRow) (scanTableRows []licenseScanTableRow)

func ConvertLicenseViolationTableRowToScanTableRow

func ConvertLicenseViolationTableRowToScanTableRow(tableRows []licenseViolationTableRow) (scanTableRows []licenseViolationScanTableRow)

For binary scans

func ConvertOperationalRiskTableRowToScanTableRow

func ConvertOperationalRiskTableRowToScanTableRow(tableRows []operationalRiskViolationTableRow) (scanTableRows []operationalRiskViolationScanTableRow)

func ConvertSecurityTableRowToScanTableRow

func ConvertSecurityTableRowToScanTableRow(tableRows []scaVulnerabilityOrViolationTableRow) (scanTableRows []vulnerabilityScanTableRow)

For binary scans

func ConvertToBasicJasTableRow added in v1.36.0

func ConvertToBasicJasTableRow(rows []SourceCodeRow) (tableRows []basicJasTableRow)

func ConvertToLicenseTableRow

func ConvertToLicenseTableRow(rows []LicenseRow) (tableRows []licenseTableRow)

func ConvertToLicenseViolationTableRow

func ConvertToLicenseViolationTableRow(rows []LicenseViolationRow) (tableRows []licenseViolationTableRow)

func ConvertToMaliciousTableRow added in v1.25.0

func ConvertToMaliciousTableRow(rows []SourceCodeRow) (tableRows []maliciousTableRow)

func ConvertToOperationalRiskViolationTableRow

func ConvertToOperationalRiskViolationTableRow(rows []OperationalRiskViolationRow) (tableRows []operationalRiskViolationTableRow)

func ConvertToScaVulnerabilityOrViolationTableRow added in v1.14.0

func ConvertToScaVulnerabilityOrViolationTableRow(rows []VulnerabilityOrViolationRow) (tableRows []scaVulnerabilityOrViolationTableRow)

func ConvertToSecretsTableRow

func ConvertToSecretsTableRow(rows []SourceCodeRow) (tableRows []secretsTableRow)

func EscapeMarkdownTableCell added in v1.39.0

func EscapeMarkdownTableCell(value string) string

EscapeMarkdownTableCell renders value safely inside one GitHub-flavored markdown table cell: "|" would open a new cell and a newline would end the row.

func EscapeTerminalTableCell added in v1.39.0

func EscapeTerminalTableCell(value string) string

EscapeTerminalTableCell renders value inside one table cell that a person reads in a terminal rather than a markdown renderer.

func RenderActionsException added in v1.39.0

func RenderActionsException(actions []CuratedActions) string

RenderActionsException returns the line a GitHub Actions curation report carries when the command cannot account for every action the job will execute, or "" when nothing needs saying. This is the case where either a run is structure-only, or a local action was found in the attributed flow.

Types

type Applicability

type Applicability struct {
	Status             string     `json:"status"`
	ScannerDescription string     `json:"scannerDescription,omitempty"`
	UndeterminedReason string     `json:"undeterminedReason,omitempty"`
	Evidence           []Evidence `json:"evidence,omitempty"`
}

type BlockedPackages

type BlockedPackages struct {
	Policy    string         `json:"policy,omitempty"`
	Condition string         `json:"condition,omitempty"`
	Packages  map[string]int `json:"packages"`
}

type Bom

type Bom struct {
	Vulnerabilities struct {
		Vulnerability []struct {
			BomRef string `xml:"bom-ref,attr"`
			Id     string `xml:"id"`
		} `xml:"vulnerability"`
	} `xml:"vulnerabilities"`
}

type ComponentRow

type ComponentRow struct {
	Id      string `json:"id,omitempty"`
	Name    string `json:"name"`
	Version string `json:"version"`
	// Shown the preferred location of the component from the evidences.
	PreferredLocation *Location `json:"location,omitempty"`
	// Evidences is a list of locations that the component was found in.
	Evidences []Location `json:"evidences,omitempty"`
}

type CuratedAction added in v1.39.0

type CuratedAction struct {
	Action string `json:"action"`           // "owner/repo", plus " (subpath[, subpath...])" when invoked via subpaths
	Ref    string `json:"ref"`              // verbatim from the cache directory name, uninterpreted
	Parent string `json:"parent,omitempty"` // "" when directly referenced, or when attribution could not place it
	Status string `json:"status"`
	Notes  string `json:"notes,omitempty"`
}

CuratedAction is the curation outcome for one resolved GitHub Action.

type CuratedActions added in v1.39.0

type CuratedActions struct {
	Actions []CuratedAction `json:"actions,omitempty"`
	// Attributed reports whether a workflow file is present to do parent attribution.
	// else Parent column is dropped in the report.
	Attributed bool `json:"attributed"`
	// LocalCompositeActions holds the `uses: ./...` steps which are evaluated lazily
	LocalCompositeActions []LocalCompositeAction `json:"local_composite_actions,omitempty"`
}

CuratedActions holds the GitHub Actions curation result for one job.

type CuratedPackages

type CuratedPackages struct {
	Blocked      []BlockedPackages `json:"blocked,omitempty"`
	PackageCount int               `json:"num_packages,omitempty"`
	// IsPartial is true when the dependency tree could not be fully resolved (e.g. CVS pip fallback).
	// PackageCount reflects only recovered blocked packages, not the full tree size.
	IsPartial bool `json:"partial,omitempty"`
	// PartialReason explains why IsPartial is true, e.g. "cvs_fallback" or "hf_unresolved".
	PartialReason string `json:"partial_reason,omitempty"`
}

func (*CuratedPackages) GetApprovedCount

func (cp *CuratedPackages) GetApprovedCount() int

func (*CuratedPackages) GetBlockedCount

func (cp *CuratedPackages) GetBlockedCount() int

type CveRow

type CveRow struct {
	Id            string         `json:"id"`
	CvssV2        string         `json:"cvssV2,omitempty"`
	CvssV2Vector  string         `json:"cvssV2Vector,omitempty"`
	CvssV3        string         `json:"cvssV3,omitempty"`
	CvssV3Vector  string         `json:"cvssV3Vector,omitempty"`
	Cwe           []string       `json:"cwe,omitempty"`
	Applicability *Applicability `json:"applicability,omitempty"`
}

type EnrichJson

type EnrichJson struct {
	Vulnerability []struct {
		BomRef string `json:"bom-ref"`
		Id     string `json:"id"`
	} `json:"vulnerabilities"`
}

type Evidence

type Evidence struct {
	Location
	Reason string `json:"reason,omitempty"`
}

type ImpactedDependencyDetails

type ImpactedDependencyDetails struct {
	SeverityDetails
	ImpactedDependencyName    string         `json:"impactedPackageName"`
	ImpactedDependencyVersion string         `json:"impactedPackageVersion"`
	ImpactedDependencyType    string         `json:"impactedPackageType"`
	Components                []ComponentRow `json:"components"`
}

type JfrogResearchInformation

type JfrogResearchInformation struct {
	SeverityDetails
	Summary         string                        `json:"summary,omitempty"`
	Details         string                        `json:"details,omitempty"`
	SeverityReasons []JfrogResearchSeverityReason `json:"severityReasons,omitempty"`
	Remediation     string                        `json:"remediation,omitempty"`
}

type JfrogResearchSeverityReason

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

type LicenseRow

type LicenseRow struct {
	ImpactedDependencyDetails
	LicenseKey  string           `json:"licenseKey"`
	LicenseName string           `json:"licenseName,omitempty"`
	ImpactPaths [][]ComponentRow `json:"impactPaths"`
}

type LicenseViolationRow added in v1.14.0

type LicenseViolationRow struct {
	LicenseRow
	ViolationContext
}

type LocalCompositeAction added in v1.39.0

type LocalCompositeAction struct {
	Path string `json:"path"`
	// DeclaredBy is the composite action declaring this step, as "<owner>/<repo>@<ref>", or ""
	// when the job's own workflow declares it.
	DeclaredBy string `json:"declared_by,omitempty"`
}

LocalCompositeAction is one `uses: ./...` step a curated job will run, and who declared it.

type Location

type Location struct {
	File               string   `json:"file"`
	StartLine          int      `json:"startLine,omitempty"`
	StartColumn        int      `json:"startColumn,omitempty"`
	EndLine            int      `json:"endLine,omitempty"`
	EndColumn          int      `json:"endColumn,omitempty"`
	Snippet            string   `json:"snippet,omitempty"`
	ExternalReferences []string `json:"externalReferences,omitempty"`
}

func (Location) ToString added in v1.14.0

func (l Location) ToString() string

String Representation of the location (can be used as unique ID of the location)

type OperationalRiskViolationRow

type OperationalRiskViolationRow struct {
	ImpactedDependencyDetails
	ViolationContext
	RiskReason    string `json:"riskReason"`
	IsEol         string `json:"isEndOfLife"`
	EolMessage    string `json:"endOfLifeMessage"`
	Cadence       string `json:"cadence"`
	Commits       string `json:"commits"`
	Committers    string `json:"committers"`
	NewerVersions string `json:"newerVersions"`
	LatestVersion string `json:"latestVersion"`
}

type ResultSummary

type ResultSummary map[string]map[string]int

Severity -> status -> Count

func MergeResultSummaries

func MergeResultSummaries(summaries ...ResultSummary) (merged ResultSummary)

func (ResultSummary) GetTotal

func (rs ResultSummary) GetTotal(filterSeverities ...string) (total int)

type ResultsSummary

type ResultsSummary struct {
	Scans []ScanSummary `json:"scans"`
}

func (*ResultsSummary) GetTotalViolations

func (rs *ResultsSummary) GetTotalViolations(filterTypes ...SummaryResultType) (total int)

func (*ResultsSummary) GetTotalVulnerabilities

func (rs *ResultsSummary) GetTotalVulnerabilities(filterTypes ...SummaryResultType) (total int)

func (*ResultsSummary) HasViolations

func (rs *ResultsSummary) HasViolations() bool

type ResultsTables

type ResultsTables struct {
	// Licenses
	LicensesTable []licenseTableRow
	// SBOM (Software Bill of Materials)
	SbomTable []SbomTableRow
	// Sca tables
	SecurityVulnerabilitiesTable   []scaVulnerabilityOrViolationTableRow
	SecurityViolationsTable        []scaVulnerabilityOrViolationTableRow
	LicenseViolationsTable         []licenseViolationTableRow
	OperationalRiskViolationsTable []operationalRiskViolationTableRow
	// Iac tables
	IacVulnerabilitiesTable []basicJasTableRow
	IacViolationsTable      []basicJasTableRow
	// Sast tables
	SastVulnerabilitiesTable []basicJasTableRow
	SastViolationsTable      []basicJasTableRow
	// Services
	ServicesVulnerabilitiesTable []basicJasTableRow
	ServicesViolationsTable      []basicJasTableRow
	// Secrets
	SecretsVulnerabilitiesTable []secretsTableRow
	SecretsViolationsTable      []secretsTableRow
	// Malicious Code
	MaliciousVulnerabilitiesTable []maliciousTableRow
}

type SbomTableRow added in v1.16.0

type SbomTableRow struct {
	Component   string `col-name:"Component"`
	Version     string `col-name:"Version"`
	PackageType string `col-name:"Type"`
	Relation    string `col-name:"Relation"`
	// For sorting
	RelationPriority int
}

type ScaScanResultSummary

type ScaScanResultSummary struct {
	ScanIds         []string      `json:"scan_ids,omitempty"`
	MoreInfoUrls    []string      `json:"more_info_urls,omitempty"`
	Security        ResultSummary `json:"security,omitempty"`
	License         ResultSummary `json:"license,omitempty"`
	OperationalRisk ResultSummary `json:"operational_risk,omitempty"`
}

type ScanResultSummary

type ScanResultSummary struct {
	ScaResults       *ScaScanResultSummary `json:"sca,omitempty"`
	IacResults       *ResultSummary        `json:"iac,omitempty"`
	ServicesResults  *ResultSummary        `json:"services,omitempty"`
	SecretsResults   *ResultSummary        `json:"secrets,omitempty"`
	SastResults      *ResultSummary        `json:"sast,omitempty"`
	MaliciousResults *ResultSummary        `json:"maliciousCode,omitempty"`
}

func GetVulnerabilitiesSummaries

func GetVulnerabilitiesSummaries(summaries ...ResultsSummary) *ScanResultSummary

func (*ScanResultSummary) GetMoreInfoUrls

func (srs *ScanResultSummary) GetMoreInfoUrls() (urls []string)

func (*ScanResultSummary) GetScanIds

func (srs *ScanResultSummary) GetScanIds() (scanIds []string)

func (*ScanResultSummary) GetSummaryBySeverity

func (ss *ScanResultSummary) GetSummaryBySeverity() (summary ResultSummary)

Returns a ResultSummary with the counts described in the summary Severity -> status -> Count

func (*ScanResultSummary) GetTotal

func (srs *ScanResultSummary) GetTotal(filterTypes ...SummaryResultType) (total int)

func (*ScanResultSummary) HasIssues

func (srs *ScanResultSummary) HasIssues() bool

type ScanStatus added in v1.14.0

type ScanStatus struct {
	// If not nil, the scan was performed. The value is the status code of the scans. if not 0, the scan failed.
	ScaStatusCode           *int `json:"scaScanStatusCode,omitempty"`
	SastStatusCode          *int `json:"sastScanStatusCode,omitempty"`
	IacStatusCode           *int `json:"iacScanStatusCode,omitempty"`
	ServicesStatusCode      *int `json:"servicesScanStatusCode,omitempty"`
	SecretsStatusCode       *int `json:"secretsScanStatusCode,omitempty"`
	ApplicabilityStatusCode *int `json:"ContextualAnalysisScanStatusCode,omitempty"`
	MaliciousStatusCode     *int `json:"MaliciousStatusCode,omitempty"`
}

type ScanSummary

type ScanSummary struct {
	Target          string                 `json:"target"`
	Name            string                 `json:"name,omitempty"`
	Vulnerabilities *ScanResultSummary     `json:"vulnerabilities,omitempty"`
	Violations      *ScanViolationsSummary `json:"violations,omitempty"`
	CuratedPackages *CuratedPackages       `json:"curated,omitempty"`
	CuratedActions  *CuratedActions        `json:"curated_actions,omitempty"`
}

func (*ScanSummary) GetScanIds

func (sc *ScanSummary) GetScanIds() (scanIds []string)

func (*ScanSummary) HasBlockedPackages

func (sc *ScanSummary) HasBlockedPackages() bool

func (*ScanSummary) HasCuratedActions added in v1.39.0

func (sc *ScanSummary) HasCuratedActions() bool

func (*ScanSummary) HasCuratedPackages

func (sc *ScanSummary) HasCuratedPackages() bool

func (*ScanSummary) HasViolations

func (sc *ScanSummary) HasViolations() bool

func (*ScanSummary) HasVulnerabilities

func (sc *ScanSummary) HasVulnerabilities() bool

type ScanViolationsSummary

type ScanViolationsSummary struct {
	Watches   []string `json:"watches,omitempty"`
	FailBuild bool     `json:"fail_build,omitempty"`
	ScanResultSummary
}

func GetViolationSummaries

func GetViolationSummaries(summaries ...ResultsSummary) *ScanViolationsSummary

type ScannerInfo added in v1.14.0

type ScannerInfo struct {
	RuleId                  string   `json:"ruleId"`
	Origin                  string   `json:"origin,omitempty"`
	Cwe                     []string `json:"cwe,omitempty"`
	ScannerShortDescription string   `json:"scannerShortDescription,omitempty"`
	ScannerDescription      string   `json:"scannerDescription,omitempty"`
}

type SeverityDetails

type SeverityDetails struct {
	Severity         string `json:"severity"`
	SeverityNumValue int    `json:"-"` // For sorting
}

type SimpleJsonError

type SimpleJsonError struct {
	FilePath     string `json:"filePath"`
	ErrorMessage string `json:"errorMessage"`
}

type SimpleJsonResults

type SimpleJsonResults struct {
	Vulnerabilities           []VulnerabilityOrViolationRow `json:"vulnerabilities"`
	SecurityViolations        []VulnerabilityOrViolationRow `json:"securityViolations"`
	LicensesViolations        []LicenseViolationRow         `json:"licensesViolations"`
	Licenses                  []LicenseRow                  `json:"licenses"`
	OperationalRiskViolations []OperationalRiskViolationRow `json:"operationalRiskViolations"`
	SecretsVulnerabilities    []SourceCodeRow               `json:"secrets"`
	ServicesVulnerabilities   []SourceCodeRow               `json:"services"`
	IacsVulnerabilities       []SourceCodeRow               `json:"iac"`
	SastVulnerabilities       []SourceCodeRow               `json:"sast"`
	SecretsViolations         []SourceCodeRow               `json:"secretsViolations"`
	ServicesViolations        []SourceCodeRow               `json:"servicesViolations"`
	IacsViolations            []SourceCodeRow               `json:"iacViolations"`
	SastViolations            []SourceCodeRow               `json:"sastViolations"`
	MaliciousVulnerabilities  []SourceCodeRow               `json:"maliciousCode"`
	Errors                    []SimpleJsonError             `json:"errors"`
	Statuses                  ScanStatus                    `json:"scansStatus"`
	MultiScanId               string                        `json:"multiScanId,omitempty"`
}

This struct holds the sorted results of the simple-json output.

type SourceCodeRow

type SourceCodeRow struct {
	SeverityDetails
	ViolationContext
	ScannerInfo
	Location
	Finding       string         `json:"finding,omitempty"`
	Fingerprint   string         `json:"fingerprint,omitempty"`
	Applicability *Applicability `json:"applicability,omitempty"`
	CodeFlow      [][]Location   `json:"codeFlow,omitempty"`
}

type SummaryResultType

type SummaryResultType string
const (
	IacResult            SummaryResultType = "IAC"
	ServicesResult       SummaryResultType = "Services"
	SecretsResult        SummaryResultType = "Secrets"
	SastResult           SummaryResultType = "SAST"
	ScaResult            SummaryResultType = "SCA"
	ScaSecurityResult    SummaryResultType = "Security"
	ScaLicenseResult     SummaryResultType = "License"
	ScaOperationalResult SummaryResultType = "Operational"

	NoStatus = ""
)

func (SummaryResultType) String

func (srt SummaryResultType) String() string

type ViolationContext added in v1.14.0

type ViolationContext struct {
	// The watch name that generated the violation
	Watch string `json:"watch,omitempty"`
	// Unique id of the violation if exists
	IssueId string `json:"issueId,omitempty"`
	// The related policy names
	Policies []string `json:"policies,omitempty"`
	// Value of fail_pr rule that can be applied to a policy. Indicates if the violation should fail the PR
	FailPr bool `json:"fail_pull_request,omitempty"`
	// Value of fail_build rule that can be applied to a policy. Indicates if the violation should fail the build
	FailBuild bool `json:"fail_build,omitempty"`
}

type Vulnerabilities

type Vulnerabilities struct {
	Vulnerabilities XMLVulnerability `xml:"vulnerabilities"`
}

type Vulnerability

type Vulnerability struct {
	BomRef string `json:"bom-ref" xml:"bom-ref,attr"`
	ID     string `json:"id" xml:"id"`
}

type VulnerabilityOrViolationRow

type VulnerabilityOrViolationRow struct {
	ImpactedDependencyDetails
	ViolationContext
	Summary                  string                    `json:"summary"`
	Applicable               string                    `json:"applicable"`
	FixedVersions            []string                  `json:"fixedVersions"`
	Cves                     []CveRow                  `json:"cves"`
	IssueId                  string                    `json:"issueId"`
	References               []string                  `json:"references"`
	ImpactPaths              [][]ComponentRow          `json:"impactPaths"`
	JfrogResearchInformation *JfrogResearchInformation `json:"jfrogResearchInformation"`
	Technology               techutils.Technology      `json:"-"`
}

Used for vulnerabilities and security violations

type XMLVulnerability

type XMLVulnerability struct {
	Vulnerability []Vulnerability `xml:"vulnerability"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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