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
@@ -28,8 +28,14 @@ Run each specific script according to the help for each script.
28
28
29
29
### List secret scanning alerts
30
30
31
+
This script retrieves secret scanning alerts from GitHub repositories, organizations, or Enterprises and outputs them in CSV or JSON format. It supports filtering by state, date, and push protection bypass status. Use this to audit, analyze, or export secret scanning data for compliance or security purposes.
Path to CA certificate bundle in PEM format (e.g. for self-signed server certificates)
68
+
--no-verify-tls Do not verify TLS connection certificates (warning: insecure)
69
+
--quiet, -q Suppress non-error log messages
53
70
--debug, -d Enable debug logging
54
71
```
55
72
56
73
### List code scanning alerts
57
74
75
+
This script retrieves code scanning alerts from GitHub repositories, organizations, or Enterprises and outputs them in CSV or JSON format. It supports filtering by state and date. Use this to audit, track, or export code scanning findings for reporting and analysis.
List code scanning alerts for a GitHub repository, organization or Enterprise.
62
83
@@ -70,19 +91,26 @@ options:
70
91
--state {open,resolved}, -s {open,resolved}
71
92
State of the alerts to query
72
93
--since SINCE, -S SINCE
73
-
Only show alerts created after this date/time - ISO 8601 format, e.g. 2024-10-08 or 2024-10-08T12:00; or Nd format, e.g. 7d for 7 days ago
94
+
Only show alerts created after this date/time - ISO 8601 format, e.g. 2024-10-08 or
95
+
2024-10-08T12:00; or Nd format, e.g. 7d for 7 days ago
74
96
--json Output in JSON format (otherwise CSV)
97
+
--raw, -r Output raw JSON data from the API
75
98
--quote-all, -q Quote all fields in CSV output
76
99
--hostname HOSTNAME GitHub Enterprise hostname (defaults to github.com)
77
100
--debug, -d Enable debug logging
78
101
```
79
102
80
103
### Replay code scanning alert status
81
104
105
+
This script replays or restores the status of code scanning alerts based on a previously exported CSV file. It's useful when alerts need to be re-dismissed after a repository is recreated or when migrating alert states between environments. The script reads from stdin and matches alerts by location.
Replay code scanning alert status for a GitHub repository, organization or Enterprise, based on a provide file of previous statuses.
112
+
Replay code scanning alert status for a GitHub repository, organization or Enterprise, based on a provide file of
113
+
previous statuses.
86
114
87
115
positional arguments:
88
116
name Name of the repo/org/Enterprise to query
@@ -94,7 +122,8 @@ options:
94
122
--state {open,resolved}, -s {open,resolved}
95
123
State of the alerts to query
96
124
--since SINCE, -S SINCE
97
-
Only show alerts created after this date/time - ISO 8601 format, e.g. 2024-10-08 or 2024-10-08T12:00; or Nd format, e.g. 7d for 7 days ago
125
+
Only show alerts created after this date/time - ISO 8601 format, e.g. 2024-10-08 or
126
+
2024-10-08T12:00; or Nd format, e.g. 7d for 7 days ago
98
127
--json Output in JSON format (otherwise CSV)
99
128
--quote-all, -q Quote all fields in CSV output
100
129
--hostname HOSTNAME GitHub Enterprise hostname (defaults to github.com)
@@ -103,11 +132,17 @@ options:
103
132
104
133
### Replay secret scanning alert status
105
134
135
+
This script replays or restores the status of secret scanning alerts based on a previously exported CSV file. It's particularly useful when a repository is deleted and recreated, allowing you to restore the previous resolution states of alerts. The script reads a CSV file from stdin with columns: repo, secret, secret_type, state, resolution, resolution_comment, url.
Replay secret scanning alert status for a GitHub repository, organization or Enterprise, based on a provided file of previous statuses. This can be useful if a repository is deleted and recreated, and you want to restore
110
-
the previous status of the alerts. This script reads a CSV file with a header from stdin, with the following columns: repo, secret, secret_type, state, resolution, resolution_comment, url
142
+
Replay secret scanning alert status for a GitHub repository, organization or Enterprise, based on a provided file of
143
+
previous statuses. This can be useful if a repository is deleted and recreated, and you want to restore the previous
144
+
status of the alerts. This script reads a CSV file with a header from stdin, with the following columns: repo, secret,
Only show alerts created after this date/time - ISO 8601 format, e.g. 2024-10-08 or 2024-10-08T12:00; or Nd format, e.g. 7d for 7 days ago
157
+
Only show alerts created after this date/time - ISO 8601 format, e.g. 2024-10-08 or
158
+
2024-10-08T12:00; or Nd format, e.g. 7d for 7 days ago
123
159
--json Output in JSON format (otherwise CSV)
124
160
--quote-all, -q Quote all fields in CSV output
125
161
--hostname HOSTNAME GitHub Enterprise hostname (defaults to github.com)
@@ -128,15 +164,21 @@ options:
128
164
129
165
### Enrich code scanning alerts
130
166
167
+
This script enriches code scanning alerts with additional CodeQL metadata, including query descriptions, MITRE CWE information, and other contextual details. It produces enhanced output in JSON, HTML, or PDF format, making it easier to generate comprehensive security reports. The alerts input must be in JSON format from `list_code_scanning_alerts.py`.
168
+
131
169
Using the PDF mode needs you to install `playwright`, which isn't in the general `requirements.txt`.
132
170
133
171
You can use `python3 -mpip install playwright` to get it, then run `playwright install` to install the required browsers.
Add CodeQL metadata to Code Scanning alerts and produce output. This must be the abbreviated version of the JSON output supported by the partner script `list_code_scanning_alerts.py`. The metadata can either be in the format provided by the `codeql resolve metadata` command, or in the format produced by the
139
-
script `parse_ql` by the same author as this script.
178
+
Add CodeQL metadata to Code Scanning alerts and produce output. This must be the abbreviated version of the JSON
179
+
output supported by the partner script `list_code_scanning_alerts.py`. The metadata can either be in the format
180
+
provided by the `codeql resolve metadata` command, or in the format produced by the script `parse_ql` by the same
181
+
author as this script.
140
182
141
183
positional arguments:
142
184
alerts JSON file containing the alerts to enrich
@@ -146,11 +188,12 @@ positional arguments:
146
188
options:
147
189
-h, --help show this help message and exit
148
190
--mitre-cwe-csv MITRE_CWE_CSV
149
-
CSV file containing MITRE CWE data for Software Development from https://cwe.mitre.org/data/csv/699.csv.zip
191
+
CSV file containing MITRE CWE data for Software Development from
Comma-separated list of fields to include in the output
@@ -160,8 +203,13 @@ options:
160
203
161
204
### Resolve duplicate secret scanning alerts
162
205
206
+
This script identifies and resolves duplicate secret scanning alerts that occur when the same secret is detected by multiple patterns. For example, when a Google Cloud private key ID is detected both as a standalone secret and as part of service account credentials, this script can automatically resolve the duplicate. Use the `--add-matching-secret` option to add custom pairs of matching secret types.
Resolve duplicate secret scanning alerts for a GitHub repository, organization or Enterprise.
167
215
@@ -175,13 +223,54 @@ options:
175
223
--state {open,resolved}, -s {open,resolved}
176
224
State of the alerts to query
177
225
--since SINCE, -S SINCE
178
-
Only show alerts created after this date/time - ISO 8601 format, e.g. 2024-10-08 or 2024-10-08T12:00; or Nd format, e.g. 7d for 7 days ago
226
+
Only show alerts created after this date/time - ISO 8601 format, e.g. 2024-10-08 or
227
+
2024-10-08T12:00; or Nd format, e.g. 7d for 7 days ago
179
228
--hostname HOSTNAME GitHub Enterprise hostname (defaults to github.com)
180
229
--debug, -d Enable debug logging
181
230
--add-matching-secret OLD_TYPE NEW_TYPE, -a OLD_TYPE NEW_TYPE
182
231
Add a new pair of matched secret types
183
232
```
184
233
234
+
### Close code scanning alerts
235
+
236
+
This script bulk-closes all open code scanning alerts for a specified repository. It's useful for cleanup operations, such as dismissing false positives or marking alerts as "won't fix" across an entire repository. The script supports dry-run mode to preview changes before applying them.
Close all open code scanning alerts for a repository.
243
+
244
+
positional arguments:
245
+
repo_name The owner/repo of the repository to close alerts for.
246
+
247
+
options:
248
+
-h, --help show this help message and exit
249
+
--resolution {false positive,won't fix,used in tests}
250
+
The resolution of the alert.
251
+
--dry-run Print the alerts that would be closed, but don't actually close them.
252
+
-d, --debug Print debug messages to the console.
253
+
```
254
+
255
+
### Estimate push protection rate
256
+
257
+
This script estimates what percentage of previously detected secrets would have been caught by push protection if it had been enabled. It compares a list of historical secret detections against the current patterns that have push protection enabled, helping you understand the potential impact of enabling this feature.
0 commit comments