Documentation
¶
Index ¶
- Constants
- func DisplayScanDetails(scanDetails *ar_v3.ArtifactScanDetails)
- func ExecuteWithFirewall(client Client, f *cmdutils.Factory, command string, args []string, ...) error
- func ResolveRegistryUUID(f *cmdutils.Factory, registryIdentifier, org, project string, ...) (uuid.UUID, error)
- func RunNativeCommand(binary string, args []string) error
- type Client
- type DependencyResult
- type InstallResult
- type ParsedArgs
- type RegistryInfo
- type ScanStatusCounts
Constants ¶
const ( PackageTypeNpm = "npm" PackageTypeMaven = "maven" PackageTypePyPI = "pypi" PackageTypeNuGet = "nuget" )
Package type identifiers used in registry URLs and client detection.
const ( CommandNpm = "npm" CommandMvn = "mvn" CommandPip = "pip" CommandDotnet = "dotnet" )
Command names for each package manager CLI tool.
Variables ¶
This section is empty.
Functions ¶
func DisplayScanDetails ¶
func DisplayScanDetails(scanDetails *ar_v3.ArtifactScanDetails)
DisplayScanDetails shows policy violations for a single scan result.
func ExecuteWithFirewall ¶
func ExecuteWithFirewall( client Client, f *cmdutils.Factory, command string, args []string, explicitRegistry string, progress p.Reporter, ) error
ExecuteWithFirewall runs the common 4-phase flow for any package manager:
- Detect HAR registry
- Resolve registry UUID
- Run native command
- On 403: resolve deps → firewall evaluation
func ResolveRegistryUUID ¶
func ResolveRegistryUUID(f *cmdutils.Factory, registryIdentifier, org, project string, progress p.Reporter) (uuid.UUID, error)
ResolveRegistryUUID looks up the registry UUID from the registry identifier.
func RunNativeCommand ¶
Types ¶
type Client ¶
type Client interface {
// Name returns the client name, e.g. "npm", "maven", "pip", "nuget".
Name() string
// PackageType returns the registry package type, e.g. "npm", "maven", "pypi", "nuget".
PackageType() string
// DetectRegistry detects the HAR registry from saved config or native config files.
// explicitRegistry is an optional user-provided registry identifier.
DetectRegistry(explicitRegistry string) (*RegistryInfo, error)
// RunCommand executes the native package manager command (e.g. "npm install").
// command is the subcommand ("install", "ci", etc.), args are pass-through arguments.
RunCommand(command string, args []string) (*InstallResult, error)
// ResolveDependencies returns the full dependency list (including transitive).
// Used for firewall evaluation after a 403 is detected.
ResolveDependencies(progress p.Reporter) (*DependencyResult, error)
// DetectFirewallError checks if stderr contains a 403/firewall block pattern.
DetectFirewallError(stderr string) bool
// FallbackOrgProject returns org/project from saved client config.
// Used as fallback when global config and env vars don't have them.
FallbackOrgProject() (org string, project string)
}
Client defines the interface that each package manager must implement.
type DependencyResult ¶
type DependencyResult struct {
Dependencies []regcmd.Dependency
Cleanup func()
}
DependencyResult holds resolved dependencies and an optional cleanup function.
type InstallResult ¶
InstallResult holds the result of running a native package manager command.
type ParsedArgs ¶
func ParseWrappedArgs ¶
func ParseWrappedArgs(args []string) ParsedArgs
type RegistryInfo ¶
type RegistryInfo struct {
RegistryURL string
RegistryIdentifier string
AccountID string
AuthToken string
}
RegistryInfo holds detected HAR registry details.
type ScanStatusCounts ¶ added in v1.3.47
ScanStatusCounts is the Allowed / Warn / Blocked / Unknown tally from a firewall evaluation.
func DisplayBlockedScanResults ¶
func DisplayBlockedScanResults(f *cmdutils.Factory, scans []ar_v3.BulkScanResultItem, progress p.Reporter, resolved int, partial bool) ScanStatusCounts
DisplayBlockedScanResults shows detailed scan info for each package, then a consolidated tally. resolved is the number of dependencies submitted for evaluation (may exceed len(scans) on partial failure). Printed with fmt so the summary is visible even when ConsoleReporter suppresses CI logs.
func RunFirewallExplain ¶
func RunFirewallExplain(f *cmdutils.Factory, registryUUID uuid.UUID, artifacts []ar_v3.ArtifactScanInput, org, project string, progress p.Reporter) (ScanStatusCounts, error)
RunFirewallExplain evaluates artifacts against firewall policies and displays results. Automatically batches into chunks of 50 (API limit). Returns the status tally (used by the caller for the final error and build-info upload).
func (ScanStatusCounts) Total ¶ added in v1.3.47
func (c ScanStatusCounts) Total() int
Total returns the number of packages included in the tally.