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

Add JSON output format as non-default output option via new --format parameter #82

Merged
merged 17 commits into from
Jun 26, 2024

Conversation

scrthq
Copy link
Contributor

@scrthq scrthq commented May 6, 2024

Issue #, if available: #50

Description of changes:

  • Adds --format parameter to ash/ash-multi scripts to enable additional output integrations, beginning with ASHARP (Automated Security Helper Aggregated Report Parser) as the intermediary data model to enable subsequent conversion from there.
  • Adds automated_security_helper Python code as a module of the same name from within new src directory, including poetry.lock and pyproject.toml files to support. This module includes the asharp script (CLI tool) that enabled programmatic parsing of the aggregated_results content in conjunction with the JSON output changes.
  • Adds pre-stage build of automated_security_helper module to Dockerfile
  • Adds support to handle when --format is a value other than the current default of text so scanners switch output to programmatically parseable output formats and asharp is called to parse the aggregated_results.txt file into aggregated_results.txt.json.
  • Moved source of version string truth into pyproject.toml for all projects, removed __version__ file to coincide with this.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@scrthq scrthq self-assigned this May 6, 2024
Copy link

github-actions bot commented May 6, 2024

ASH Scan Output - amd64 - ubuntu-latest

$ cat ash_stdout.txt

Resolved OCI_RUNNER to: /usr/bin/docker
Building image automated-security-helper:local -- this may take a few minutes during the first build...
Running ASH scan using built image...
Show aggregated_results.txt

@scrthq scrthq changed the title fix(ash): adjust where/when output-dir is created, if necessary (#74) feat(#50,output): Add --format flag to ash to allow passing in desired output format May 6, 2024
@scrthq scrthq marked this pull request as draft May 6, 2024 19:45
… where needed, and version_check method to be more clear
@scrthq scrthq changed the title feat(#50,output): Add --format flag to ash to allow passing in desired output format Add JSON output format as non-default output option via new --format parameter Jun 8, 2024
@scrthq scrthq marked this pull request as ready for review June 8, 2024 20:43
Copy link
Contributor

@climbertjh2 climbertjh2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't do a deep review of asharp.py. Cursory look - it looks OK.

Minor comments in other places.

Dockerfile Show resolved Hide resolved
Dockerfile Show resolved Hide resolved
ash-multi Outdated Show resolved Hide resolved
asharp/asharp.py Outdated Show resolved Hide resolved
asharp/asharp.py Outdated Show resolved Hide resolved
pyproject.toml Show resolved Hide resolved
@scrthq scrthq requested a review from climbertjh2 June 24, 2024 19:30
utils/yaml-docker-execute.sh Outdated Show resolved Hide resolved
utils/yaml-docker-execute.sh Show resolved Hide resolved
ash-multi Show resolved Hide resolved
ash-multi Show resolved Hide resolved
Copy link
Contributor

@climbertjh2 climbertjh2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The updates look good to me - let's get this into main.

@climbertjh2 climbertjh2 self-requested a review June 25, 2024 16:08
Copy link
Contributor

@climbertjh2 climbertjh2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok as written for now.

@scrthq scrthq merged commit dc5c7bb into main Jun 26, 2024
3 checks passed
@scrthq scrthq deleted the feat/50/output-flag branch June 26, 2024 19:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feat(results): add flag to output machine-readable formats from underlying tools where possible
3 participants