Skip to content

Commit 903ee33

Browse files
zohayb23Zohayb Bhatti
andauthored
Use README.md as artifactURI for SARIF PhysicalLocation (#135)
GitHub Code Scanning requires PhysicalLocation in SARIF results. Using "README.md" as the artifactURI satisfies this requirement while keeping it simple for repository-level assessments. This aligns with the recommendation in gemara's ToSARIF documentation . Signed-off-by: Zohayb Bhatti <[email protected]> Co-authored-by: Zohayb Bhatti <[email protected]>
1 parent 899614c commit 903ee33

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

pluginkit/evaluation_orchestrator.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -218,10 +218,12 @@ func (v *EvaluationOrchestrator) WriteResults() error {
218218
result, err = yaml.Marshal(v)
219219
err = errMod(err, "wr20")
220220
case "sarif":
221-
// Use empty string for artifactURI - repository-level assessments don't have specific file paths
222-
// (empty string means no PhysicalLocation will be set in SARIF, avoiding URI scheme mismatch errors)
221+
// Use "README.md" as artifactURI for repository-level assessments
222+
// GitHub Code Scanning requires PhysicalLocation, and "README.md" is a common file path
223+
// that satisfies this requirement (as recommended in gemara's ToSARIF documentation)
224+
artifactURI := "README.md"
223225
for _, suite := range v.Evaluation_Suites {
224-
sarifBytes, sarifErr := suite.EvaluationLog.ToSARIF("")
226+
sarifBytes, sarifErr := suite.EvaluationLog.ToSARIF(artifactURI)
225227
if sarifErr != nil {
226228
err = errMod(sarifErr, "wr25")
227229
break

0 commit comments

Comments
 (0)