1199 Commits

Author SHA1 Message Date
William Murphy
b2ca5fbf89
fix Windows file paths in local go mod cache (#2654)
Previously, the file resolver was created from incorrect calls
(path.Join instead of filepath.Join) which resulted Go license searches
always missing on Windows. Use filepath.* functions when initializing
the Go config, and when the unindexed file resolver is being created.

Signed-off-by: Will Murphy <will.murphy@anchore.com>
2024-05-09 13:08:58 -04:00
Alex Goodman
ada8f009d2
Add relationships for ALPM packages (arch linux) (#2851)
* add alpm relationships

Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>

* tweak reader linter rule to check for reader impl

Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>

* update JSON schema with alpm dependency information

Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>

---------

Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>
2024-05-07 13:29:46 -04:00
Laurent Goderre
e7b6284039
Add binary classifier for ArangoDB (#2830)
Signed-off-by: Laurent Goderre <laurent.goderre@docker.com>
2024-05-07 12:06:32 -04:00
William Murphy
3713d97b7b
chore: use ruleguard to test for missing defer statements (#2837)
* chore: ruleguard to enforce defer use

Signed-off-by: Will Murphy <will.murphy@anchore.com>

* fix go.mod location

Signed-off-by: Will Murphy <will.murphy@anchore.com>

* chore: defer close in linux release identifier

Signed-off-by: Will Murphy <will.murphy@anchore.com>

* chore: better lint suggestion

Signed-off-by: Will Murphy <will.murphy@anchore.com>

* chore: refactor binary classifier to defer close

Signed-off-by: Will Murphy <will.murphy@anchore.com>

* chore: defer close readers in gentoo cataloger

Signed-off-by: Will Murphy <will.murphy@anchore.com>

* chore: make go license parsing defer close readers

Signed-off-by: Will Murphy <will.murphy@anchore.com>

* chore: defer closing readers in alpine apm parser

Signed-off-by: Will Murphy <will.murphy@anchore.com>

* chore: defer close readers in graalvm parser

Signed-off-by: Will Murphy <will.murphy@anchore.com>

* chore: defer close readers in debian package parser

Signed-off-by: Will Murphy <will.murphy@anchore.com>

* chore: defer close readers in alpm parser

Signed-off-by: Will Murphy <will.murphy@anchore.com>

* chore: defer close readers in executable file cataloger

Signed-off-by: Will Murphy <will.murphy@anchore.com>

* chore: defer close readers in javascript license parser

Signed-off-by: Will Murphy <will.murphy@anchore.com>

* chore: defer close readers in go mod parser

Signed-off-by: Will Murphy <will.murphy@anchore.com>

---------

Signed-off-by: Will Murphy <will.murphy@anchore.com>
2024-05-07 05:42:29 -04:00
Laurent Goderre
5ca26ed3ca
fix: Add missing CPE for traefik, memcached, and postgres binaries (#2845)
Signed-off-by: Laurent Goderre <laurent.goderre@docker.com>
2024-05-06 15:06:30 -04:00
Laurent Goderre
e353214ef8
Add detection for newer version of ErLang/OTP (#2829)
Signed-off-by: Laurent Goderre <laurent.goderre@docker.com>
2024-05-06 11:47:54 -04:00
Alex Goodman
a56eff90d6
fix ui race for package count (#2839)
Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>
2024-05-06 11:45:52 -04:00
anchore-actions-token-generator[bot]
00ff3ffda9
chore(deps): update CPE dictionary index (#2841)
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: wagoodman <590471+wagoodman@users.noreply.github.com>
2024-05-06 11:44:19 -04:00
camcui
80d196a8c9
chore: fix function name in comment (#2771)
Signed-off-by: camcui <cuishua@sina.cn>
Co-authored-by: Christopher Phillips <christopher.phillips@anchore.com>
2024-05-01 18:04:02 +00:00
William Murphy
93a7d2ee27
fix: better clean up of file handles (#2823)
* always close ELF cataloger file handles

The elf-binary-package-cataloger does its own file IO to account for the
possibility of a logical ELF package being broken across multiple
physical files. However, this casued it to skip the normal invocation
pattern in the generic cataloger code that prevented file leaks. Ensure
this cataloger always closes its file handles.

Signed-off-by: Will Murphy <will.murphy@anchore.com>

* defer closing of generic cataloger file handles

Otherwise, a panicking cataloger could leak file handles.

Signed-off-by: Will Murphy <will.murphy@anchore.com>

* add unit test for file closed on panic parser

Signed-off-by: Will Murphy <will.murphy@anchore.com>

* make invoke parser a static function

Signed-off-by: Will Murphy <will.murphy@anchore.com>

* push error logging down into invoke parser

Signed-off-by: Will Murphy <will.murphy@anchore.com>

---------

Signed-off-by: Will Murphy <will.murphy@anchore.com>
2024-05-01 12:58:17 -04:00
Keith Zantow
b0c88ddea9
fix(spdx): include required fields (#2168)
* fix(spdx): include required fields

Signed-off-by: Keith Zantow <kzantow@gmail.com>

* chore: missed update due to refactoring

Signed-off-by: Keith Zantow <kzantow@gmail.com>

* chore: update tools-golang

Signed-off-by: Keith Zantow <kzantow@gmail.com>

* chore: add test with packageVerificationCode included and excluded

Signed-off-by: Keith Zantow <kzantow@gmail.com>

---------

Signed-off-by: Keith Zantow <kzantow@gmail.com>
2024-04-30 13:28:42 -04:00
Keith Zantow
047e31a969
fix: add correct vendor for dnsmasq CPE (#2659)
Signed-off-by: Keith Zantow <kzantow@gmail.com>
2024-04-30 13:24:01 -04:00
guangwu
25b55e1704
fix: close temp rpmdb file (#2792)
* fix: close temp rpmdb file and db

Signed-off-by: guoguangwu <guoguangwug@gmail.com>

* chore: fix linter

Signed-off-by: Christopher Phillips <christopher.phillips@anchore.com>

---------

Signed-off-by: guoguangwu <guoguangwug@gmail.com>
Signed-off-by: Christopher Phillips <christopher.phillips@anchore.com>
Co-authored-by: Christopher Phillips <christopher.phillips@anchore.com>
2024-04-30 12:47:17 -04:00
Alex Goodman
5b03788300
Fill in SPDX originator for all supported package types (#2822)
* add failing test + beef up doc comments

Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>

* cover more metadata types in spdx originator processing

Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>

---------

Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>
2024-04-29 16:33:00 -04:00
William Murphy
d3310a1830
fix: re-use embedded union reader if possible (#2814)
* fix: re-use embedded union reader if possible

Previously, because file.LocationReadCloser embeds a ReadCloser that
might be a UnionReader, but doesn't implement the interface itself, the
type assertion would fall and Syft would fall back to io.ReadAll to
enable seeking on the underlying reader, resulting in a potentially
large extra allocation.

Instead, check whether the passed ReadCloser is a
file.LocationReadCloser, and if so, try to use the embedded ReadCloser
as a UnionReader.

Signed-off-by: Will Murphy <will.murphy@anchore.com>

* lint fix

Signed-off-by: Will Murphy <will.murphy@anchore.com>

* Assert that underlying reader is returned

Signed-off-by: Will Murphy <will.murphy@anchore.com>

---------

Signed-off-by: Will Murphy <will.murphy@anchore.com>
2024-04-26 10:21:38 -04:00
Weston Steimel
8640f978ba
feat: index known CPEs for go modules (#2816)
Signed-off-by: Weston Steimel <commits@weston.slmail.me>
2024-04-26 09:55:05 -04:00
Weston Steimel
9604e3dc9c
feat: support multiple known CPEs in index (#2813)
It is possible that a given package has multiple known "official" CPEs
active in the dictionary at once, so the index should support a slice of
CPE strings per package

Signed-off-by: Weston Steimel <commits@weston.slmail.me>
2024-04-25 15:22:26 +01:00
William Murphy
f154bf570d
Display which provider caused which error in output (#2757)
* Display which provider caused which error in output

Otherwise, the output is very difficult to parse.

Signed-off-by: Will Murphy <will.murphy@anchore.com>

* lint fix

Signed-off-by: Will Murphy <will.murphy@anchore.com>

* bump stereoscope to v0.0.2

Signed-off-by: Will Murphy <will.murphy@anchore.com>

---------

Signed-off-by: Will Murphy <will.murphy@anchore.com>
2024-04-23 14:27:39 -04:00
Weston Steimel
99b58db497
fix: prefer non-deprecated CPEs and include jenkins plugins from plugins.jenkins.io (#2806)
Improves the logic for adding known CPEs for Jenkins plugins by
including `plugins.jenkins.io` and prefers non-deprecated CPEs

Signed-off-by: Weston Steimel <commits@weston.slmail.me>
2024-04-23 11:11:47 -04:00
Weston Steimel
8d960e62c6
feat: index known CPEs for PHP Composer packagist.org packages (#2804)
Indexes known CPEs from `packagist.org`

Signed-off-by: Weston Steimel <commits@weston.slmail.me>
2024-04-23 10:42:59 -04:00
Weston Steimel
891e61a2ef
fix: improvements to known CPE index construction (#2801)
* fix: stop pre-filtering potential known CPE URLs

Previously when building the known CPE index, there was logic to
de-duplicate processing based on the normalized CPE name; however, this
means a significant number of known CPE's don't get indexed because the
first instance of that name didn't have a supported collection url but a
later one did.  This isn't code that executes at runtime in syft so
de-duplicating the processing for performance isn't really necessary
here and it doesn't add much to the total runtime anyways

Signed-off-by: Weston Steimel <commits@weston.slmail.me>

* fix: CPE index builder should extract and consider all reference urls

Previously the struct definition for CpeItem caused only the last URL
reference in the list to be kept and processed for inclusion in the
index

Signed-off-by: Weston Steimel <commits@weston.slmail.me>

---------

Signed-off-by: Weston Steimel <commits@weston.slmail.me>
2024-04-23 09:28:18 -04:00
Keith Zantow
f7d3d552ce
fix: exclude known instrumentation jars from being erroneously identified (#2796)
Signed-off-by: Keith Zantow <kzantow@gmail.com>
2024-04-22 15:03:17 -04:00
Weston Steimel
12ea9912b4
feat: index known cpes for PHP extensions (#2777)
Indexes known CPEs from `pecl.php.net` and `pear.php.net`

Signed-off-by: Weston Steimel <commits@weston.slmail.me>
2024-04-22 13:43:19 -04:00
William Murphy
6440f26b5a
fix: return empty string if dereferncing pom var fails (#2797)
Previously, Syft would attempt to dereference pom variables, but if it
detected a cycle or failed to get back to a non-variable value, it would
return the last variable. Instead, return an empty string. Otherwise,
certain jars will have versions like "${project.version}" in the SBOM,
which is not helpful.

Signed-off-by: Will Murphy <will.murphy@anchore.com>
2024-04-19 19:38:36 +00:00
guangwu
fe4819bc08
chore: cleanup redundant code (#2791)
Signed-off-by: guoguangwu <guoguangwug@gmail.com>
2024-04-19 12:12:48 -04:00
William Murphy
3e71f46fc8
Fix: repeatedly dereference pom variables (#2781)
* Fix: repeatedly dereference pom variables

Previously, if there was more than one layer of variable indirection in
the pom property (propert A says it has the same value as property B,
property B says it has the same value as property C), then Syft would
only dereference one layer. Add a loop to dereference variables until
either dereferencing fails, or until the variable is completely
dereferenced back to a literal.

Signed-off-by: Will Murphy <will.murphy@anchore.com>

* switch to recursive implementation

Signed-off-by: Will Murphy <will.murphy@anchore.com>

* add test cases for degenerate poms

Signed-off-by: Will Murphy <will.murphy@anchore.com>

* switch to recursive implementation

Signed-off-by: Will Murphy <will.murphy@anchore.com>

* remove redundant pieces of test cases

Signed-off-by: Will Murphy <will.murphy@anchore.com>

---------

Signed-off-by: Will Murphy <will.murphy@anchore.com>
2024-04-16 15:44:02 -04:00
anchore-actions-token-generator[bot]
25c2e60358
chore(deps): update CPE dictionary index (#2780)
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: westonsteimel <1593939+westonsteimel@users.noreply.github.com>
2024-04-15 11:15:38 -04:00
Keith Zantow
dde5d349b1
fix: more robust go main version extraction (#2767)
Signed-off-by: Keith Zantow <kzantow@gmail.com>
Signed-off-by: Will Murphy <will.murphy@anchore.com>
Co-authored-by: Will Murphy <will.murphy@anchore.com>
2024-04-11 11:58:51 -04:00
Laurent Goderre
c9aab4863b
fix: binary character in java version (#2766)
Signed-off-by: Laurent Goderre <laurent.goderre@docker.com>
Signed-off-by: Keith Zantow <kzantow@gmail.com>
Co-authored-by: Keith Zantow <kzantow@gmail.com>
2024-04-11 10:32:24 -04:00
Laurent Goderre
619ace65c3
Differentiate between JRE and JDK (#2748)
Signed-off-by: Laurent Goderre <laurent.goderre@docker.com>
2024-04-05 15:10:58 -04:00
Christopher Angelo Phillips
e100776f22
chore: update anchore/packageurl-go to use latest commits (#2746)
chore: update packageurl-go dependency to use latest commits
chore: go mod tidy
unit: update + -> %2B
---------
Signed-off-by: Christopher Phillips <christopher.phillips@anchore.com>
2024-04-04 10:33:51 -04:00
Laurent Goderre
e0233625cb
feat: cataloger for PHP Pecl and PEAR packages (#2604)
Signed-off-by: Laurent Goderre <laurent.goderre@docker.com>
2024-04-02 11:55:56 -04:00
Keith Zantow
01340b2a5c
fix: conan poco project cpe (#2740)
Signed-off-by: Keith Zantow <kzantow@gmail.com>
2024-03-28 16:56:24 -04:00
Keith Zantow
410867ca0c
fix: panic scanning binaries without symtab (#2739)
Signed-off-by: Keith Zantow <kzantow@gmail.com>
2024-03-27 13:51:45 -04:00
Colm O hEigeartaigh
f4e18961b9
Adding the ability to retrieve remote licenses from package.lock (#2708)
Signed-off-by: Colm O hEigeartaigh <coheigea@apache.org>
2024-03-21 13:20:04 -04:00
Laurent Goderre
cf17bd69b2
Add detection for Oracle GraalVM (#2705)
Signed-off-by: Laurent Goderre <laurent.goderre@docker.com>
Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>
Co-authored-by: Alex Goodman <wagoodman@users.noreply.github.com>
2024-03-14 15:40:07 +00:00
brian-ebarb
6a2517b5d2
Add ELF binary package cataloger (#2396)
* feat Adds Elf package catalogger

Signed-off-by: Brian Ebarb <ebarb.brian@gmail.com>

* Add test fixtures for elf package

Signed-off-by: Colleen Divers <colleen.divers@gmail.com>

* bump JSON schema to v16.0.6 + expand test fixtures

Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>

* less verbose logging

Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>

* remove dead test code

Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>

* remove unreleated swift change

Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>

---------

Signed-off-by: Brian Ebarb <ebarb.brian@gmail.com>
Signed-off-by: Colleen Divers <colleen.divers@gmail.com>
Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>
Co-authored-by: Colleen Divers <colleen.divers@gmail.com>
Co-authored-by: Alex Goodman <wagoodman@users.noreply.github.com>
2024-03-14 11:16:03 -04:00
Alex Goodman
47fc909700
Show binary exports, entrypoint, and imports (#2626)
show binary exports, entrypoint, and imports for macho, elf, and pe formats

Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>
2024-03-12 22:04:02 +00:00
guangwu
3743f5ae53
chore: reduce duplicate case SwiftPkg (#2696)
Signed-off-by: guoguangwu <guoguangwug@gmail.com>
2024-03-07 18:15:31 +00:00
guangwu
ebb9d4edb6
chore: remove deprecated os.SEEK_SET os.SEEK_CUR (#2693)
Signed-off-by: guoguangwu <guoguangwug@gmail.com>
2024-03-07 13:10:48 -05:00
Harm Weites
356f7c92b4
fix: match OpenSSL letter releases (#2682)
* chore: match openssl 1.1 letter releases

Signed-off-by: Harm Weites <harm@weites.com>

* chore: include image sha

Signed-off-by: Harm Weites <harm@weites.com>

---------

Signed-off-by: Harm Weites <harm@weites.com>
2024-02-29 14:39:23 +00:00
Alex Goodman
6377465440
Mark duplicated rows in table output (#2679)
* mark duplicated rows in table output

Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>

* fix unit test

Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>

---------

Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>
2024-02-29 09:33:00 -05:00
William Murphy
3ad91f2678
fix: trim path from deps.json in portable way (#2674)
* fix: trim path from deps.json in portable way

Previously, the path trimming regex would leave leading path separator
in place on Windows.

Probably a better long term fix is to a library path operation.

Signed-off-by: Will Murphy <will.murphy@anchore.com>
2024-02-29 09:31:55 -05:00
Alex Goodman
48e5672a87
Consider filesystem types for mount points when ignoring system paths (#2675)
* consider fs types for mount points when ignoring system paths

Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>

* address feedback

Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>

---------

Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>
2024-02-28 15:37:17 -05:00
William Murphy
63171b55dd
fix: stop emitting bus events on go mod events (#2673)
Previously, the TUI would hang when scanning directories with lots of go
packages, possibly because this path was spamming the TUI with too
many events. Since checking on a particular go module is fast, don't
show TUI events for each one.

Signed-off-by: Will Murphy <will.murphy@anchore.com>
2024-02-28 14:14:46 -05:00
Keith Zantow
a978966cad
feat: add --from flag, refactor source providers (#2610)
Signed-off-by: Keith Zantow <kzantow@gmail.com>
2024-02-27 16:44:37 -05:00
Alex Goodman
0c3b8ca4ed
rename binary classifier cataloger name (#2643)
Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>
2024-02-20 13:52:11 -05:00
Alex Goodman
a1b23bd57d
add syft version used to SBOM tool info by default (#2647)
Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>
2024-02-14 16:57:31 -05:00
Alex Goodman
65cadda486
Survive indexing dead symlinks (#2645)
* survive indexing branches that start with a bad symlink

Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>

* add log statement

Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>

---------

Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>
2024-02-14 21:06:22 +00:00
Alex Goodman
a909e3cec9
fix considering base path when ignoring known bad unix paths (#2644)
Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>
2024-02-14 15:57:38 -05:00