Documentation
¶
Index ¶
- Constants
- func BuildPackageWithVersionRegex(impactedName, impactedVersion, dependencyLineFormat string) *regexp.Regexp
- func GetVulnerabilityLocations(vulnDetails *utils.VulnerabilityDetails, namesFilters []string, ...) []string
- type CommonPackageUpdater
- func (cph *CommonPackageUpdater) BuildPackageDependencyLineRegex(impactedName, impactedVersion, dependencyLineFormat string) *regexp.Regexp
- func (cph *CommonPackageUpdater) CollectVulnerabilityDescriptorPaths(vulnDetails *utils.VulnerabilityDetails, namesFilters []string, ...) []string
- func (cph *CommonPackageUpdater) GetAllDescriptorFilesFullPaths(descriptorFilesSuffixes []string, patternsToExclude ...string) (descriptorFilesFullPaths []string, err error)
- func (cph *CommonPackageUpdater) GetFixedPackageJSONManifest(content []byte, packageName, newVersion, descriptorPath string) ([]byte, error)
- func (cph *CommonPackageUpdater) UpdateDependency(vulnDetails *utils.VulnerabilityDetails, installationCommand string, ...) (err error)
- func (cph *CommonPackageUpdater) UpdatePackageJSONDescriptor(descriptorPath, packageName, newVersion string) ([]byte, error)
- type ConanPackageUpdater
- type GoPackageUpdater
- type GradlePackageUpdater
- type MavenPackageUpdater
- type NpmPackageUpdater
- type NugetPackageUpdater
- type PackageUpdater
- type PnpmPackageUpdater
- type PythonPackageUpdater
- type UnsupportedPackageUpdater
- type YarnPackageUpdater
Constants ¶
const ( // Package names are case-insensitive with this prefix PythonPackageRegexPrefix = "(?i)" // Match all possible operators and versions syntax PythonPackageRegexSuffix = "" /* 132-byte string literal not displayed */ )
Variables ¶
This section is empty.
Functions ¶
func GetVulnerabilityLocations ¶
func GetVulnerabilityLocations(vulnDetails *utils.VulnerabilityDetails, namesFilters []string, ignoreFilters []string) []string
Types ¶
type CommonPackageUpdater ¶
type CommonPackageUpdater struct{}
TODO can be deleted if not needed after refactoring all package updaters
func (*CommonPackageUpdater) BuildPackageDependencyLineRegex ¶
func (cph *CommonPackageUpdater) BuildPackageDependencyLineRegex(impactedName, impactedVersion, dependencyLineFormat string) *regexp.Regexp
BuildPackageDependencyLineRegex builds a regexp for matching a dependency line in a manifest.
func (*CommonPackageUpdater) CollectVulnerabilityDescriptorPaths ¶
func (cph *CommonPackageUpdater) CollectVulnerabilityDescriptorPaths(vulnDetails *utils.VulnerabilityDetails, namesFilters []string, ignoreFilters []string) []string
func (*CommonPackageUpdater) GetAllDescriptorFilesFullPaths ¶
func (cph *CommonPackageUpdater) GetAllDescriptorFilesFullPaths(descriptorFilesSuffixes []string, patternsToExclude ...string) (descriptorFilesFullPaths []string, err error)
Recursively scans the current directory for descriptor files based on the provided list of suffixes, while excluding paths that match the specified exclusion patterns. The patternsToExclude must be provided as regexp patterns. For instance, if the pattern ".*node_modules.*" is provided, any paths containing "node_modules" will be excluded from the result. Returns a slice of all discovered descriptor files, represented as absolute paths.
func (*CommonPackageUpdater) GetFixedPackageJSONManifest ¶
func (cph *CommonPackageUpdater) GetFixedPackageJSONManifest(content []byte, packageName, newVersion, descriptorPath string) ([]byte, error)
GetFixedPackageJSONManifest returns manifest bytes with packageName set to newVersion in allowed sections.
func (*CommonPackageUpdater) UpdateDependency ¶
func (cph *CommonPackageUpdater) UpdateDependency(vulnDetails *utils.VulnerabilityDetails, installationCommand string, extraArgs ...string) (err error)
UpdateDependency updates the impacted package to the fixed version
func (*CommonPackageUpdater) UpdatePackageJSONDescriptor ¶
func (cph *CommonPackageUpdater) UpdatePackageJSONDescriptor(descriptorPath, packageName, newVersion string) ([]byte, error)
UpdatePackageJSONDescriptor writes the fixed version for packageName to descriptorPath and returns original file bytes for rollback.
type ConanPackageUpdater ¶
type ConanPackageUpdater struct {
CommonPackageUpdater
}
func (*ConanPackageUpdater) UpdateDependency ¶
func (conan *ConanPackageUpdater) UpdateDependency(vulnDetails *utils.VulnerabilityDetails) error
type GoPackageUpdater ¶
type GoPackageUpdater struct{}
func (*GoPackageUpdater) UpdateDependency ¶
func (gpu *GoPackageUpdater) UpdateDependency(vulnDetails *utils.VulnerabilityDetails) error
type GradlePackageUpdater ¶
type GradlePackageUpdater struct {
CommonPackageUpdater
}
func (*GradlePackageUpdater) UpdateDependency ¶
func (gph *GradlePackageUpdater) UpdateDependency(vulnDetails *utils.VulnerabilityDetails) error
type MavenPackageUpdater ¶
type MavenPackageUpdater struct{}
func (*MavenPackageUpdater) UpdateDependency ¶
func (m *MavenPackageUpdater) UpdateDependency(vulnDetails *utils.VulnerabilityDetails) error
type NpmPackageUpdater ¶
type NpmPackageUpdater struct {
CommonPackageUpdater
}
func (*NpmPackageUpdater) UpdateDependency ¶
func (npm *NpmPackageUpdater) UpdateDependency(vulnDetails *utils.VulnerabilityDetails) error
type NugetPackageUpdater ¶
type NugetPackageUpdater struct {
CommonPackageUpdater
}
func (*NugetPackageUpdater) UpdateDependency ¶
func (nph *NugetPackageUpdater) UpdateDependency(vulnDetails *utils.VulnerabilityDetails) error
type PackageUpdater ¶
type PackageUpdater interface {
UpdateDependency(details *utils.VulnerabilityDetails) error
}
PackageUpdater interface to hold operations on packages
func GetCompatiblePackageUpdater ¶
func GetCompatiblePackageUpdater(vulnDetails *utils.VulnerabilityDetails, details *utils.ScanDetails) (handler PackageUpdater)
type PnpmPackageUpdater ¶
type PnpmPackageUpdater struct {
CommonPackageUpdater
}
func (*PnpmPackageUpdater) UpdateDependency ¶
func (pnpm *PnpmPackageUpdater) UpdateDependency(vulnDetails *utils.VulnerabilityDetails) error
type PythonPackageUpdater ¶
type PythonPackageUpdater struct {
CommonPackageUpdater
// contains filtered or unexported fields
}
func (*PythonPackageUpdater) UpdateDependency ¶
func (py *PythonPackageUpdater) UpdateDependency(vulnDetails *utils.VulnerabilityDetails) error
type UnsupportedPackageUpdater ¶
type UnsupportedPackageUpdater struct {
}
func (*UnsupportedPackageUpdater) UpdateDependency ¶
func (uph *UnsupportedPackageUpdater) UpdateDependency(vulnDetails *utils.VulnerabilityDetails) error
type YarnPackageUpdater ¶
type YarnPackageUpdater struct {
CommonPackageUpdater
}
func (*YarnPackageUpdater) UpdateDependency ¶
func (yarn *YarnPackageUpdater) UpdateDependency(vulnDetails *utils.VulnerabilityDetails) error