Skip to content

Commit 8d8aa0c

Browse files
authored
Merge pull request #45 from grafana/p-zizmor/finding-location-context
periodic zizmor: add finding snippet and line/column location
2 parents 27ae2fd + 26ca286 commit 8d8aa0c

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

.github/workflows/periodic-zizmor.yaml

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,18 +118,27 @@ jobs:
118118
119119
results = []
120120
for result in sarif_data['runs'][0]['results']:
121+
location = result['locations'][0]
122+
physical_location = location['physicalLocation']
123+
region = physical_location['region']
124+
121125
item = {
122126
'repo': repo,
123127
'kind': result['kind'],
124128
'level': result['level'],
125129
'message': result['message']['text'],
126-
'annotation': result['locations'][0]['logicalLocations'][0]['properties']['symbolic']['annotation'],
127-
'path': result['locations'][0]['logicalLocations'][0]['properties']['symbolic']['key']['Local']['given_path']
130+
'annotation': location['logicalLocations'][0]['properties']['symbolic']['annotation'],
131+
'path': location['logicalLocations'][0]['properties']['symbolic']['key']['Local']['given_path'],
132+
'startLine': region['startLine'],
133+
'endLine': region['endLine'],
134+
'startColumn': region['startColumn'],
135+
'endColumn': region['endColumn'],
136+
'snippet': region['snippet']['text']
128137
}
129138
results.append(item)
130139
131140
for item in results:
132-
print(f"Periodic zizmor scan finding: repo={item['repo']}, kind={item['kind']}, level={item['level']}, message={item['message']}, annotation={item['annotation']}, path={item['path']}")
141+
print(f"Periodic zizmor scan finding: repo={item['repo']}, kind={item['kind']}, level={item['level']}, message={item['message']}, annotation={item['annotation']}, path={item['path']}, snippet={item['snippet']}, startLine={item['startLine']}, endLine={item['endLine']}, startColumn={item['startColumn']}, endColumn={item['endColumn']}")
133142
134143
- name: Upload SARIF results
135144
uses: actions/github-script@v7

0 commit comments

Comments
 (0)