mirror of
https://github.com/anchore/syft.git
synced 2026-11-05 00:46:38 +01:00
chore(deps): update tools to latest versions (#3144)
This commit is contained in:
@@ -34,7 +34,7 @@ type parsedData struct {
|
||||
// parseApkDB parses packages from a given APK "installed" flat-file DB. For more
|
||||
// information on specific fields, see https://wiki.alpinelinux.org/wiki/Apk_spec.
|
||||
//
|
||||
//nolint:funlen,gocognit
|
||||
//nolint:funlen
|
||||
func parseApkDB(_ context.Context, resolver file.Resolver, env *generic.Environment, reader file.LocationReadCloser) ([]pkg.Package, []artifact.Relationship, error) {
|
||||
scanner := bufio.NewScanner(reader)
|
||||
|
||||
|
||||
@@ -196,7 +196,6 @@ func matchExcluding(matcher EvidenceMatcher, contentPatternsToExclude ...string)
|
||||
}
|
||||
}
|
||||
|
||||
//nolint:gocognit
|
||||
func sharedLibraryLookup(sharedLibraryPattern string, sharedLibraryMatcher EvidenceMatcher) EvidenceMatcher {
|
||||
pat := regexp.MustCompile(sharedLibraryPattern)
|
||||
return func(classifier Classifier, context matcherContext) (packages []pkg.Package, _ error) {
|
||||
|
||||
@@ -157,7 +157,7 @@ func copyBinariesFromDockerImage(config config.BinaryFromImage, destination stri
|
||||
|
||||
defer func() {
|
||||
cmd := exec.Command("docker", "rm", containerName)
|
||||
cmd.Run() // nolint:errcheck
|
||||
cmd.Run() //nolint:errcheck
|
||||
}()
|
||||
|
||||
for i, destinationPath := range config.AllStorePathsForImage(image, destination) {
|
||||
@@ -182,7 +182,7 @@ func copyBinaryFromContainer(containerName, containerPath, destinationPath, fing
|
||||
return err
|
||||
}
|
||||
|
||||
cmd := exec.Command("docker", "cp", fmt.Sprintf("%s:%s", containerName, containerPath), destinationPath) // nolint:gosec
|
||||
cmd := exec.Command("docker", "cp", fmt.Sprintf("%s:%s", containerName, containerPath), destinationPath) //nolint:gosec
|
||||
// reason for gosec exception: this is for processing test fixtures only, not used in production
|
||||
if err := cmd.Run(); err != nil {
|
||||
return err
|
||||
|
||||
@@ -169,7 +169,6 @@ func getAdditionalFileListing(resolver file.Resolver, dbLocation file.Location,
|
||||
return files, locations
|
||||
}
|
||||
|
||||
//nolint:dupl
|
||||
func fetchMd5Contents(resolver file.Resolver, dbLocation file.Location, m pkg.DpkgDBEntry) (io.ReadCloser, *file.Location) {
|
||||
var md5Reader io.ReadCloser
|
||||
var err error
|
||||
@@ -213,7 +212,6 @@ func fetchMd5Contents(resolver file.Resolver, dbLocation file.Location, m pkg.Dp
|
||||
return md5Reader, &l
|
||||
}
|
||||
|
||||
//nolint:dupl
|
||||
func fetchConffileContents(resolver file.Resolver, dbLocation file.Location, m pkg.DpkgDBEntry) (io.ReadCloser, *file.Location) {
|
||||
var reader io.ReadCloser
|
||||
var err error
|
||||
|
||||
@@ -230,7 +230,7 @@ func handleNewKeyValue(line string) (key string, val interface{}, err error) {
|
||||
if err != nil {
|
||||
return "", nil, fmt.Errorf("bad installed-size value=%q: %w", val, err)
|
||||
}
|
||||
return key, int(s), nil
|
||||
return key, int(s), nil //nolint:gosec
|
||||
default:
|
||||
return key, val, nil
|
||||
}
|
||||
|
||||
@@ -264,7 +264,6 @@ func (p *CatalogTester) TestCataloger(t *testing.T, cataloger pkg.Cataloger) {
|
||||
}
|
||||
}
|
||||
|
||||
// nolint:funlen
|
||||
func (p *CatalogTester) assertPkgs(t *testing.T, pkgs []pkg.Package, relationships []artifact.Relationship) {
|
||||
t.Helper()
|
||||
|
||||
|
||||
@@ -268,7 +268,7 @@ func newPE(filename string, r io.ReaderAt) (nativeImage, error) {
|
||||
}
|
||||
exportSymbolsOffset := uint64(exportSymbolsDataDirectory.VirtualAddress)
|
||||
exports := make([]byte, exportSymbolsDataDirectory.Size)
|
||||
_, err = r.ReadAt(exports, int64(exportSymbolsOffset))
|
||||
_, err = r.ReadAt(exports, int64(exportSymbolsOffset)) //nolint:gosec
|
||||
if err != nil {
|
||||
return fileError(filename, fmt.Errorf("could not read the exported symbols data directory: %w", err))
|
||||
}
|
||||
@@ -412,7 +412,7 @@ func (ni nativeImagePE) fetchExportAttribute(i int) (uint32, error) {
|
||||
func (ni nativeImagePE) fetchExportFunctionPointer(functionsBase uint32, i uint32) (uint32, error) {
|
||||
var pointer uint32
|
||||
|
||||
n := uint32(len(ni.exports))
|
||||
n := uint32(len(ni.exports)) //nolint:gosec
|
||||
sz := uint32(unsafe.Sizeof(ni.t.functionPointer))
|
||||
j := functionsBase + i*sz
|
||||
if j+sz >= n {
|
||||
@@ -457,7 +457,7 @@ func (ni nativeImagePE) fetchSbomSymbols(content *exportContentPE) {
|
||||
sbomBytes := []byte(nativeImageSbomSymbol + "\x00")
|
||||
sbomLengthBytes := []byte(nativeImageSbomLengthSymbol + "\x00")
|
||||
svmVersionInfoBytes := []byte(nativeImageSbomVersionSymbol + "\x00")
|
||||
n := uint32(len(ni.exports))
|
||||
n := uint32(len(ni.exports)) //nolint:gosec
|
||||
|
||||
// Find SBOM, SBOM Length, and SVM Version Symbol
|
||||
for i := uint32(0); i < content.numberOfNames; i++ {
|
||||
|
||||
@@ -342,7 +342,7 @@ func (r *mavenResolver) findPomInRemoteRepository(ctx context.Context, groupID,
|
||||
Timeout: r.remoteRequestTimeout,
|
||||
}
|
||||
|
||||
resp, err := client.Do(req) //nolint:bodyclose
|
||||
resp, err := client.Do(req)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("unable to get pom from Maven repository %v: %w", requestURL, err)
|
||||
}
|
||||
|
||||
@@ -60,10 +60,10 @@ func readStruct(metadata any, fields ...string) string {
|
||||
if len(fields) > 0 {
|
||||
value, ok := metadata.(map[any]any)
|
||||
if !ok {
|
||||
log.Tracef("unable to read '%s' from: %v", fields[0], metadata)
|
||||
log.Tracef("unable to read '%s' from: %v", fields[0], metadata) //nolint:gosec
|
||||
return ""
|
||||
}
|
||||
return readStruct(value[fields[0]], fields[1:]...)
|
||||
return readStruct(value[fields[0]], fields[1:]...) //nolint:gosec
|
||||
}
|
||||
value, ok := metadata.(string)
|
||||
if !ok {
|
||||
|
||||
@@ -88,12 +88,12 @@ func mapFiles(files []rpmutils.FileInfo, digestAlgorithm string) []pkg.RpmFileRe
|
||||
}
|
||||
out = append(out, pkg.RpmFileRecord{
|
||||
Path: f.Name(),
|
||||
Mode: pkg.RpmFileMode(f.Mode()),
|
||||
Mode: pkg.RpmFileMode(f.Mode()), //nolint:gosec
|
||||
Size: int(f.Size()),
|
||||
Digest: digest,
|
||||
UserName: f.UserName(),
|
||||
GroupName: f.GroupName(),
|
||||
Flags: rpmdb.FileFlags(f.Flags()).String(),
|
||||
Flags: rpmdb.FileFlags(f.Flags()).String(), //nolint:gosec
|
||||
})
|
||||
}
|
||||
return out
|
||||
|
||||
@@ -17,7 +17,8 @@ import (
|
||||
)
|
||||
|
||||
// parseRpmDb parses an "Packages" RPM DB and returns the Packages listed within it.
|
||||
// nolint:funlen
|
||||
//
|
||||
//nolint:funlen
|
||||
func parseRpmDB(_ context.Context, resolver file.Resolver, env *generic.Environment, reader file.LocationReadCloser) ([]pkg.Package, []artifact.Relationship, error) {
|
||||
f, err := os.CreateTemp("", "rpmdb")
|
||||
if err != nil {
|
||||
|
||||
@@ -29,7 +29,6 @@ func newPackagesFromAudit(location file.Location, versionInfo rustaudit.VersionI
|
||||
var pkgs []pkg.Package
|
||||
|
||||
for _, dep := range versionInfo.Packages {
|
||||
dep := dep
|
||||
p := newPackageFromAudit(&dep, location.WithAnnotation(pkg.EvidenceAnnotationKey, pkg.PrimaryEvidenceAnnotation))
|
||||
if pkg.IsValid(&p) && dep.Kind == rustaudit.Runtime {
|
||||
pkgs = append(pkgs, p)
|
||||
|
||||
Reference in New Issue
Block a user