github-manage-security-alerts-skill 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/SKILL.md +233 -233
- package/package.json +3 -4
- package/scripts/github_security_api.py +360 -358
- package/scripts/github_security_cli.py +848 -835
- package/scripts/github_security_common.py +103 -103
- package/scripts/github_security_operations.py +1246 -1162
- package/scripts/github_security_render.py +310 -318
- package/scripts/manage_github_security_alerts.py +57 -58
package/SKILL.md
CHANGED
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
---
|
|
1
|
+
---
|
|
2
2
|
name: "github-manage-security-alerts"
|
|
3
3
|
description: "Use when a user asks to inspect, triage, bulk-fix, bulk-dismiss, dismiss, reopen, resolve, assign, summarize, export, or configure GitHub repository security alerts across repositories, including code scanning, Dependabot, Dependabot malware, and secret scanning; securely reads the GitHub token from environment variables such as GITHUB_TOKEN"
|
|
4
4
|
license: "Unlicense"
|
|
5
5
|
metadata:
|
|
6
6
|
short-description: "Inspect and triage GitHub security alerts"
|
|
7
7
|
---
|
|
8
|
-
|
|
9
|
-
# GitHub Security Alerts Management
|
|
10
|
-
|
|
11
|
-
## Overview
|
|
12
|
-
|
|
13
|
-
Use this skill when a user asks to inspect or manage GitHub repository security alerts, including:
|
|
14
|
-
|
|
15
|
-
- code scanning alerts
|
|
16
|
-
- Dependabot alerts
|
|
17
|
-
- Dependabot malware alerts
|
|
18
|
-
- secret scanning alerts
|
|
19
|
-
- secret scanning alert locations
|
|
20
|
-
- secret scanning scan history
|
|
21
|
-
- repository security settings overview
|
|
22
|
-
- raw GitHub security API inspection across repositories
|
|
23
|
-
- bulk alert export for offline triage or reporting workflows
|
|
24
|
-
- bulk alert mutation for high-volume cleanup workflows
|
|
25
|
-
|
|
26
|
-
The bundled helper is repository-agnostic:
|
|
27
|
-
|
|
28
|
-
- point `--repo` at any local checkout
|
|
29
|
-
- let it auto-detect `owner/repo` and the GitHub host from the git remote
|
|
8
|
+
|
|
9
|
+
# GitHub Security Alerts Management
|
|
10
|
+
|
|
11
|
+
## Overview
|
|
12
|
+
|
|
13
|
+
Use this skill when a user asks to inspect or manage GitHub repository security alerts, including:
|
|
14
|
+
|
|
15
|
+
- code scanning alerts
|
|
16
|
+
- Dependabot alerts
|
|
17
|
+
- Dependabot malware alerts
|
|
18
|
+
- secret scanning alerts
|
|
19
|
+
- secret scanning alert locations
|
|
20
|
+
- secret scanning scan history
|
|
21
|
+
- repository security settings overview
|
|
22
|
+
- raw GitHub security API inspection across repositories
|
|
23
|
+
- bulk alert export for offline triage or reporting workflows
|
|
24
|
+
- bulk alert mutation for high-volume cleanup workflows
|
|
25
|
+
|
|
26
|
+
The bundled helper is repository-agnostic:
|
|
27
|
+
|
|
28
|
+
- point `--repo` at any local checkout
|
|
29
|
+
- let it auto-detect `owner/repo` and the GitHub host from the git remote
|
|
30
30
|
- or pass `--repository owner/repo` explicitly
|
|
31
31
|
- authenticate via environment variable instead of putting a token on the command line
|
|
32
32
|
- optionally override the API base URL for custom environments
|
|
@@ -42,213 +42,213 @@ Supports GitHub.com and standard GHES API base URL derivation from git remotes,
|
|
|
42
42
|
Use `repo` when the target is a local checkout, defaulting to `.`.
|
|
43
43
|
Use optional `repository` and `token_env` values when auto-detection is not enough.
|
|
44
44
|
Common commands include `summary`, `export-alerts`, `bulk-update-alerts`, `repo-security-overview`, `list-code-scanning`, `show-code-scanning`, `update-code-scanning`, `list-dependabot`, `show-dependabot`, `update-dependabot`, `list-malware`, `show-malware`, `update-malware`, `list-secret-scanning`, `show-secret-scanning`, `update-secret-scanning`, `list-secret-locations`, `secret-scan-history`, and `api-call`.
|
|
45
|
-
|
|
46
|
-
## Security model
|
|
47
|
-
|
|
48
|
-
Do not paste GitHub tokens into command arguments.
|
|
49
|
-
|
|
50
|
-
Preferred pattern:
|
|
51
|
-
|
|
52
|
-
```powershell
|
|
53
|
-
$env:GITHUB_TOKEN = Get-Secret GITHUB_TOKEN -AsPlainText
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
If a repository uses a different environment variable name, either export that variable first or pass the variable name with `--token-env`.
|
|
57
|
-
|
|
58
|
-
Examples:
|
|
59
|
-
|
|
60
|
-
```powershell
|
|
61
|
-
python "<path-to-skill>/scripts/manage_github_security_alerts.py" summary --repo "."
|
|
62
|
-
python "<path-to-skill>/scripts/manage_github_security_alerts.py" summary --repo "." --token-env GITHUB_TOKEN
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
## Inputs
|
|
66
|
-
|
|
67
|
-
- `repo`: path inside the target repository checkout (default `.`)
|
|
68
|
-
- `repository`: optional explicit `owner/repo` override
|
|
69
|
-
- `api_base_url`: optional explicit API base URL override
|
|
70
|
-
- `token_env`: optional environment variable name containing the token; repeatable for fallbacks
|
|
71
|
-
- `json`: optional machine-readable output flag
|
|
72
|
-
|
|
73
|
-
## Important note about malware alerts
|
|
74
|
-
|
|
75
|
-
GitHub surfaces malware findings as **Dependabot malware alerts**.
|
|
76
|
-
|
|
77
|
-
There is not a separate repository alert family with its own dedicated REST surface. The bundled helper therefore treats malware as a filtered subset of Dependabot alerts and cross-references each alert's advisory GHSA against the GitHub Advisory Database to identify advisories whose type is `malware`.
|
|
78
|
-
|
|
79
|
-
That means:
|
|
80
|
-
|
|
81
|
-
- `list-malware`, `show-malware`, and `update-malware` are backed by Dependabot alert APIs
|
|
82
|
-
- malware classification is strongest on GitHub.com, where the advisory database endpoint is available
|
|
83
|
-
- if advisory type lookup is unavailable on the target host, the helper reports that clearly instead of silently guessing
|
|
84
|
-
|
|
85
|
-
## Quick start
|
|
86
|
-
|
|
87
|
-
### 1. Inspect the current security state
|
|
88
|
-
|
|
89
|
-
```powershell
|
|
90
|
-
python "<path-to-skill>/scripts/manage_github_security_alerts.py" summary --repo "."
|
|
91
|
-
```
|
|
92
|
-
|
|
93
|
-
### 2. View repository security settings overview
|
|
94
|
-
|
|
95
|
-
```powershell
|
|
96
|
-
python "<path-to-skill>/scripts/manage_github_security_alerts.py" repo-security-overview --repo "."
|
|
97
|
-
```
|
|
98
|
-
|
|
99
|
-
### 2.5 Export the full alert sets for bulk triage
|
|
100
|
-
|
|
101
|
-
```powershell
|
|
102
|
-
python "<path-to-skill>/scripts/manage_github_security_alerts.py" export-alerts --repo "." --json
|
|
103
|
-
```
|
|
104
|
-
|
|
105
|
-
### 3. List code scanning alerts
|
|
106
|
-
|
|
107
|
-
```powershell
|
|
108
|
-
python "<path-to-skill>/scripts/manage_github_security_alerts.py" list-code-scanning --repo "." --state open --severity high,error
|
|
109
|
-
```
|
|
110
|
-
|
|
111
|
-
### 3.5 Bulk-dismiss or bulk-reopen alerts
|
|
112
|
-
|
|
113
|
-
```powershell
|
|
114
|
-
python "<path-to-skill>/scripts/manage_github_security_alerts.py" bulk-update-alerts --repo "." --surface code-scanning --select-state open --target-state dismissed --dismissed-reason "false positive" --comment "Reviewed and intentionally dismissed." --limit 10 --dry-run --json
|
|
115
|
-
|
|
116
|
-
python "<path-to-skill>/scripts/manage_github_security_alerts.py" bulk-update-alerts --repo "." --surface dependabot --select-state open --target-state dismissed --dismissed-reason tolerable_risk --comment "Accepted until the next dependency refresh." --limit 25 --dry-run --json
|
|
117
|
-
|
|
118
|
-
python "<path-to-skill>/scripts/manage_github_security_alerts.py" bulk-update-alerts --repo "." --surface secret-scanning --select-state open --target-state resolved --resolution used_in_tests --limit 25 --dry-run --json
|
|
119
|
-
```
|
|
120
|
-
|
|
121
|
-
### 4. Dismiss or reopen a code scanning alert
|
|
122
|
-
|
|
123
|
-
```powershell
|
|
124
|
-
python "<path-to-skill>/scripts/manage_github_security_alerts.py" update-code-scanning --repo "." --alert 42 --state dismissed --dismissed-reason false_positive --comment "False positive after manual review." --dry-run
|
|
125
|
-
python "<path-to-skill>/scripts/manage_github_security_alerts.py" update-code-scanning --repo "." --alert 42 --state open
|
|
126
|
-
```
|
|
127
|
-
|
|
128
|
-
### 5. List Dependabot alerts
|
|
129
|
-
|
|
130
|
-
```powershell
|
|
131
|
-
python "<path-to-skill>/scripts/manage_github_security_alerts.py" list-dependabot --repo "." --state open --ecosystem npm --has patch
|
|
132
|
-
```
|
|
133
|
-
|
|
134
|
-
### 6. Dismiss or reopen a Dependabot alert
|
|
135
|
-
|
|
136
|
-
```powershell
|
|
137
|
-
python "<path-to-skill>/scripts/manage_github_security_alerts.py" update-dependabot --repo "." --alert 7 --state dismissed --dismissed-reason tolerable_risk --comment "Accepted until next quarterly upgrade." --dry-run
|
|
138
|
-
python "<path-to-skill>/scripts/manage_github_security_alerts.py" update-dependabot --repo "." --alert 7 --state open
|
|
139
|
-
```
|
|
140
|
-
|
|
141
|
-
### 7. List malware alerts
|
|
142
|
-
|
|
143
|
-
```powershell
|
|
144
|
-
python "<path-to-skill>/scripts/manage_github_security_alerts.py" list-malware --repo "." --state open
|
|
145
|
-
```
|
|
146
|
-
|
|
147
|
-
### 8. List secret scanning alerts safely
|
|
148
|
-
|
|
149
|
-
```powershell
|
|
150
|
-
python "<path-to-skill>/scripts/manage_github_security_alerts.py" list-secret-scanning --repo "." --state open
|
|
151
|
-
```
|
|
152
|
-
|
|
153
|
-
Secret values are hidden by default.
|
|
154
|
-
|
|
155
|
-
### 9. Resolve or reopen a secret scanning alert
|
|
156
|
-
|
|
157
|
-
```powershell
|
|
158
|
-
python "<path-to-skill>/scripts/manage_github_security_alerts.py" update-secret-scanning --repo "." --alert 11 --state resolved --resolution revoked --comment "Token revoked and rotated." --dry-run
|
|
159
|
-
python "<path-to-skill>/scripts/manage_github_security_alerts.py" update-secret-scanning --repo "." --alert 11 --state open
|
|
160
|
-
```
|
|
161
|
-
|
|
162
|
-
### 10. Show secret locations and scan history
|
|
163
|
-
|
|
164
|
-
```powershell
|
|
165
|
-
python "<path-to-skill>/scripts/manage_github_security_alerts.py" list-secret-locations --repo "." --alert 11
|
|
166
|
-
python "<path-to-skill>/scripts/manage_github_security_alerts.py" secret-scan-history --repo "."
|
|
167
|
-
```
|
|
168
|
-
|
|
169
|
-
### 11. Use the raw API fallback for anything not wrapped yet
|
|
170
|
-
|
|
171
|
-
```powershell
|
|
172
|
-
python "<path-to-skill>/scripts/manage_github_security_alerts.py" api-call --repo "." --endpoint /repos/OWNER/REPO/code-scanning/default-setup
|
|
173
|
-
```
|
|
174
|
-
|
|
175
|
-
## Workflow
|
|
176
|
-
|
|
177
|
-
1. Resolve authentication securely.
|
|
178
|
-
- Prefer an environment variable like `GITHUB_TOKEN`.
|
|
179
|
-
- If needed, load it from a secret manager into an environment variable first.
|
|
180
|
-
- Never print the token in logs or chat output.
|
|
181
|
-
2. Resolve the target repository.
|
|
182
|
-
- Prefer `--repo` and auto-detection from git remote.
|
|
183
|
-
- Fall back to `--repository owner/repo` when the local checkout is unavailable or nonstandard.
|
|
184
|
-
3. Inspect current findings.
|
|
185
|
-
- Run `summary` first.
|
|
186
|
-
- Use `export-alerts` when you need a fuller multi-surface JSON snapshot for bulk triage or external reporting.
|
|
187
|
-
- Use the list/show commands for the alert family you care about.
|
|
188
|
-
- Use `repo-security-overview` when the question is about enablement or available security settings.
|
|
189
|
-
4. Classify findings.
|
|
190
|
-
- Fix real defects in code or dependency configuration when appropriate.
|
|
191
|
-
- Dismiss only when you have a clear justification.
|
|
192
|
-
- Reopen alerts when the earlier dismissal or resolution is no longer valid.
|
|
193
|
-
- Use `bulk-update-alerts` when a repository has dozens or hundreds of obviously mis-triaged alerts that need the same action.
|
|
194
|
-
5. Apply mutations carefully.
|
|
195
|
-
- Prefer `--dry-run` first for risky changes.
|
|
196
|
-
- Add a short, actionable dismissal or resolution comment.
|
|
197
|
-
- Remember that write operations need the corresponding GitHub permissions.
|
|
198
|
-
6. Verify the post-change state.
|
|
199
|
-
- Re-run the relevant list/show command.
|
|
200
|
-
- For code or dependency fixes, wait for the next GitHub analysis cycle if you expect the alert to disappear naturally.
|
|
201
|
-
|
|
202
|
-
## Bundled resources
|
|
203
|
-
|
|
204
|
-
### scripts/manage_github_security_alerts.py
|
|
205
|
-
|
|
206
|
-
Repository-agnostic helper for GitHub repository security alerts.
|
|
207
|
-
|
|
208
|
-
Supported commands:
|
|
209
|
-
|
|
210
|
-
- `summary`
|
|
211
|
-
- `export-alerts`
|
|
212
|
-
- `bulk-update-alerts`
|
|
213
|
-
- `repo-security-overview`
|
|
214
|
-
- `list-code-scanning`
|
|
215
|
-
- `show-code-scanning`
|
|
216
|
-
- `update-code-scanning`
|
|
217
|
-
- `list-dependabot`
|
|
218
|
-
- `show-dependabot`
|
|
219
|
-
- `update-dependabot`
|
|
220
|
-
- `list-malware`
|
|
221
|
-
- `show-malware`
|
|
222
|
-
- `update-malware`
|
|
223
|
-
- `list-secret-scanning`
|
|
224
|
-
- `show-secret-scanning`
|
|
225
|
-
- `update-secret-scanning`
|
|
226
|
-
- `list-secret-locations`
|
|
227
|
-
- `secret-scan-history`
|
|
228
|
-
- `api-call`
|
|
229
|
-
|
|
230
|
-
Implementation modules:
|
|
231
|
-
|
|
232
|
-
- `github_security_api.py`
|
|
233
|
-
- `github_security_cli.py`
|
|
234
|
-
- `github_security_common.py`
|
|
235
|
-
- `github_security_operations.py`
|
|
236
|
-
- `github_security_render.py`
|
|
237
|
-
|
|
238
|
-
Examples:
|
|
239
|
-
|
|
240
|
-
```powershell
|
|
241
|
-
python "<path-to-skill>/scripts/manage_github_security_alerts.py" summary --repo "." --json
|
|
242
|
-
python "<path-to-skill>/scripts/manage_github_security_alerts.py" export-alerts --repo "." --json
|
|
243
|
-
python "<path-to-skill>/scripts/manage_github_security_alerts.py" bulk-update-alerts --repo "." --surface code-scanning --select-state open --target-state dismissed --dismissed-reason "false positive" --comment "Reviewed and intentionally dismissed." --limit 10 --dry-run --json
|
|
244
|
-
python "<path-to-skill>/scripts/manage_github_security_alerts.py" list-code-scanning --repo "." --state open --per-page 100 --json
|
|
245
|
-
python "<path-to-skill>/scripts/manage_github_security_alerts.py" update-code-scanning --repo "." --alert 42 --state dismissed --dismissed-reason false_positive --comment "False positive after review." --dry-run
|
|
246
|
-
python "<path-to-skill>/scripts/manage_github_security_alerts.py" list-dependabot --repo "." --state open --ecosystem npm --json
|
|
247
|
-
python "<path-to-skill>/scripts/manage_github_security_alerts.py" list-malware --repo "." --json
|
|
248
|
-
python "<path-to-skill>/scripts/manage_github_security_alerts.py" update-dependabot --repo "." --alert 7 --state dismissed --dismissed-reason tolerable_risk --comment "Accepted temporarily." --dry-run
|
|
249
|
-
python "<path-to-skill>/scripts/manage_github_security_alerts.py" list-secret-scanning --repo "." --state open --json
|
|
250
|
-
python "<path-to-skill>/scripts/manage_github_security_alerts.py" update-secret-scanning --repo "." --alert 11 --state resolved --resolution revoked --comment "Revoked and rotated." --dry-run
|
|
251
|
-
python "<path-to-skill>/scripts/manage_github_security_alerts.py" list-secret-locations --repo "." --alert 11 --json
|
|
252
|
-
python "<path-to-skill>/scripts/manage_github_security_alerts.py" secret-scan-history --repo "." --json
|
|
253
|
-
python "<path-to-skill>/scripts/manage_github_security_alerts.py" api-call --repo "." --endpoint /repos/OWNER/REPO/dependabot/alerts --query-param state=open --json
|
|
254
|
-
```
|
|
45
|
+
|
|
46
|
+
## Security model
|
|
47
|
+
|
|
48
|
+
Do not paste GitHub tokens into command arguments.
|
|
49
|
+
|
|
50
|
+
Preferred pattern:
|
|
51
|
+
|
|
52
|
+
```powershell
|
|
53
|
+
$env:GITHUB_TOKEN = Get-Secret GITHUB_TOKEN -AsPlainText
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
If a repository uses a different environment variable name, either export that variable first or pass the variable name with `--token-env`.
|
|
57
|
+
|
|
58
|
+
Examples:
|
|
59
|
+
|
|
60
|
+
```powershell
|
|
61
|
+
python "<path-to-skill>/scripts/manage_github_security_alerts.py" summary --repo "."
|
|
62
|
+
python "<path-to-skill>/scripts/manage_github_security_alerts.py" summary --repo "." --token-env GITHUB_TOKEN
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Inputs
|
|
66
|
+
|
|
67
|
+
- `repo`: path inside the target repository checkout (default `.`)
|
|
68
|
+
- `repository`: optional explicit `owner/repo` override
|
|
69
|
+
- `api_base_url`: optional explicit API base URL override
|
|
70
|
+
- `token_env`: optional environment variable name containing the token; repeatable for fallbacks
|
|
71
|
+
- `json`: optional machine-readable output flag
|
|
72
|
+
|
|
73
|
+
## Important note about malware alerts
|
|
74
|
+
|
|
75
|
+
GitHub surfaces malware findings as **Dependabot malware alerts**.
|
|
76
|
+
|
|
77
|
+
There is not a separate repository alert family with its own dedicated REST surface. The bundled helper therefore treats malware as a filtered subset of Dependabot alerts and cross-references each alert's advisory GHSA against the GitHub Advisory Database to identify advisories whose type is `malware`.
|
|
78
|
+
|
|
79
|
+
That means:
|
|
80
|
+
|
|
81
|
+
- `list-malware`, `show-malware`, and `update-malware` are backed by Dependabot alert APIs
|
|
82
|
+
- malware classification is strongest on GitHub.com, where the advisory database endpoint is available
|
|
83
|
+
- if advisory type lookup is unavailable on the target host, the helper reports that clearly instead of silently guessing
|
|
84
|
+
|
|
85
|
+
## Quick start
|
|
86
|
+
|
|
87
|
+
### 1. Inspect the current security state
|
|
88
|
+
|
|
89
|
+
```powershell
|
|
90
|
+
python "<path-to-skill>/scripts/manage_github_security_alerts.py" summary --repo "."
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### 2. View repository security settings overview
|
|
94
|
+
|
|
95
|
+
```powershell
|
|
96
|
+
python "<path-to-skill>/scripts/manage_github_security_alerts.py" repo-security-overview --repo "."
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### 2.5 Export the full alert sets for bulk triage
|
|
100
|
+
|
|
101
|
+
```powershell
|
|
102
|
+
python "<path-to-skill>/scripts/manage_github_security_alerts.py" export-alerts --repo "." --json
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
### 3. List code scanning alerts
|
|
106
|
+
|
|
107
|
+
```powershell
|
|
108
|
+
python "<path-to-skill>/scripts/manage_github_security_alerts.py" list-code-scanning --repo "." --state open --severity high,error
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
### 3.5 Bulk-dismiss or bulk-reopen alerts
|
|
112
|
+
|
|
113
|
+
```powershell
|
|
114
|
+
python "<path-to-skill>/scripts/manage_github_security_alerts.py" bulk-update-alerts --repo "." --surface code-scanning --select-state open --target-state dismissed --dismissed-reason "false positive" --comment "Reviewed and intentionally dismissed." --limit 10 --dry-run --json
|
|
115
|
+
|
|
116
|
+
python "<path-to-skill>/scripts/manage_github_security_alerts.py" bulk-update-alerts --repo "." --surface dependabot --select-state open --target-state dismissed --dismissed-reason tolerable_risk --comment "Accepted until the next dependency refresh." --limit 25 --dry-run --json
|
|
117
|
+
|
|
118
|
+
python "<path-to-skill>/scripts/manage_github_security_alerts.py" bulk-update-alerts --repo "." --surface secret-scanning --select-state open --target-state resolved --resolution used_in_tests --limit 25 --dry-run --json
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
### 4. Dismiss or reopen a code scanning alert
|
|
122
|
+
|
|
123
|
+
```powershell
|
|
124
|
+
python "<path-to-skill>/scripts/manage_github_security_alerts.py" update-code-scanning --repo "." --alert 42 --state dismissed --dismissed-reason false_positive --comment "False positive after manual review." --dry-run
|
|
125
|
+
python "<path-to-skill>/scripts/manage_github_security_alerts.py" update-code-scanning --repo "." --alert 42 --state open
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
### 5. List Dependabot alerts
|
|
129
|
+
|
|
130
|
+
```powershell
|
|
131
|
+
python "<path-to-skill>/scripts/manage_github_security_alerts.py" list-dependabot --repo "." --state open --ecosystem npm --has patch
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
### 6. Dismiss or reopen a Dependabot alert
|
|
135
|
+
|
|
136
|
+
```powershell
|
|
137
|
+
python "<path-to-skill>/scripts/manage_github_security_alerts.py" update-dependabot --repo "." --alert 7 --state dismissed --dismissed-reason tolerable_risk --comment "Accepted until next quarterly upgrade." --dry-run
|
|
138
|
+
python "<path-to-skill>/scripts/manage_github_security_alerts.py" update-dependabot --repo "." --alert 7 --state open
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
### 7. List malware alerts
|
|
142
|
+
|
|
143
|
+
```powershell
|
|
144
|
+
python "<path-to-skill>/scripts/manage_github_security_alerts.py" list-malware --repo "." --state open
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
### 8. List secret scanning alerts safely
|
|
148
|
+
|
|
149
|
+
```powershell
|
|
150
|
+
python "<path-to-skill>/scripts/manage_github_security_alerts.py" list-secret-scanning --repo "." --state open
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
Secret values are hidden by default.
|
|
154
|
+
|
|
155
|
+
### 9. Resolve or reopen a secret scanning alert
|
|
156
|
+
|
|
157
|
+
```powershell
|
|
158
|
+
python "<path-to-skill>/scripts/manage_github_security_alerts.py" update-secret-scanning --repo "." --alert 11 --state resolved --resolution revoked --comment "Token revoked and rotated." --dry-run
|
|
159
|
+
python "<path-to-skill>/scripts/manage_github_security_alerts.py" update-secret-scanning --repo "." --alert 11 --state open
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
### 10. Show secret locations and scan history
|
|
163
|
+
|
|
164
|
+
```powershell
|
|
165
|
+
python "<path-to-skill>/scripts/manage_github_security_alerts.py" list-secret-locations --repo "." --alert 11
|
|
166
|
+
python "<path-to-skill>/scripts/manage_github_security_alerts.py" secret-scan-history --repo "."
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
### 11. Use the raw API fallback for anything not wrapped yet
|
|
170
|
+
|
|
171
|
+
```powershell
|
|
172
|
+
python "<path-to-skill>/scripts/manage_github_security_alerts.py" api-call --repo "." --endpoint /repos/OWNER/REPO/code-scanning/default-setup
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
## Workflow
|
|
176
|
+
|
|
177
|
+
1. Resolve authentication securely.
|
|
178
|
+
- Prefer an environment variable like `GITHUB_TOKEN`.
|
|
179
|
+
- If needed, load it from a secret manager into an environment variable first.
|
|
180
|
+
- Never print the token in logs or chat output.
|
|
181
|
+
2. Resolve the target repository.
|
|
182
|
+
- Prefer `--repo` and auto-detection from git remote.
|
|
183
|
+
- Fall back to `--repository owner/repo` when the local checkout is unavailable or nonstandard.
|
|
184
|
+
3. Inspect current findings.
|
|
185
|
+
- Run `summary` first.
|
|
186
|
+
- Use `export-alerts` when you need a fuller multi-surface JSON snapshot for bulk triage or external reporting.
|
|
187
|
+
- Use the list/show commands for the alert family you care about.
|
|
188
|
+
- Use `repo-security-overview` when the question is about enablement or available security settings.
|
|
189
|
+
4. Classify findings.
|
|
190
|
+
- Fix real defects in code or dependency configuration when appropriate.
|
|
191
|
+
- Dismiss only when you have a clear justification.
|
|
192
|
+
- Reopen alerts when the earlier dismissal or resolution is no longer valid.
|
|
193
|
+
- Use `bulk-update-alerts` when a repository has dozens or hundreds of obviously mis-triaged alerts that need the same action.
|
|
194
|
+
5. Apply mutations carefully.
|
|
195
|
+
- Prefer `--dry-run` first for risky changes.
|
|
196
|
+
- Add a short, actionable dismissal or resolution comment.
|
|
197
|
+
- Remember that write operations need the corresponding GitHub permissions.
|
|
198
|
+
6. Verify the post-change state.
|
|
199
|
+
- Re-run the relevant list/show command.
|
|
200
|
+
- For code or dependency fixes, wait for the next GitHub analysis cycle if you expect the alert to disappear naturally.
|
|
201
|
+
|
|
202
|
+
## Bundled resources
|
|
203
|
+
|
|
204
|
+
### scripts/manage_github_security_alerts.py
|
|
205
|
+
|
|
206
|
+
Repository-agnostic helper for GitHub repository security alerts.
|
|
207
|
+
|
|
208
|
+
Supported commands:
|
|
209
|
+
|
|
210
|
+
- `summary`
|
|
211
|
+
- `export-alerts`
|
|
212
|
+
- `bulk-update-alerts`
|
|
213
|
+
- `repo-security-overview`
|
|
214
|
+
- `list-code-scanning`
|
|
215
|
+
- `show-code-scanning`
|
|
216
|
+
- `update-code-scanning`
|
|
217
|
+
- `list-dependabot`
|
|
218
|
+
- `show-dependabot`
|
|
219
|
+
- `update-dependabot`
|
|
220
|
+
- `list-malware`
|
|
221
|
+
- `show-malware`
|
|
222
|
+
- `update-malware`
|
|
223
|
+
- `list-secret-scanning`
|
|
224
|
+
- `show-secret-scanning`
|
|
225
|
+
- `update-secret-scanning`
|
|
226
|
+
- `list-secret-locations`
|
|
227
|
+
- `secret-scan-history`
|
|
228
|
+
- `api-call`
|
|
229
|
+
|
|
230
|
+
Implementation modules:
|
|
231
|
+
|
|
232
|
+
- `github_security_api.py`
|
|
233
|
+
- `github_security_cli.py`
|
|
234
|
+
- `github_security_common.py`
|
|
235
|
+
- `github_security_operations.py`
|
|
236
|
+
- `github_security_render.py`
|
|
237
|
+
|
|
238
|
+
Examples:
|
|
239
|
+
|
|
240
|
+
```powershell
|
|
241
|
+
python "<path-to-skill>/scripts/manage_github_security_alerts.py" summary --repo "." --json
|
|
242
|
+
python "<path-to-skill>/scripts/manage_github_security_alerts.py" export-alerts --repo "." --json
|
|
243
|
+
python "<path-to-skill>/scripts/manage_github_security_alerts.py" bulk-update-alerts --repo "." --surface code-scanning --select-state open --target-state dismissed --dismissed-reason "false positive" --comment "Reviewed and intentionally dismissed." --limit 10 --dry-run --json
|
|
244
|
+
python "<path-to-skill>/scripts/manage_github_security_alerts.py" list-code-scanning --repo "." --state open --per-page 100 --json
|
|
245
|
+
python "<path-to-skill>/scripts/manage_github_security_alerts.py" update-code-scanning --repo "." --alert 42 --state dismissed --dismissed-reason false_positive --comment "False positive after review." --dry-run
|
|
246
|
+
python "<path-to-skill>/scripts/manage_github_security_alerts.py" list-dependabot --repo "." --state open --ecosystem npm --json
|
|
247
|
+
python "<path-to-skill>/scripts/manage_github_security_alerts.py" list-malware --repo "." --json
|
|
248
|
+
python "<path-to-skill>/scripts/manage_github_security_alerts.py" update-dependabot --repo "." --alert 7 --state dismissed --dismissed-reason tolerable_risk --comment "Accepted temporarily." --dry-run
|
|
249
|
+
python "<path-to-skill>/scripts/manage_github_security_alerts.py" list-secret-scanning --repo "." --state open --json
|
|
250
|
+
python "<path-to-skill>/scripts/manage_github_security_alerts.py" update-secret-scanning --repo "." --alert 11 --state resolved --resolution revoked --comment "Revoked and rotated." --dry-run
|
|
251
|
+
python "<path-to-skill>/scripts/manage_github_security_alerts.py" list-secret-locations --repo "." --alert 11 --json
|
|
252
|
+
python "<path-to-skill>/scripts/manage_github_security_alerts.py" secret-scan-history --repo "." --json
|
|
253
|
+
python "<path-to-skill>/scripts/manage_github_security_alerts.py" api-call --repo "." --endpoint /repos/OWNER/REPO/dependabot/alerts --query-param state=open --json
|
|
254
|
+
```
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "github-manage-security-alerts-skill",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Codex skill for inspecting and triaging GitHub security alerts.",
|
|
6
6
|
"license": "Unlicense",
|
|
@@ -39,9 +39,8 @@
|
|
|
39
39
|
"scripts": {
|
|
40
40
|
"validate": "node tools/validate-skill-package.mjs",
|
|
41
41
|
"pack:dry-run": "npm pack --dry-run",
|
|
42
|
-
"publish:local": "npm run release:verify && npm publish",
|
|
43
|
-
"release:verify": "npm run validate && npm run pack:dry-run"
|
|
44
|
-
"stage:local": "npm run release:verify && npm stage publish"
|
|
42
|
+
"publish:local": "npm run release:verify && npm publish --access public",
|
|
43
|
+
"release:verify": "npm run validate && npm run pack:dry-run"
|
|
45
44
|
},
|
|
46
45
|
"codexSkill": {
|
|
47
46
|
"name": "github-manage-security-alerts",
|