-
Notifications
You must be signed in to change notification settings - Fork 73
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 SARIF as a reporter option #166
Conversation
Testing locally on my machine, this is the SARIF report that's generated. Please LMK if this is fine. Also please tell me if I need to add more tests. Lastly I am new to Go, so please forgive me if there are any obvious mistakes. {
"version": "2.1.0",
"$schema": "https://schemastore.azurewebsites.net/schemas/json/sarif-2.1.0-rtm.4.json",
"runs": [
{
"tool": {
"driver": {
"name": "config-file-validator",
"informationUri": "https://github.com/Boeing/config-file-validator/issues/32"
}
},
"artifacts": [
{
"location": {
"uri": "/home/shiina/projects/cfv-test/bad.csv"
}
},
{
"location": {
"uri": "/home/shiina/projects/cfv-test/bad.editorconfig"
}
},
{
"location": {
"uri": "/home/shiina/projects/cfv-test/bad.env"
}
},
{
"location": {
"uri": "/home/shiina/projects/cfv-test/bad.hcl"
}
},
{
"location": {
"uri": "/home/shiina/projects/cfv-test/bad.hocon"
}
},
{
"location": {
"uri": "/home/shiina/projects/cfv-test/bad.ini"
}
},
{
"location": {
"uri": "/home/shiina/projects/cfv-test/bad.json"
}
},
{
"location": {
"uri": "/home/shiina/projects/cfv-test/bad.plist"
}
},
{
"location": {
"uri": "/home/shiina/projects/cfv-test/bad.properties"
}
},
{
"location": {
"uri": "/home/shiina/projects/cfv-test/bad.toml"
}
},
{
"location": {
"uri": "/home/shiina/projects/cfv-test/bad.yml"
}
},
{
"location": {
"uri": "/home/shiina/projects/cfv-test/good.csv"
}
},
{
"location": {
"uri": "/home/shiina/projects/cfv-test/good.editorconfig"
}
},
{
"location": {
"uri": "/home/shiina/projects/cfv-test/good.env"
}
},
{
"location": {
"uri": "/home/shiina/projects/cfv-test/good.hcl"
}
},
{
"location": {
"uri": "/home/shiina/projects/cfv-test/good.hocon"
}
},
{
"location": {
"uri": "/home/shiina/projects/cfv-test/good.ini"
}
},
{
"location": {
"uri": "/home/shiina/projects/cfv-test/good.json"
}
},
{
"location": {
"uri": "/home/shiina/projects/cfv-test/good.plist"
}
},
{
"location": {
"uri": "/home/shiina/projects/cfv-test/good.properties"
}
},
{
"location": {
"uri": "/home/shiina/projects/cfv-test/good.toml"
}
},
{
"location": {
"uri": "/home/shiina/projects/cfv-test/good.yaml"
}
},
{
"location": {
"uri": "/home/shiina/projects/cfv-test/result.xml"
}
}
],
"results": [
{
"kind": "fail",
"level": "error",
"message": {
"text": "parse error on line 1, column 20: bare \" in non-quoted-field"
},
"locations": [
{
"physicalLocation": {
"artifactLocation": {
"uri": "/home/shiina/projects/cfv-test/bad.csv",
"index": 0
}
}
}
]
},
{
"kind": "fail",
"level": "error",
"message": {
"text": "cannot load ini file: unclosed section: [*.md\n"
},
"locations": [
{
"physicalLocation": {
"artifactLocation": {
"uri": "/home/shiina/projects/cfv-test/bad.editorconfig",
"index": 1
}
}
}
]
},
{
"kind": "fail",
"level": "error",
"message": {
"text": "Error at line 2: invalid escape sequence: \"a\""
},
"locations": [
{
"physicalLocation": {
"artifactLocation": {
"uri": "/home/shiina/projects/cfv-test/bad.env",
"index": 2
}
}
}
]
},
{
"kind": "fail",
"level": "error",
"message": {
"text": "error at line 1 column 1: :1,1-2: Invalid argument name; Argument names must not be quoted."
},
"locations": [
{
"physicalLocation": {
"artifactLocation": {
"uri": "/home/shiina/projects/cfv-test/bad.hcl",
"index": 3
}
}
}
]
},
{
"kind": "fail",
"level": "error",
"message": {
"text": "two adjacent commas at: 3:16, adjacent commas in arrays and objects are invalid!"
},
"locations": [
{
"physicalLocation": {
"artifactLocation": {
"uri": "/home/shiina/projects/cfv-test/bad.hocon",
"index": 4
}
}
}
]
},
{
"kind": "fail",
"level": "error",
"message": {
"text": "key-value delimiter not found: name value\n"
},
"locations": [
{
"physicalLocation": {
"artifactLocation": {
"uri": "/home/shiina/projects/cfv-test/bad.ini",
"index": 5
}
}
}
]
},
{
"kind": "fail",
"level": "error",
"message": {
"text": "Error at line 3 column 14: invalid character ':' after array element"
},
"locations": [
{
"physicalLocation": {
"artifactLocation": {
"uri": "/home/shiina/projects/cfv-test/bad.json",
"index": 6
}
}
}
]
},
{
"kind": "fail",
"level": "error",
"message": {
"text": "plist: error parsing XML property list: missing value in dictionary"
},
"locations": [
{
"physicalLocation": {
"artifactLocation": {
"uri": "/home/shiina/projects/cfv-test/bad.plist",
"index": 7
}
}
}
]
},
{
"kind": "fail",
"level": "error",
"message": {
"text": "circular reference in:\nkey=${key}\n"
},
"locations": [
{
"physicalLocation": {
"artifactLocation": {
"uri": "/home/shiina/projects/cfv-test/bad.properties",
"index": 8
}
}
}
]
},
{
"kind": "fail",
"level": "error",
"message": {
"text": "Error at line 6 column 6: toml: expected character ="
},
"locations": [
{
"physicalLocation": {
"artifactLocation": {
"uri": "/home/shiina/projects/cfv-test/bad.toml",
"index": 9
}
}
}
]
},
{
"kind": "fail",
"level": "error",
"message": {
"text": "yaml: line 3: did not find expected '-' indicator"
},
"locations": [
{
"physicalLocation": {
"artifactLocation": {
"uri": "/home/shiina/projects/cfv-test/bad.yml",
"index": 10
}
}
}
]
},
{
"kind": "pass",
"level": "none",
"message": {
"text": "No errors detected"
},
"locations": [
{
"physicalLocation": {
"artifactLocation": {
"uri": "/home/shiina/projects/cfv-test/good.csv",
"index": 11
}
}
}
]
},
{
"kind": "pass",
"level": "none",
"message": {
"text": "No errors detected"
},
"locations": [
{
"physicalLocation": {
"artifactLocation": {
"uri": "/home/shiina/projects/cfv-test/good.editorconfig",
"index": 12
}
}
}
]
},
{
"kind": "pass",
"level": "none",
"message": {
"text": "No errors detected"
},
"locations": [
{
"physicalLocation": {
"artifactLocation": {
"uri": "/home/shiina/projects/cfv-test/good.env",
"index": 13
}
}
}
]
},
{
"kind": "pass",
"level": "none",
"message": {
"text": "No errors detected"
},
"locations": [
{
"physicalLocation": {
"artifactLocation": {
"uri": "/home/shiina/projects/cfv-test/good.hcl",
"index": 14
}
}
}
]
},
{
"kind": "pass",
"level": "none",
"message": {
"text": "No errors detected"
},
"locations": [
{
"physicalLocation": {
"artifactLocation": {
"uri": "/home/shiina/projects/cfv-test/good.hocon",
"index": 15
}
}
}
]
},
{
"kind": "pass",
"level": "none",
"message": {
"text": "No errors detected"
},
"locations": [
{
"physicalLocation": {
"artifactLocation": {
"uri": "/home/shiina/projects/cfv-test/good.ini",
"index": 16
}
}
}
]
},
{
"kind": "pass",
"level": "none",
"message": {
"text": "No errors detected"
},
"locations": [
{
"physicalLocation": {
"artifactLocation": {
"uri": "/home/shiina/projects/cfv-test/good.json",
"index": 17
}
}
}
]
},
{
"kind": "pass",
"level": "none",
"message": {
"text": "No errors detected"
},
"locations": [
{
"physicalLocation": {
"artifactLocation": {
"uri": "/home/shiina/projects/cfv-test/good.plist",
"index": 18
}
}
}
]
},
{
"kind": "pass",
"level": "none",
"message": {
"text": "No errors detected"
},
"locations": [
{
"physicalLocation": {
"artifactLocation": {
"uri": "/home/shiina/projects/cfv-test/good.properties",
"index": 19
}
}
}
]
},
{
"kind": "pass",
"level": "none",
"message": {
"text": "No errors detected"
},
"locations": [
{
"physicalLocation": {
"artifactLocation": {
"uri": "/home/shiina/projects/cfv-test/good.toml",
"index": 20
}
}
}
]
},
{
"kind": "pass",
"level": "none",
"message": {
"text": "No errors detected"
},
"locations": [
{
"physicalLocation": {
"artifactLocation": {
"uri": "/home/shiina/projects/cfv-test/good.yaml",
"index": 21
}
}
}
]
},
{
"kind": "pass",
"level": "none",
"message": {
"text": "No errors detected"
},
"locations": [
{
"physicalLocation": {
"artifactLocation": {
"uri": "/home/shiina/projects/cfv-test/result.xml",
"index": 22
}
}
}
]
}
]
}
]
} |
1567a6b
to
7bf8532
Compare
0087232
to
c8db06e
Compare
Hey, would appreciate it if someone reviewed the PR :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Sarif is showing as invalid. Please run it through the validator tool and fix the identified issues. If some of the findings are not applicable please explain.
Some changes I made:
The validation is still failing because the |
a707db3
to
dc1fa23
Compare
I think we can leave it blank for now and not pass that part of the validation. I'll write up a story for adding that in as we support schema validation |
cmd/validator/validator.go: Add option to select reporter type as SARIF. pkg/reporter/sarif_reporter.go: Create SARIF report. https://sarifweb.azurewebsites.net/
cmd/validator/validator_test.go: Test for --reporter=sarif flag. pkg/reporter/reporter_test.go: Test for SARIF report.
dc1fa23
to
2aa0c34
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM - thanks for the PR @shiina4119
Fixes #32