Documentation
¶
Index ¶
- Constants
- func BuildPackagePURL(ecosystem PackageEcosystem, name, version string) string
- func DefaultHSTSPath() string
- func EvaluateEmbeddedDefaultPolicy(ctx context.Context, input PolicyInput, ...) (PolicyDecision, []OPAPolicyModule, error)
- func EvaluateLocalRegoPolicy(ctx context.Context, input PolicyInput, files []string, ...) (PolicyDecision, []OPAPolicyModule, error)
- func FetchCertificateDigest(ctx context.Context, cfg CertificateDigestConfig) (string, error)
- func MatchRequirementsStyleFile(path string) bool
- func NewHSTSRoundTripper(base http.RoundTripper, store *HSTSStore) http.RoundTripper
- func NewSecureHTTPClient(cfg HTTPSecurityConfig) (*http.Client, error)
- func RenderOutput(format OutputFormat, result NPMPluginScanResult, decisions ...PolicyDecision) (string, error)
- func SendPolicyAlerts(ctx context.Context, cfg WebhookConfig, decision PolicyDecision) error
- type CertificateDigestConfig
- type CertificatePin
- type DefaultJSManifestResolver
- type DefaultPackageResolver
- type DefaultPythonManifestResolver
- type DiscoveredFile
- type FileKind
- type FileMatch
- type FileScanSummary
- type GoModParser
- type GoSumParser
- type HSTSStore
- type HTTPSecurityConfig
- type IntelPluginConfig
- type JSCommandRunner
- type JSManifestResolveRequest
- type JSManifestResolveResult
- type JSManifestResolver
- type ManifestResolutionEvent
- type NPMParser
- type NPMPluginScanConfig
- type NPMPluginScanResult
- type OPAClient
- func (c OPAClient) EmitPolicyModules(ctx context.Context) error
- func (c OPAClient) Evaluate(ctx context.Context, input PolicyInput) (PolicyDecision, error)
- func (c OPAClient) EvaluatePolicies(ctx context.Context, input PolicyInput, policies []string) (PolicyDecision, error)
- func (c OPAClient) PluginConfig(ctx context.Context, name string) (PluginConfigDocument, error)
- func (c OPAClient) PolicyModules(ctx context.Context) ([]OPAPolicyModule, error)
- func (c OPAClient) WebhookConfig(ctx context.Context, name string) (WebhookConfigDocument, error)
- type OPAClientConfig
- type OPAPolicyModule
- type OPAStatusError
- type OpenReceiver
- type OutputConfig
- type OutputFile
- type OutputFormat
- type OutputWriteResult
- type PNPMParser
- type PackageCheckRequest
- type PackageCheckSessionConfig
- type PackageCommandRunner
- type PackageEcosystem
- type PackageInstallPlan
- type PackageManager
- type PackageOccurrence
- type PackageRecord
- type PackageResolution
- type PackageResolver
- type PackageWarning
- type ParseFileResult
- type ParseRequest
- type Parser
- type PipLockParser
- type PipReportParser
- type PluginAcquisitionEvent
- type PluginAcquisitionFailureEvent
- type PluginConfigDocument
- type PluginConfigSource
- type PluginDefinition
- type PluginResult
- type PluginRunSummary
- type PluginSigstoreData
- type PluginTLSConfig
- type PluginValidationCheck
- type PluginValidationFailure
- type PluginValidationMethod
- type PluginValidationOptions
- type PluginValidationResult
- type PluginValidationWarning
- type PoetryLockParser
- type PolicyAction
- type PolicyAlert
- type PolicyDecision
- type PolicyInput
- type PolicyInputResult
- type PolicyRunConfig
- type PolicyRunResult
- type PolicyTimings
- type PyprojectParser
- type PythonCommandRunner
- type PythonManifestResolveRequest
- type PythonManifestResolveResult
- type PythonManifestResolver
- type Receiver
- type RemoteRepoConfig
- type RemoteRepoProvider
- type RequirementsParser
- type ResultStore
- func (s *ResultStore) AddFlushBoundary()
- func (s *ResultStore) AddPackage(pkg PackageOccurrence) bool
- func (s *ResultStore) AddPluginResult(result PluginResult)
- func (s *ResultStore) AddWarning(warning PackageWarning)
- func (s *ResultStore) FileSummaries() []FileScanSummary
- func (s *ResultStore) PURLCount() int
- func (s *ResultStore) PURLs() []string
- func (s *ResultStore) Package(purl string) (PackageRecord, bool)
- func (s *ResultStore) Packages() []PackageRecord
- func (s *ResultStore) PluginInputLines() []string
- func (s *ResultStore) PluginResultCount() int
- func (s *ResultStore) PluginResults() []PluginResult
- func (s *ResultStore) Warnings() []PackageWarning
- type SBOMFile
- type SBOMFormat
- type SBOMParser
- type SBOMScope
- type SBOMWriteConfig
- type SBOMWriteResult
- type ScanConfig
- type ScanResult
- type ScanSessionConfig
- type ScanSessionResult
- type ScanTimings
- type StreamingPolicyProcessor
- type WebhookConfig
- type WebhookConfigDocument
- type YarnParser
Constants ¶
View Source
const ( DefaultMaxRemoteScanCandidates = 4096 DefaultMaxRemoteFileBytes = 50 * 1024 * 1024 )
View Source
const ( PluginValidationDigest = "digest" PluginValidationSigstore = "sigstore" PluginDigestSHA256 = "sha256" PluginDigestSHA512 = "sha512" )
View Source
const ( DefaultPolicyName = "meep/policy/default" DefaultPluginConfigName = "meep/config/plugins" DefaultWebhookConfigName = "meep/config/webhook_config" )
View Source
const EmbeddedDefaultPolicyModuleID = "embedded/default_policy.rego"
View Source
const WarningGeneratedFileUnsafe = "GENERATED_FILE_UNSAFE"
View Source
const WarningManifestResolutionSkipped = "MANIFEST_RESOLUTION_SKIPPED"
View Source
const WarningPythonResolutionSkipped = "PYTHON_RESOLUTION_SKIPPED"
Variables ¶
This section is empty.
Functions ¶
func BuildPackagePURL ¶
func BuildPackagePURL(ecosystem PackageEcosystem, name, version string) string
func DefaultHSTSPath ¶
func DefaultHSTSPath() string
func EvaluateEmbeddedDefaultPolicy ¶
func EvaluateEmbeddedDefaultPolicy(ctx context.Context, input PolicyInput, onPolicyModule func(OPAPolicyModule) error) (PolicyDecision, []OPAPolicyModule, error)
func EvaluateLocalRegoPolicy ¶
func EvaluateLocalRegoPolicy(ctx context.Context, input PolicyInput, files []string, onPolicyModule func(OPAPolicyModule) error) (PolicyDecision, []OPAPolicyModule, error)
func FetchCertificateDigest ¶
func FetchCertificateDigest(ctx context.Context, cfg CertificateDigestConfig) (string, error)
func NewHSTSRoundTripper ¶
func NewHSTSRoundTripper(base http.RoundTripper, store *HSTSStore) http.RoundTripper
func NewSecureHTTPClient ¶
func NewSecureHTTPClient(cfg HTTPSecurityConfig) (*http.Client, error)
func RenderOutput ¶
func RenderOutput(format OutputFormat, result NPMPluginScanResult, decisions ...PolicyDecision) (string, error)
func SendPolicyAlerts ¶
func SendPolicyAlerts(ctx context.Context, cfg WebhookConfig, decision PolicyDecision) error
Types ¶
type CertificateDigestConfig ¶
type CertificatePin ¶
func ParseCertificatePin ¶
func ParseCertificatePin(value string) (CertificatePin, error)
type DefaultJSManifestResolver ¶
type DefaultJSManifestResolver struct {
Runner JSCommandRunner
}
func (DefaultJSManifestResolver) ResolveJSManifest ¶
func (r DefaultJSManifestResolver) ResolveJSManifest(ctx context.Context, req JSManifestResolveRequest) (JSManifestResolveResult, error)
type DefaultPackageResolver ¶
type DefaultPackageResolver struct {
Runner PackageCommandRunner
}
func (DefaultPackageResolver) ResolvePackage ¶
func (r DefaultPackageResolver) ResolvePackage(ctx context.Context, req PackageCheckRequest) (PackageResolution, error)
type DefaultPythonManifestResolver ¶
type DefaultPythonManifestResolver struct {
Runner PythonCommandRunner
}
func (DefaultPythonManifestResolver) ResolvePythonManifest ¶
func (r DefaultPythonManifestResolver) ResolvePythonManifest(ctx context.Context, req PythonManifestResolveRequest) (PythonManifestResolveResult, error)
type DiscoveredFile ¶
type FileMatch ¶
type FileMatch struct {
Kind FileKind
PackageManagers []PackageManager
}
func MatchSupportedFile ¶
func MatchSupportedSBOMFile ¶
type FileScanSummary ¶
type GoModParser ¶
type GoModParser struct{}
func (GoModParser) ID ¶
func (GoModParser) ID() string
func (GoModParser) Match ¶
func (GoModParser) Match(file DiscoveredFile) bool
func (GoModParser) Parse ¶
func (GoModParser) Parse(ctx context.Context, req ParseRequest) (ParseFileResult, error)
type GoSumParser ¶
type GoSumParser struct{}
func (GoSumParser) ID ¶
func (GoSumParser) ID() string
func (GoSumParser) Match ¶
func (GoSumParser) Match(file DiscoveredFile) bool
func (GoSumParser) Parse ¶
func (GoSumParser) Parse(ctx context.Context, req ParseRequest) (ParseFileResult, error)
type HSTSStore ¶
type HSTSStore struct {
// contains filtered or unexported fields
}
func NewHSTSStore ¶
func (*HSTSStore) ShouldUpgrade ¶
type HTTPSecurityConfig ¶
type IntelPluginConfig ¶
type IntelPluginConfig struct {
ID string
Command string
Path string
ConfigSource string
TempDir string
Args []string
Env []string
MaxSizeBytes int64
TLS PluginTLSConfig
SHA256 string
SHA512 string
SigstoreData *PluginSigstoreData
Validation []PluginValidationMethod
CosignPath string
Client *http.Client
}
type JSCommandRunner ¶
type JSManifestResolveRequest ¶
type JSManifestResolveRequest struct {
Root string
File DiscoveredFile
ScanResults []ScanResult
OnEvent func(ManifestResolutionEvent) error
}
type JSManifestResolveResult ¶
type JSManifestResolveResult struct {
File DiscoveredFile
Cleanup func() error
Warnings []PackageWarning
}
type JSManifestResolver ¶
type JSManifestResolver interface {
ResolveJSManifest(context.Context, JSManifestResolveRequest) (JSManifestResolveResult, error)
}
type ManifestResolutionEvent ¶
type NPMParser ¶
type NPMParser struct{}
func (NPMParser) Match ¶
func (NPMParser) Match(file DiscoveredFile) bool
func (NPMParser) Parse ¶
func (NPMParser) Parse(ctx context.Context, req ParseRequest) (ParseFileResult, error)
type NPMPluginScanConfig ¶
type NPMPluginScanResult ¶
type NPMPluginScanResult struct {
PURLs []string
ParseWarnings []PackageWarning
PluginResults []PluginResult
FileSummaries []FileScanSummary
Packages []PackageRecord
}
func ScanNPMAndRunPlugin ¶
func ScanNPMAndRunPlugin(ctx context.Context, cfg NPMPluginScanConfig) (NPMPluginScanResult, error)
type OPAClient ¶
type OPAClient struct {
// contains filtered or unexported fields
}
func NewOPAClient ¶
func NewOPAClient(cfg OPAClientConfig) OPAClient
func (OPAClient) EmitPolicyModules ¶
func (OPAClient) Evaluate ¶
func (c OPAClient) Evaluate(ctx context.Context, input PolicyInput) (PolicyDecision, error)
func (OPAClient) EvaluatePolicies ¶
func (c OPAClient) EvaluatePolicies(ctx context.Context, input PolicyInput, policies []string) (PolicyDecision, error)
func (OPAClient) PluginConfig ¶
func (OPAClient) PolicyModules ¶
func (c OPAClient) PolicyModules(ctx context.Context) ([]OPAPolicyModule, error)
func (OPAClient) WebhookConfig ¶
type OPAClientConfig ¶
type OPAPolicyModule ¶
type OPAStatusError ¶
func (OPAStatusError) Error ¶
func (e OPAStatusError) Error() string
type OpenReceiver ¶
type OpenReceiver struct{}
func (OpenReceiver) Receive ¶
func (OpenReceiver) Receive(ctx context.Context, file DiscoveredFile) ScanResult
type OutputConfig ¶
type OutputConfig struct {
BasePath string
Formats []OutputFormat
Result NPMPluginScanResult
PolicyDecision PolicyDecision
}
type OutputFile ¶
type OutputFile struct {
Format OutputFormat
Path string
}
func WriteOutputs ¶
func WriteOutputs(cfg OutputConfig) ([]OutputFile, error)
type OutputFormat ¶
type OutputFormat string
const ( OutputJSON OutputFormat = "json" OutputYAML OutputFormat = "yaml" OutputCSV OutputFormat = "csv" OutputSARIF OutputFormat = "sarif" )
func ParseOutputFormats ¶
func ParseOutputFormats(value string) ([]OutputFormat, error)
type OutputWriteResult ¶
type OutputWriteResult struct {
Files []OutputFile
Timing time.Duration
}
func WriteOutputsTimed ¶
func WriteOutputsTimed(cfg OutputConfig) (out OutputWriteResult, err error)
type PNPMParser ¶
type PNPMParser struct{}
func (PNPMParser) ID ¶
func (PNPMParser) ID() string
func (PNPMParser) Match ¶
func (PNPMParser) Match(file DiscoveredFile) bool
func (PNPMParser) Parse ¶
func (PNPMParser) Parse(ctx context.Context, req ParseRequest) (ParseFileResult, error)
type PackageCheckRequest ¶
type PackageCheckRequest struct {
Manager PackageManager
Ecosystem PackageEcosystem
Name string
Version string
PURL string
IncludeTransitives bool
}
func ParsePackageCheckSpec ¶
func ParsePackageCheckSpec(manager PackageManager, spec string) (PackageCheckRequest, error)
type PackageCheckSessionConfig ¶
type PackageCheckSessionConfig struct {
Resolution PackageResolution
Plugins []IntelPluginConfig
OnPluginStart func(IntelPluginConfig) error
OnPluginAcquired func(PluginAcquisitionEvent) error
OnPluginAcquisitionFailure func(PluginAcquisitionFailureEvent) error
OnPluginValidationCheck func(IntelPluginConfig, PluginValidationCheck) error
OnPluginValidationSuccess func(IntelPluginConfig, PluginValidationCheck) error
OnPluginValidationWarning func(IntelPluginConfig, PluginValidationWarning) error
OnPluginResult func(string, PluginResult) error
PolicyConfig *PolicyRunConfig
}
type PackageCommandRunner ¶
type PackageEcosystem ¶
type PackageEcosystem string
const ( PackageEcosystemNPM PackageEcosystem = "npm" PackageEcosystemPyPI PackageEcosystem = "pypi" PackageEcosystemGo PackageEcosystem = "golang" )
type PackageInstallPlan ¶
type PackageInstallPlan struct {
Manager PackageManager
Command []string
Dir string
}
type PackageManager ¶
type PackageManager string
const ( PackageManagerNPM PackageManager = "npm" PackageManagerPNPM PackageManager = "pnpm" PackageManagerYarn PackageManager = "yarn" PackageManagerPip PackageManager = "pip" PackageManagerPoetry PackageManager = "poetry" PackageManagerGo PackageManager = "go" PackageManagerSBOM PackageManager = "sbom" )
type PackageOccurrence ¶
type PackageOccurrence struct {
PURL string
Name string
Version string
PackageManager PackageManager
ParserID string
ProjectName string
ProjectVersion string
SourcePath string
SourceRelPath string
SourceURL string
}
func ParseSBOMFile ¶
func ParseSBOMFile(ctx context.Context, path string) ([]PackageOccurrence, error)
type PackageRecord ¶
type PackageRecord struct {
PURL string
Name string
Version string
Occurrences []PackageOccurrence
}
type PackageResolution ¶
type PackageResolution struct {
RequestedPURL string
PURLs []string
Warnings []PackageWarning
InstallPlan *PackageInstallPlan
}
type PackageResolver ¶
type PackageResolver interface {
ResolvePackage(context.Context, PackageCheckRequest) (PackageResolution, error)
}
type PackageWarning ¶
type ParseFileResult ¶
type ParseFileResult struct {
Packages []PackageOccurrence
Warnings []PackageWarning
}
type ParseRequest ¶
type ParseRequest struct {
Root string
ScanResults []ScanResult
File DiscoveredFile
}
type Parser ¶
type Parser interface {
ID() string
Match(DiscoveredFile) bool
Parse(context.Context, ParseRequest) (ParseFileResult, error)
}
func DefaultParsers ¶
func DefaultParsers() []Parser
type PipLockParser ¶
type PipLockParser struct{}
func (PipLockParser) ID ¶
func (PipLockParser) ID() string
func (PipLockParser) Match ¶
func (PipLockParser) Match(file DiscoveredFile) bool
func (PipLockParser) Parse ¶
func (PipLockParser) Parse(ctx context.Context, req ParseRequest) (ParseFileResult, error)
type PipReportParser ¶
type PipReportParser struct{}
func (PipReportParser) ID ¶
func (PipReportParser) ID() string
func (PipReportParser) Match ¶
func (PipReportParser) Match(file DiscoveredFile) bool
func (PipReportParser) Parse ¶
func (PipReportParser) Parse(ctx context.Context, req ParseRequest) (ParseFileResult, error)
type PluginAcquisitionEvent ¶
type PluginConfigDocument ¶
type PluginConfigDocument struct {
Plugins []PluginDefinition `json:"plugins"`
Sources []PluginConfigSource `json:"-"`
}
func FetchOPAPluginConfig ¶
func FetchOPAPluginConfig(ctx context.Context, cfg OPAClientConfig, names []string) (PluginConfigDocument, error)
type PluginConfigSource ¶
type PluginDefinition ¶
type PluginDefinition struct {
ID string `json:"id"`
Path string `json:"path"`
Args []string `json:"args,omitempty"`
Env []string `json:"env,omitempty"`
MaxSizeBytes int64 `json:"max-size-bytes,omitempty"`
TLS PluginTLSConfig `json:"tls,omitempty"`
SHA256 string `json:"sha256,omitempty"`
SHA512 string `json:"sha512,omitempty"`
SigstoreData *PluginSigstoreData `json:"sigstore-data,omitempty"`
Validation []PluginValidationMethod `json:"validation,omitempty"`
}
type PluginResult ¶
type PluginResult = intel.PluginResult
type PluginRunSummary ¶
type PluginSigstoreData ¶
type PluginSigstoreData struct {
Bundle string `json:"bundle,omitempty"`
Signature string `json:"signature,omitempty"`
Certificate string `json:"certificate,omitempty"`
CertificateIdentity string `json:"certificate-identity,omitempty"`
CertificateIdentityRegexp string `json:"certificate-identity-regexp,omitempty"`
CertificateOIDCIssuer string `json:"certificate-oidc-issuer,omitempty"`
CertificateOIDCIssuerRegexp string `json:"certificate-oidc-issuer-regexp,omitempty"`
Key string `json:"key,omitempty"`
RekorURL string `json:"rekor-url,omitempty"`
Mandatory bool `json:"mandatory,omitempty"`
}
type PluginTLSConfig ¶
type PluginValidationCheck ¶
type PluginValidationCheck struct {
Method string
}
type PluginValidationFailure ¶
func (PluginValidationFailure) Error ¶
func (f PluginValidationFailure) Error() string
type PluginValidationMethod ¶
type PluginValidationOptions ¶
type PluginValidationOptions struct {
CosignPath string
}
type PluginValidationResult ¶
type PluginValidationResult struct {
PluginID string
Path string
Valid bool
Skipped bool
Checks []PluginValidationCheck
Warnings []PluginValidationWarning
Failures []PluginValidationFailure
}
func ValidatePlugin ¶
func ValidatePlugin(plugin PluginDefinition) PluginValidationResult
func ValidatePluginWithOptions ¶
func ValidatePluginWithOptions(ctx context.Context, plugin PluginDefinition, opts PluginValidationOptions) PluginValidationResult
type PluginValidationWarning ¶
type PoetryLockParser ¶
type PoetryLockParser struct{}
func (PoetryLockParser) ID ¶
func (PoetryLockParser) ID() string
func (PoetryLockParser) Match ¶
func (PoetryLockParser) Match(file DiscoveredFile) bool
func (PoetryLockParser) Parse ¶
func (PoetryLockParser) Parse(ctx context.Context, req ParseRequest) (ParseFileResult, error)
type PolicyAction ¶
type PolicyAction string
const ( PolicyActionBlock PolicyAction = "block" PolicyActionAlert PolicyAction = "alert" )
type PolicyAlert ¶
type PolicyAlert struct {
Action PolicyAction `json:"action"`
Reason string `json:"reason"`
PluginID string `json:"plugin-id"`
PluginConfigID string `json:"plugin-config-id,omitempty"`
PURL string `json:"purl"`
Status string `json:"status,omitempty"`
Malicious *bool `json:"malicious,omitempty"`
MaliciousPackage *bool `json:"maliciousPackage,omitempty"`
SuspiciousScore *float64 `json:"suspiciousScore,omitempty"`
ResultCount []int `json:"resultCount,omitempty"`
Behaviors []string `json:"behaviors,omitempty"`
VulnerabilityIDs []string `json:"vulnerabilityIDs,omitempty"`
IntelSpecific map[string]any `json:"intel-specific,omitempty"`
SourceFiles []string `json:"sourceFiles,omitempty"`
Result PolicyInputResult `json:"result"`
Document map[string]any `json:"-"`
}
func (PolicyAlert) MarshalJSON ¶
func (a PolicyAlert) MarshalJSON() ([]byte, error)
func (*PolicyAlert) UnmarshalJSON ¶
func (a *PolicyAlert) UnmarshalJSON(data []byte) error
type PolicyDecision ¶
type PolicyDecision struct {
Block bool `json:"block"`
Alerts []PolicyAlert `json:"alerts"`
}
func EvaluateDefaultPolicy ¶
func EvaluateDefaultPolicy(result NPMPluginScanResult) (PolicyDecision, error)
type PolicyInput ¶
type PolicyInput struct {
Results []PolicyInputResult `json:"results"`
}
func BuildPolicyInput ¶
func BuildPolicyInput(result NPMPluginScanResult) PolicyInput
type PolicyInputResult ¶
type PolicyInputResult struct {
PluginID string `json:"plugin-id"`
PluginConfigID string `json:"plugin-config-id,omitempty"`
PURL string `json:"purl"`
Status string `json:"status"`
ResultCount []int `json:"resultCount,omitempty"`
Malicious *bool `json:"malicious,omitempty"`
MaliciousPackage *bool `json:"maliciousPackage,omitempty"`
SuspiciousScore *float64 `json:"suspiciousScore,omitempty"`
Behaviors []string `json:"behaviors,omitempty"`
VulnerabilityIDs []string `json:"vulnerabilityIDs,omitempty"`
IntelSpecific map[string]any `json:"intel-specific,omitempty"`
SourceFiles []string `json:"sourceFiles,omitempty"`
Document map[string]any `json:"-"`
}
func (PolicyInputResult) MarshalJSON ¶
func (r PolicyInputResult) MarshalJSON() ([]byte, error)
func (*PolicyInputResult) UnmarshalJSON ¶
func (r *PolicyInputResult) UnmarshalJSON(data []byte) error
type PolicyRunConfig ¶
type PolicyRunResult ¶
type PolicyRunResult struct {
Decision PolicyDecision
WebhookSent int
PolicyModules []OPAPolicyModule
Timings PolicyTimings
}
func ProcessPolicy ¶
func ProcessPolicy(ctx context.Context, result NPMPluginScanResult, cfg PolicyRunConfig) (out PolicyRunResult, err error)
type PolicyTimings ¶
type PyprojectParser ¶
type PyprojectParser struct{}
func (PyprojectParser) ID ¶
func (PyprojectParser) ID() string
func (PyprojectParser) Match ¶
func (PyprojectParser) Match(file DiscoveredFile) bool
func (PyprojectParser) Parse ¶
func (PyprojectParser) Parse(ctx context.Context, req ParseRequest) (ParseFileResult, error)
type PythonCommandRunner ¶
type PythonManifestResolveRequest ¶
type PythonManifestResolveRequest struct {
Root string
File DiscoveredFile
ScanResults []ScanResult
EnableUnsafePipResolution bool
OnEvent func(ManifestResolutionEvent) error
}
type PythonManifestResolveResult ¶
type PythonManifestResolveResult struct {
File DiscoveredFile
Cleanup func() error
Warnings []PackageWarning
}
type PythonManifestResolver ¶
type PythonManifestResolver interface {
ResolvePythonManifest(context.Context, PythonManifestResolveRequest) (PythonManifestResolveResult, error)
}
type Receiver ¶
type Receiver interface {
Receive(context.Context, DiscoveredFile) ScanResult
}
type RemoteRepoConfig ¶
type RemoteRepoProvider ¶
type RemoteRepoProvider string
const RemoteRepoGitHub RemoteRepoProvider = "github"
type RequirementsParser ¶
type RequirementsParser struct{}
func (RequirementsParser) ID ¶
func (RequirementsParser) ID() string
func (RequirementsParser) Match ¶
func (RequirementsParser) Match(file DiscoveredFile) bool
func (RequirementsParser) Parse ¶
func (RequirementsParser) Parse(ctx context.Context, req ParseRequest) (ParseFileResult, error)
type ResultStore ¶
type ResultStore struct {
// contains filtered or unexported fields
}
func NewResultStore ¶
func NewResultStore() *ResultStore
func (*ResultStore) AddFlushBoundary ¶
func (s *ResultStore) AddFlushBoundary()
func (*ResultStore) AddPackage ¶
func (s *ResultStore) AddPackage(pkg PackageOccurrence) bool
func (*ResultStore) AddPluginResult ¶
func (s *ResultStore) AddPluginResult(result PluginResult)
func (*ResultStore) AddWarning ¶
func (s *ResultStore) AddWarning(warning PackageWarning)
func (*ResultStore) FileSummaries ¶
func (s *ResultStore) FileSummaries() []FileScanSummary
func (*ResultStore) PURLCount ¶
func (s *ResultStore) PURLCount() int
func (*ResultStore) PURLs ¶
func (s *ResultStore) PURLs() []string
func (*ResultStore) Package ¶
func (s *ResultStore) Package(purl string) (PackageRecord, bool)
func (*ResultStore) Packages ¶
func (s *ResultStore) Packages() []PackageRecord
func (*ResultStore) PluginInputLines ¶
func (s *ResultStore) PluginInputLines() []string
func (*ResultStore) PluginResultCount ¶
func (s *ResultStore) PluginResultCount() int
func (*ResultStore) PluginResults ¶
func (s *ResultStore) PluginResults() []PluginResult
func (*ResultStore) Warnings ¶
func (s *ResultStore) Warnings() []PackageWarning
type SBOMFile ¶
type SBOMFile struct {
Format SBOMFormat
Path string
}
type SBOMFormat ¶
type SBOMFormat string
const ( SBOMFormatCycloneDXJSON SBOMFormat = "cyclonedx" SBOMFormatSPDXJSON SBOMFormat = "spdx" )
func ParseSBOMFormats ¶
func ParseSBOMFormats(value string) ([]SBOMFormat, error)
type SBOMParser ¶
type SBOMParser struct{}
func (SBOMParser) ID ¶
func (SBOMParser) ID() string
func (SBOMParser) Match ¶
func (SBOMParser) Match(file DiscoveredFile) bool
func (SBOMParser) Parse ¶
func (SBOMParser) Parse(ctx context.Context, req ParseRequest) (ParseFileResult, error)
type SBOMWriteConfig ¶
type SBOMWriteConfig struct {
BasePath string
Formats []SBOMFormat
Scope SBOMScope
Result ScanSessionResult
}
type SBOMWriteResult ¶
type SBOMWriteResult struct {
Files []SBOMFile
}
func WriteSBOMs ¶
func WriteSBOMs(cfg SBOMWriteConfig) (SBOMWriteResult, error)
type ScanConfig ¶
type ScanResult ¶
type ScanResult struct {
File DiscoveredFile
Opened bool
Err error
}
func Scan ¶
func Scan(ctx context.Context, cfg ScanConfig) ([]ScanResult, error)
func ScanGitHubRepository ¶
func ScanGitHubRepository(ctx context.Context, cfg RemoteRepoConfig) ([]ScanResult, string, error)
type ScanSessionConfig ¶
type ScanSessionConfig struct {
Root string
RemoteRepo *RemoteRepoConfig
ScanSBOMs bool
DisablePythonManifestResolution bool
EnableUnsafePipResolution bool
AdditionalRequirementsFiles []string
PythonManifestResolver PythonManifestResolver
JSManifestResolver JSManifestResolver
ScanResults []ScanResult
Parsers []Parser
Plugins []IntelPluginConfig
OnScanResult func(ScanResult) error
OnManifestResolution func(ManifestResolutionEvent) error
OnPackage func(PackageOccurrence) error
OnPluginStart func(IntelPluginConfig) error
OnPluginAcquired func(PluginAcquisitionEvent) error
OnPluginAcquisitionFailure func(PluginAcquisitionFailureEvent) error
OnPluginValidationCheck func(IntelPluginConfig, PluginValidationCheck) error
OnPluginValidationSuccess func(IntelPluginConfig, PluginValidationCheck) error
OnPluginValidationWarning func(IntelPluginConfig, PluginValidationWarning) error
OnPluginResult func(string, PluginResult) error
PolicyConfig *PolicyRunConfig
}
type ScanSessionResult ¶
type ScanSessionResult struct {
ScanResults []ScanResult
Store *ResultStore
Timings ScanTimings
PURLs []string
PluginResults []PluginResult
PluginRuns []PluginRunSummary
FileSummaries []FileScanSummary
Warnings []PackageWarning
PolicyRun PolicyRunResult
}
func RunPackageCheckSession ¶
func RunPackageCheckSession(ctx context.Context, cfg PackageCheckSessionConfig) (ScanSessionResult, error)
func RunScanSession ¶
func RunScanSession(ctx context.Context, cfg ScanSessionConfig) (out ScanSessionResult, err error)
type ScanTimings ¶
type StreamingPolicyProcessor ¶
type StreamingPolicyProcessor struct {
// contains filtered or unexported fields
}
func NewStreamingPolicyProcessor ¶
func NewStreamingPolicyProcessor(cfg PolicyRunConfig, packages []PackageRecord) *StreamingPolicyProcessor
func (*StreamingPolicyProcessor) ProcessPluginResult ¶
func (p *StreamingPolicyProcessor) ProcessPluginResult(ctx context.Context, result PluginResult) error
func (*StreamingPolicyProcessor) Result ¶
func (p *StreamingPolicyProcessor) Result() PolicyRunResult
type WebhookConfig ¶
type WebhookConfigDocument ¶
type WebhookConfigDocument struct {
URL string `json:"url,omitempty"`
CertPin string `json:"cert-pin,omitempty"`
AcceptSelfSigned bool `json:"accept-self-signed,omitempty"`
EnableHSTS bool `json:"enable-hsts,omitempty"`
HSTSPath string `json:"hsts-path,omitempty"`
Sources []PluginConfigSource `json:"-"`
}
func FetchOPAWebhookConfig ¶
func FetchOPAWebhookConfig(ctx context.Context, cfg OPAClientConfig, names []string) (WebhookConfigDocument, error)
type YarnParser ¶
type YarnParser struct{}
func (YarnParser) ID ¶
func (YarnParser) ID() string
func (YarnParser) Match ¶
func (YarnParser) Match(file DiscoveredFile) bool
func (YarnParser) Parse ¶
func (YarnParser) Parse(ctx context.Context, req ParseRequest) (ParseFileResult, error)
Source Files
¶
Click to show internal directories.
Click to hide internal directories.