You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
echo "✅ SARIF file paths updated dynamically with prefix: ${SCAN_PATH}/"
77
-
78
-
# Show before/after comparison if backup exists
79
-
if [ "$CREATE_BACKUP" = "true" ] && [ -f "$BACKUP_FILE" ]; then
80
-
echo ""
81
-
echo "Before fix (first few file references):"
82
-
jq -r '.runs[]?.results[]?.locations[]?.physicalLocation?.artifactLocation?.uri?' "$BACKUP_FILE" 2>/dev/null | grep -v "^null$" | head -5 || echo "No file references found in original"
83
-
echo ""
84
-
echo "After fix (first few file references):"
85
-
jq -r '.runs[]?.results[]?.locations[]?.physicalLocation?.artifactLocation?.uri?' "$SARIF_FILE" 2>/dev/null | grep -v "^null$" | head -5 || echo "No file references found in fixed"
86
-
fi
87
-
88
-
echo ""
89
-
echo "✅ SARIF file paths have been fixed for GitHub Security tab compatibility"
90
-
else
91
-
echo "❌ SARIF file not found: $SARIF_FILE"
20
+
if [ ! -f "$SARIF_FILE" ]; then
21
+
echo "::error::SARIF file not found: $SARIF_FILE"
92
22
exit 1
93
-
fi
23
+
fi
24
+
25
+
echo "Fixing SARIF file paths with prefix: ${SCAN_PATH}/"
26
+
27
+
# Fix all URI paths in the SARIF file
28
+
jq --arg prefix "${SCAN_PATH}/" '
29
+
def fix_uri:
30
+
if . and (startswith($prefix) | not) and (. != "") then
0 commit comments