aquasecurity / chain-bench

An open-source tool for auditing your software supply chain stack for security compliance based on a new CIS Software Supply Chain benchmark.
Apache License 2.0
715 stars 62 forks source link

Indent JSON #42

Closed rgreinho closed 2 years ago

rgreinho commented 2 years ago

Updates the helper function serializing the data to automatically indent the file with 2 spaces.

rgreinho commented 2 years ago

Before:

[
{
"ID": "1.1.3",
"Name": "Ensure any change to code receives approval of two strongly authenticated users",
"Descrition": "Ensure that every code change is reviewed and approved by two authorized contributors who are strongly authenticated.",
"Remediation": "An organization can protect specific code branches β€” for example, the \"main\" branch which often is the version deployed to production β€” by setting protection rules. These rules secure your code repository from unwanted or unauthorized changes. You may set requirements for any code change to that branch, and thus specify a minimum number of reviewers required to approve a change.",
"Result": "Failed",
"Reason": "",
"Url": "https://avd.aquasec.com/compliance/softwaresupplychain/cis-1.0/cis-1.0-sourcecode/1.1"
}
]

After:

[
  {
    "ID": "1.1.3",
    "Name": "Ensure any change to code receives approval of two strongly authenticated users",
    "Descrition": "Ensure that every code change is reviewed and approved by two authorized contributors who are strongly authenticated.",
    "Remediation": "An organization can protect specific code branches β€” for example, the \"main\" branch which often is the version deployed to production β€” by setting protection rules. These rules secure your code repository from unwanted or unauthorized changes. You may set requirements for any code change to that branch, and thus specify a minimum number of reviewers required to approve a change.",
    "Result": "Failed",
    "Reason": "",
    "Url": "https://avd.aquasec.com/compliance/softwaresupplychain/cis-1.0/cis-1.0-sourcecode/1.1"
  }
]
rgreinho commented 2 years ago

Side comment, while re-reading the issue, I saw a typo in the struct: "Descrition" -> "Description".

Ref: https://github.com/aquasecurity/chain-bench/blob/main/internal/printer/helpers.go#L25=

naortalmor1 commented 2 years ago

Hi, @rgreinho please make sure you branch is updated and then we'll mergeπŸ™πŸ½