anchore / anchore/scan-action

Support template format

Open
#397 4 comments 4 reactions 0 assignees View on GitHub
good first issue
Dominant language
JavaScript
Stars
287
Forks
95
Avg merge
13h 23m
Merged PRs (30d)
13

Description

It would be helpful to support the template format. I would particularly like to be able to see the vulnerability location and CVE in the output. Locally I can achieve this with the following template:

```
"Package","Version Installed","Vulnerability ID","Severity","Locations"
{{- range .Matches}}
"{{.Artifact.Name}}","{{.Artifact.Version}}","{{.Vulnerability.ID}}","{{.Vulnerability.Severity}}","{{ (index .Artifact.Locations 0).RealPath }}"
{{- end}}
```

which, with `grype -o template -t ./csv.tmpl [IMAGE NAME]`, I can get an output like:

```csv
"Package","Version Installed","Vulnerability ID","Severity","Locations"
"apt","2.6.1","CVE-2011-3374","Negligible","/usr/share/doc/apt/copyright"
"binutils","2.40-2","CVE-2023-1972","Negligible","/usr/share/doc/binutils/copyright"
```

I'd be willing to create a PR if you are interested.

Contributor guide

Open the contributing guide

Research direction

Start by tracing how the action handles scan output options and whether it passes a template format and template path through to Grype, using the issue's `grype -o template -t ./csv.tmpl` example as the behavioral reference. Done means the action can accept and apply a template so vulnerability locations and CVE identifiers appear in its output, with validation added where the existing project structure requires it.

Written by the indexing model from the issue text.

Assessment

Tech stack
github-actions
Domain
ci-cd
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.