Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

support .kar files #3113

Merged
merged 4 commits into from
Aug 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -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
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 @@ -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",
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 @@ -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.
Expand Down
1 change: 1 addition & 0 deletions syft/pkg/cataloger/java/cataloger_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
example archive
Loading