aquasecurity / aquasecurity/cloudsploit
SARIF output handler
- Dominant language
- JavaScript
- Stars
- 3.8k
- Forks
- 751
- Avg merge
- 11d 9h
- Merged PRs (30d)
- 3
Description
Currently there is an option to generate the output in JSON format that basically print the result array in this part of the [code](https://github.com/aquasecurity/cloudsploit/blob/master/postprocess/output.js#L127) when using the parameter **"--json=filename"**
Example:
```bash
node index.js --cloud aws --config ./config.js --json=outputput.json --console=none --plugin s3Encryption
```
Adding a new output handler using a new parameter **"--sarif=filename"** could allow to export the result using [SARIF format](https://github.com/oasis-tcs/sarif-spec/blob/main/Documents/CommitteeSpecifications/2.1.0/sarif-schema-2.1.0.json), this will allow to upload the result to any tool that support the specification.
In a high level the new parameter "--sarif=filename" could generate a SARIF file like this example
```json
{
"version": "2.1.0",
"$schema": "http://json.schemastore.org/sarif-2.1.0",
"runs": [
{
"tool": {
"driver": {
"name": "cloudsploit",
"version": "3.1.0",
"informationUri": "https://github.com/aquasecurity/cloudsploit"
}
},
"results": [
{
"level": "error",
"message": {
"text": "No bucket policy found; encryption not enforced"
},
"locations": [
{
"physicalLocation": {
"artifactLocation": {
"uri": "arn:aws:s3:::XXXXXX"
}
}
}
],
"ruleId": "S3-S3ENCRYPTION"
}
]
}
]
}
```
The command to generate that output could be like:
```bash
node index.js --cloud aws --config ./config.js --sarif=outputput.json --console=none --plugin s3Encryption
```
I already did a small poc creating a new output handler, is not really a big change in the code, it is just creating a new handler similar to the one that generate the JSON format but using the SARIF json structure.
I would like to help with this issue and send a PR if the cloudsploit team think that this feature could be usefull to other people that is currently using this tool.
Contributor guide
Research direction
Start with postprocess/output.js at line 127 and trace how index.js handles the existing --json=filename option. Compare that flow with the requested --sarif=filename command, then verify that the generated output follows the SARIF 2.1.0 structure and represents the s3Encryption result shown in the issue.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- cli
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100