mirror of
https://github.com/anchore/syft
synced 2024-11-10 06:14:16 +00:00
Add support for nar files. (#1727)
- Update README.md to show that nar is now supported. - Created a java-archives/example.nar so that the tests wouldn't break. - Add nar glob and as an option for pkgType. Closes #1701 Signed-off-by: Shane Dell <shanedell100@gmail.com>
This commit is contained in:
parent
305838582b
commit
16ebcb2455
6 changed files with 12 additions and 2 deletions
|
@ -42,7 +42,7 @@ For commercial support options with Syft or Grype, please [contact Anchore](http
|
|||
- Erlang (rebar3)
|
||||
- Go (go.mod, Go binaries)
|
||||
- Haskell (cabal, stack)
|
||||
- Java (jar, ear, war, par, sar, native-image)
|
||||
- Java (jar, ear, war, par, sar, nar, native-image)
|
||||
- JavaScript (npm, yarn)
|
||||
- Jenkins Plugins (jpi, hpi)
|
||||
- Nix (outputs in /nix/store)
|
||||
|
|
|
@ -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":
|
||||
case "jar", "war", "ear", "lpkg", "par", "sar", "nar":
|
||||
return pkg.JavaPkg
|
||||
case "jpi", "hpi":
|
||||
return pkg.JenkinsPluginPkg
|
||||
|
|
|
@ -79,6 +79,13 @@ func TestExtractInfoFromJavaArchiveFilename(t *testing.T) {
|
|||
name: "pkg-extra-field-maven",
|
||||
ty: pkg.JavaPkg,
|
||||
},
|
||||
{
|
||||
filename: "pkg-extra-field-maven-4.3.2-rc1.nar",
|
||||
version: "4.3.2-rc1",
|
||||
extension: "nar",
|
||||
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",
|
||||
|
|
|
@ -24,6 +24,7 @@ var archiveFormatGlobs = []string{
|
|||
"**/*.ear",
|
||||
"**/*.par",
|
||||
"**/*.sar",
|
||||
"**/*.nar",
|
||||
"**/*.jpi",
|
||||
"**/*.hpi",
|
||||
"**/*.lpkg", // Zip-compressed package used to deploy applications
|
||||
|
|
|
@ -21,6 +21,7 @@ func Test_ArchiveCataloger_Globs(t *testing.T) {
|
|||
"java-archives/example.ear",
|
||||
"java-archives/example.par",
|
||||
"java-archives/example.sar",
|
||||
"java-archives/example.nar",
|
||||
"java-archives/example.jpi",
|
||||
"java-archives/example.hpi",
|
||||
"java-archives/example.lpkg",
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
example archive
|
Loading…
Reference in a new issue