diff --git a/syft/pkg/cataloger/java/archive_filename.go b/syft/pkg/cataloger/java/archive_filename.go index 084371499d9..cc377e43874 100644 --- a/syft/pkg/cataloger/java/archive_filename.go +++ b/syft/pkg/cataloger/java/archive_filename.go @@ -108,7 +108,7 @@ func (a archiveFilename) extension() string { func (a archiveFilename) pkgType() pkg.Type { switch strings.ToLower(a.extension()) { - case "jar", "war", "ear", "lpkg", "par", "sar", "nar": + case "jar", "war", "ear", "lpkg", "par", "sar", "nar", "kar": return pkg.JavaPkg case "jpi", "hpi": return pkg.JenkinsPluginPkg diff --git a/syft/pkg/cataloger/java/archive_filename_test.go b/syft/pkg/cataloger/java/archive_filename_test.go index 5752e7d1ad3..98560491261 100644 --- a/syft/pkg/cataloger/java/archive_filename_test.go +++ b/syft/pkg/cataloger/java/archive_filename_test.go @@ -86,6 +86,13 @@ func TestExtractInfoFromJavaArchiveFilename(t *testing.T) { name: "pkg-extra-field-maven", ty: pkg.JavaPkg, }, + { + filename: "pkg-extra-field-maven-4.3.2-rc1.kar", + version: "4.3.2-rc1", + extension: "kar", + 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", diff --git a/syft/pkg/cataloger/java/archive_parser.go b/syft/pkg/cataloger/java/archive_parser.go index 663563c613d..1de3ab80abe 100644 --- a/syft/pkg/cataloger/java/archive_parser.go +++ b/syft/pkg/cataloger/java/archive_parser.go @@ -31,6 +31,7 @@ var archiveFormatGlobs = []string{ "**/*.nar", "**/*.jpi", "**/*.hpi", + "**/*.kar", "**/*.lpkg", // Zip-compressed package used to deploy applications // (aka plugins) to Liferay Portal server. Those files contains .JAR(s) and a .PROPERTIES file, the latter // has information about the application and installation requirements. diff --git a/syft/pkg/cataloger/java/cataloger_test.go b/syft/pkg/cataloger/java/cataloger_test.go index da524fc5ba3..84ba1ea91db 100644 --- a/syft/pkg/cataloger/java/cataloger_test.go +++ b/syft/pkg/cataloger/java/cataloger_test.go @@ -23,6 +23,7 @@ func Test_ArchiveCataloger_Globs(t *testing.T) { "java-archives/example.par", "java-archives/example.sar", "java-archives/example.nar", + "java-archives/example.kar", "java-archives/example.jpi", "java-archives/example.hpi", "java-archives/example.lpkg", diff --git a/syft/pkg/cataloger/java/test-fixtures/glob-paths/java-archives/example.kar b/syft/pkg/cataloger/java/test-fixtures/glob-paths/java-archives/example.kar new file mode 100644 index 00000000000..0b3d595db9f --- /dev/null +++ b/syft/pkg/cataloger/java/test-fixtures/glob-paths/java-archives/example.kar @@ -0,0 +1 @@ +example archive \ No newline at end of file