Skip to content

Commit

Permalink
add timeout to input arguments (#19)
Browse files Browse the repository at this point in the history
* add timeout to input arguments

* remove unneeded workflows

---------

Co-authored-by: Michael Long <[email protected]>
  • Loading branch information
bluesentinelsec and Michael Long authored Apr 2, 2024
1 parent 19d8581 commit 09ab571
Show file tree
Hide file tree
Showing 11 changed files with 15 additions and 252 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/container_local.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ jobs:
- name: Fail if vulnerability threshold is exceeded
run: exit ${{ steps.inspector.outputs.vulnerability_threshold_exceeded }}
run: echo ${{ steps.inspector.outputs.vulnerability_threshold_exceeded }}

- name: Upload image to registry
run: echo docker push
48 changes: 0 additions & 48 deletions .github/workflows/container_tarball.yml

This file was deleted.

56 changes: 0 additions & 56 deletions .github/workflows/fail_on_threshold_exceeded.yml

This file was deleted.

41 changes: 0 additions & 41 deletions .github/workflows/job_summary.yml

This file was deleted.

3 changes: 0 additions & 3 deletions .github/workflows/repository.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@ jobs:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}

- name: Unzip test data
run: unzip testData.zip

- name: Scan artifact with Inspector
uses: ./ # Uses an action in the root directory
id: inspector
Expand Down
52 changes: 0 additions & 52 deletions .github/workflows/scan_dpkg.yml

This file was deleted.

48 changes: 0 additions & 48 deletions .github/workflows/zip_archive.yml

This file was deleted.

1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ See [action.yml](./action.yml) for more detail.
| scanners | No | Specifies the file scanners that you would like inspector-sbomgen to execute. By default, inspector-sbomgen will try to run all file scanners that are applicable to the target artifact. If this argument is set, inspector-sbomgen will only execute the specified file scanners. Provide your input as a single string. Separate each file scanner with a comma. To view a list of available file scanners, execute `inspector-sbomgen list-scanners`. [See here for more info](https://docs.aws.amazon.com/inspector/latest/user/sbom-generator.html). |
| skip_scanners | No | Specifies a list of file scanners that should NOT be executed; this argument cannot be combined with 'scanners'. If this argument is set, inspector-sbomgen will execute all file scanners except those you specified. Provide your input as a single string. Separate each file scanner with a comma. To view a list of available file scanners, execute `inspector-sbomgen list-scanners`. See [here for more info](https://docs.aws.amazon.com/inspector/latest/user/sbom-generator.html). |
| skip_files | No | Specifies one or more files and/or directories that should NOT be inventoried. Separate each file with a comma and enclose the entire string in double quotes. |
| timeout | No | Specifies a timeout in seconds. If this timeout is exceeded, the action will gracefully conclude and present any findings discovered up to that point. |

## Action Outputs

Expand Down
6 changes: 6 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,11 @@ inputs:
# Example:
# skip_files: "./media,/tmp/foo/,/bar/my_program"

timeout:
description: "Specifies a timeout in seconds. If this timeout is exceeded, the action will gracefully conclude and present any findings discovered up to that point."
required: False
default: 600 # 10 minutes

outputs:
artifact_sbom:
description: "The filepath to the artifact SBOM."
Expand Down Expand Up @@ -112,3 +117,4 @@ runs:
- --scanners=${{ inputs.scanners }}
- --skip-scanners=${{ inputs.skip_scanners }}
- --skip-files=${{ inputs.skip_files }}
- --timeout=${{ inputs.timeout }}
7 changes: 5 additions & 2 deletions entrypoint/entrypoint/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ def init(sys_argv=None) -> argparse.Namespace:
help='The artifact you would like to scan with Amazon Inspector. Valid choices are "repository", "container", "binary", or "archive".')
parser.add_argument("--artifact-path", type=str, default="./",
help='The path to the artifact you would like to scan with Amazon Inspector. If scanning a container image, you must provide a value that follows the docker pull convention: "NAME[:TAG|@DIGEST]", for example, "alpine:latest", or a path to an image exported as tarball using "docker save".')
parser.add_argument("--out-sbom", type=str, default="/tmp/sbom.json", help="The destination file path for the generated SBOM.")
parser.add_argument("--out-scan", type=str, default="/tmp/scan.json",
parser.add_argument("--out-sbom", type=str, default="sbom.json",
help="The destination file path for the generated SBOM.")
parser.add_argument("--out-scan", type=str, default="inspector-scan.json",
help="The destination file path for Inspector's vulnerability scan in JSON format.")
parser.add_argument("--out-scan-csv", type=str, default="/tmp/scan.csv",
help="The destination file path for Inspector's vulnerability scan in CSV format.")
Expand All @@ -39,6 +40,8 @@ def init(sys_argv=None) -> argparse.Namespace:
help="Specifies the file scanner types you do NOT wish to execute.")
parser.add_argument("--skip-files", type=str, default="''",
help="Specifies one or more files and/or directories that should NOT be inventoried.")
parser.add_argument("--timeout", type=str, default="600",
help="The amount of time in seconds that inspector-sbomgne will run. When this timeout is exceeded, sbomgen will gracefully conclude and present any findings discovered up to that point.")

args = ""
if sys_argv:
Expand Down
3 changes: 2 additions & 1 deletion entrypoint/entrypoint/orchestrator.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,8 @@ def invoke_sbomgen(args) -> int:
sbomgen_args = [args.artifact_type,
path_arg, args.artifact_path,
"--outfile", args.out_sbom,
"--disable-progress-bar"
"--disable-progress-bar",
"--timeout", args.timeout,
]
if args.scanners != "''":
logging.info(f"setting --scanners: {args.scanners}")
Expand Down

0 comments on commit 09ab571

Please sign in to comment.