Skip to content

Commit

Permalink
πŸ› fix(sarif): update report to pass validator (#1167)
Browse files Browse the repository at this point in the history
* πŸ› fix(sarif): update report to pass validator

* βœ… test(sarif): update sarif report testdata
  • Loading branch information
DariuszPorowski committed Apr 28, 2023
1 parent 51ca0f8 commit 146f69e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
4 changes: 3 additions & 1 deletion report/sarif.go
Expand Up @@ -10,7 +10,7 @@ import (

func writeSarif(cfg config.Config, findings []Finding, w io.WriteCloser) error {
sarif := Sarif{
Schema: "https://schemastore.azurewebsites.net/schemas/json/sarif-2.1.0-rtm.5.json",
Schema: "https://json.schemastore.org/sarif-2.1.0.json",
Version: "2.1.0",
Runs: getRuns(cfg, findings),
}
Expand All @@ -34,6 +34,7 @@ func getTool(cfg config.Config) Tool {
Driver: Driver{
Name: driver,
SemanticVersion: version,
InformationUri: "https://github.com/gitleaks/gitleaks",
Rules: getRules(cfg),
},
}
Expand Down Expand Up @@ -164,6 +165,7 @@ type Rules struct {
type Driver struct {
Name string `json:"name"`
SemanticVersion string `json:"semanticVersion"`
InformationUri string `json:"informationUri"`
Rules []Rules `json:"rules"`
}

Expand Down
2 changes: 1 addition & 1 deletion testdata/baseline/baseline.sarif
@@ -1,5 +1,5 @@
{
"$schema": "https://schemastore.azurewebsites.net/schemas/json/sarif-2.1.0-rtm.5.json",
"$schema": "https://json.schemastore.org/sarif-2.1.0.json",
"version": "2.1.0",
"runs": [
]
Expand Down
3 changes: 2 additions & 1 deletion testdata/expected/report/sarif_simple.sarif
@@ -1,12 +1,13 @@
{
"$schema": "https://schemastore.azurewebsites.net/schemas/json/sarif-2.1.0-rtm.5.json",
"$schema": "https://json.schemastore.org/sarif-2.1.0.json",
"version": "2.1.0",
"runs": [
{
"tool": {
"driver": {
"name": "gitleaks",
"semanticVersion": "v8.0.0",
"informationUri": "https://github.com/gitleaks/gitleaks",
"rules": [
{
"id": "aws-access-key",
Expand Down

0 comments on commit 146f69e

Please sign in to comment.