Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

feat: add triage input option #37

Merged
merged 2 commits into from
Aug 17, 2023
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
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ NOTE: To mention multiple directories, use comma as a separator and don't includ

**Optional** Valid SBOM formats are tag, json, yaml. (default: json)

### `triage_input_file`

**Optional** Provide input filename for triage data. The supported format is CycloneDX VEX. Find more information [here](https://github.com/intel/cve-bin-tool#providing-triage-input).

## Example usage

```yaml
Expand Down
4 changes: 4 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ inputs:
required: false
default: false
description: 'Split security alerts based on source file.'
triage_input_file:
required: false
description: 'Provide input filename for triage data.'
runs:
using: 'composite'
steps:
Expand Down Expand Up @@ -55,6 +58,7 @@ runs:
--sbom-type '${{ inputs.sbom_type }}'
--sbom-format '${{ inputs.sbom_format }}'
--alerts-based-on-file '${{inputs.alerts_based_on_file}}'
--triage-input-file '${{ inputs.triage_input_file }}'
shell: bash
- uses: actions/upload-artifact@v3
with:
Expand Down
4 changes: 4 additions & 0 deletions src/cve_bin_tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ def scan(
sbom_type=None,
sbom_format="json",
sbom_output="SBOM.json",
triage_input_file=None,
):
json_data = []
captured_output = ""
Expand Down Expand Up @@ -70,6 +71,9 @@ def scan(
command.append(sbom_format)
command.append("--sbom-output")
command.append(sbom_output)
if triage_input_file and Path(triage_input_file).exists():
command.append("--triage-input-file")
command.append(triage_input_file)
captured_output += subprocess.run(
command, capture_output=True, text=True
).stdout
Expand Down
6 changes: 6 additions & 0 deletions src/scanner.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,11 @@ def main():
help="Split security alerts based on source file.",
required=False,
)
parser.add_argument(
"--triage-input-file",
help="Provide input filename for triage data.",
required=False,
)

args = parser.parse_args()

Expand Down Expand Up @@ -104,6 +109,7 @@ def main():
sbom_type=args.sbom_type,
sbom_format=args.sbom_format,
sbom_output=f"{args.sbom_output}.{output_extension}",
triage_input_file=args.triage_input_file,
)

gen_sarif = GenerateSarif(
Expand Down