mirror of
https://github.com/anchore/syft.git
synced 2025-11-17 16:33:21 +01:00
feat: rust toolchain binary cataloger (#1601)
Signed-off-by: Weston Steimel <weston.steimel@anchore.com>
This commit is contained in:
parent
bcc0751a40
commit
e92b0fa629
@ -439,6 +439,42 @@ func Test_Cataloger_DefaultClassifiers_PositiveCases(t *testing.T) {
|
|||||||
Metadata: metadata("java-binary-ibm", "java"),
|
Metadata: metadata("java-binary-ibm", "java"),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: "positive-rust-1.50.0-macos",
|
||||||
|
fixtureDir: "test-fixtures/classifiers/positive/rust-1.50.0",
|
||||||
|
expected: pkg.Package{
|
||||||
|
Name: "rust",
|
||||||
|
Version: "1.50.0",
|
||||||
|
Type: "binary",
|
||||||
|
PURL: "pkg:generic/rust@1.50.0",
|
||||||
|
Locations: locations("lib/rustlib/aarch64-apple-darwin/lib/libstd-f6f9eec1635e636a.dylib"),
|
||||||
|
Metadata: metadata("rust-standard-library-macos"),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "positive-rust-1.67.1-macos",
|
||||||
|
fixtureDir: "test-fixtures/classifiers/positive/rust-1.67.1/toolchains/stable-aarch64-apple-darwin",
|
||||||
|
expected: pkg.Package{
|
||||||
|
Name: "rust",
|
||||||
|
Version: "1.67.1",
|
||||||
|
Type: "binary",
|
||||||
|
PURL: "pkg:generic/rust@1.67.1",
|
||||||
|
Locations: locations("lib/libstd-16f2b65e77054c42.dylib"),
|
||||||
|
Metadata: metadata("rust-standard-library-macos"),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "positive-rust-1.67.1-linux",
|
||||||
|
fixtureDir: "test-fixtures/classifiers/positive/rust-1.67.1/toolchains/stable-x86_64-unknown-linux-musl",
|
||||||
|
expected: pkg.Package{
|
||||||
|
Name: "rust",
|
||||||
|
Version: "1.67.1",
|
||||||
|
Type: "binary",
|
||||||
|
PURL: "pkg:generic/rust@1.67.1",
|
||||||
|
Locations: locations("lib/libstd-86aefecbddda356d.so"),
|
||||||
|
Metadata: metadata("rust-standard-library-linux"),
|
||||||
|
},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, test := range tests {
|
for _, test := range tests {
|
||||||
|
|||||||
@ -207,4 +207,24 @@ var defaultClassifiers = []classifier{
|
|||||||
Package: "postgresql",
|
Package: "postgresql",
|
||||||
PURL: mustPURL("pkg:generic/postgresql@version"),
|
PURL: mustPURL("pkg:generic/postgresql@version"),
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
Class: "rust-standard-library-linux",
|
||||||
|
FileGlob: "**/libstd-????????????????.so",
|
||||||
|
EvidenceMatcher: fileContentsVersionMatcher(
|
||||||
|
// clang LLVM (rustc version 1.48.0 (7eac88abb 2020-11-16))
|
||||||
|
`(?m)(\x00)clang LLVM \(rustc version (?P<version>[0-9]+(\.[0-9]+)?(\.[0-9]+)) \(\w+ \d{4}\-\d{2}\-\d{2}\)`),
|
||||||
|
Package: "rust",
|
||||||
|
PURL: mustPURL("pkg:generic/rust@version"),
|
||||||
|
CPEs: singleCPE("cpe:2.3:a:rust-lang:rust:*:*:*:*:*:*:*:*"),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Class: "rust-standard-library-macos",
|
||||||
|
FileGlob: "**/libstd-????????????????.dylib",
|
||||||
|
EvidenceMatcher: fileContentsVersionMatcher(
|
||||||
|
// c 1.48.0 (7eac88abb 2020-11-16)
|
||||||
|
`(?m)c (?P<version>[0-9]+(\.[0-9]+)?(\.[0-9]+)) \(\w+ \d{4}\-\d{2}\-\d{2}\)`),
|
||||||
|
Package: "rust",
|
||||||
|
PURL: mustPURL("pkg:generic/rust@version"),
|
||||||
|
CPEs: singleCPE("cpe:2.3:a:rust-lang:rust:*:*:*:*:*:*:*:*"),
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user