Skip to content

Commit

Permalink
feat: ast 40209 added validation status to sarif report (#238)
Browse files Browse the repository at this point in the history
**Proposed Changes**

Added the property bag to Sarif Results ("properties"), in accordance
with SARIF guidelines.
Added validationStatus to properties of each result in SARIF, in line
with what already happens in JSON.

<!--
Please describe the big picture of your changes here. If it fixes a bug
or resolves a feature request, be sure to link to that issue.
-->

**Checklist**

- [ ] I covered my changes with tests (not applicable).
- [ ] I Updated the documentation that is affected by my changes (not
applicable):
  - [ ] Change in the CLI arguments
  - [ ] Change in the configuration file

I submit this contribution under the Apache-2.0 license.
  • Loading branch information
diogo-fjrocha committed Apr 22, 2024
1 parent f30907f commit e2925c9
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions lib/reporting/sarif.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ func getResults(report Report) []Results {
},
RuleId: secret.RuleID,
Locations: getLocation(secret),
Properties: Properties{
"validationStatus": secret.ValidationStatus,
},
}
results = append(results, r)
}
Expand Down Expand Up @@ -144,12 +147,15 @@ type Locations struct {
}

type Results struct {
Message Message `json:"message"`
RuleId string `json:"ruleId"`
Locations []Locations `json:"locations"`
Message Message `json:"message"`
RuleId string `json:"ruleId"`
Locations []Locations `json:"locations"`
Properties Properties `json:"properties,omitempty"`
}

type Runs struct {
Tool Tool `json:"tool"`
Results []Results `json:"results"`
}

type Properties map[string]interface{}

0 comments on commit e2925c9

Please sign in to comment.