Documentation
¶
Index ¶
- func DisplayBlockedScanResults(f *cmdutils.Factory, scans []ar_v3.BulkScanResultItem, progress p.Reporter) error
- 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 RunFirewallExplain(f *cmdutils.Factory, registryUUID uuid.UUID, ...) (int, error)
- type Client
- type DependencyResult
- type InstallResult
- type RegistryInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DisplayBlockedScanResults ¶
func DisplayBlockedScanResults(f *cmdutils.Factory, scans []ar_v3.BulkScanResultItem, progress p.Reporter) error
DisplayBlockedScanResults shows detailed scan info for each blocked/warned package.
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 RunFirewallExplain ¶
func RunFirewallExplain(f *cmdutils.Factory, registryUUID uuid.UUID, artifacts []ar_v3.ArtifactScanInput, org, project string, progress p.Reporter) (int, error)
RunFirewallExplain evaluates artifacts against firewall policies and displays results. Automatically batches into chunks of 50 (API limit). Returns the number of scan results and any error.
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.