Skip to content

Commit

Permalink
support .sar for java ecosystem (#748)
Browse files Browse the repository at this point in the history
Signed-off-by: Weston Steimel <weston.steimel@gmail.com>
Signed-off-by: Christopher Phillips <christopher.phillips@anchore.com>
  • Loading branch information
westonsteimel authored and spiffcs committed Jan 24, 2022
1 parent bac7649 commit 9d50d12
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ A CLI tool and Go library for generating a Software Bill of Materials (SBOM) fro

## Features
- Catalog container images and filesystems to discover packages and libraries.
- Supports packages and libraries from various ecosystems (APK, DEB, RPM, Ruby Bundles, Python Wheel/Egg/requirements.txt, JavaScript NPM/Yarn, Java JAR/EAR/WAR, Jenkins plugins JPI/HPI, Go modules)
- Supports packages and libraries from various ecosystems (APK, DEB, RPM, Ruby Bundles, Python Wheel/Egg/requirements.txt, JavaScript NPM/Yarn, Java JAR/EAR/WAR/PAR/SAR, Jenkins plugins JPI/HPI, Go modules)
- Linux distribution identification (supports Alpine, BusyBox, CentOS/RedHat, Debian/Ubuntu flavored distributions)
- Supports Docker and OCI image formats
- Direct support for [Grype](https://github.com/anchore/grype), a fast and powerful vulnerability matcher.
Expand Down
2 changes: 1 addition & 1 deletion syft/pkg/cataloger/java/archive_filename.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ func (a archiveFilename) extension() string {

func (a archiveFilename) pkgType() pkg.Type {
switch strings.ToLower(a.extension()) {
case "jar", "war", "ear", "lpkg", "par":
case "jar", "war", "ear", "lpkg", "par", "sar":
return pkg.JavaPkg
case "jpi", "hpi":
return pkg.JenkinsPluginPkg
Expand Down
7 changes: 7 additions & 0 deletions syft/pkg/cataloger/java/archive_filename_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,13 @@ func TestExtractInfoFromJavaArchiveFilename(t *testing.T) {
name: "pkg-extra-field-maven",
ty: pkg.JavaPkg,
},
{
filename: "pkg-extra-field-maven-4.3.2-rc1.sar",
version: "4.3.2-rc1",
extension: "sar",
name: "pkg-extra-field-maven",
ty: pkg.JavaPkg,
},
{
filename: "/some/path/pkg-extra-field-maven-4.3.2-rc1.jpi",
version: "4.3.2-rc1",
Expand Down
1 change: 1 addition & 0 deletions syft/pkg/cataloger/java/archive_parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ var archiveFormatGlobs = []string{
"**/*.war",
"**/*.ear",
"**/*.par",
"**/*.sar",
"**/*.jpi",
"**/*.hpi",
"**/*.lpkg", // Zip-compressed package used to deploy applications
Expand Down
2 changes: 1 addition & 1 deletion syft/pkg/cataloger/java/cataloger.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Package java provides a concrete Cataloger implementation for Java archives (jar, war, ear, par, jpi, hpi formats).
Package java provides a concrete Cataloger implementation for Java archives (jar, war, ear, par, sar, jpi, hpi formats).
*/
package java

Expand Down

0 comments on commit 9d50d12

Please sign in to comment.