github-manage-security-alerts-skill 1.0.0
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/CHANGELOG.md +19 -0
- package/CONTRIBUTING.md +50 -0
- package/LICENSE +24 -0
- package/LICENSE.txt +24 -0
- package/README.md +209 -0
- package/SECURITY.md +41 -0
- package/SKILL.md +254 -0
- package/agents/openai.yaml +7 -0
- package/assets/github-manage-security-alerts-small.svg +10 -0
- package/assets/github-manage-security-alerts.png +0 -0
- package/package.json +51 -0
- package/scripts/github_security_api.py +358 -0
- package/scripts/github_security_cli.py +835 -0
- package/scripts/github_security_common.py +103 -0
- package/scripts/github_security_operations.py +1162 -0
- package/scripts/github_security_render.py +318 -0
- package/scripts/manage_github_security_alerts.py +58 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project should be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
|
+
and this project follows semantic versioning conventions where practical.
|
|
7
|
+
|
|
8
|
+
## [Unreleased]
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- Expanded top-level repository documentation and quick start guidance.
|
|
13
|
+
- Added contribution guide and security policy.
|
|
14
|
+
- Added Copilot system prompt file used by workflow automation.
|
|
15
|
+
|
|
16
|
+
### Changed
|
|
17
|
+
|
|
18
|
+
- Aligned Dependabot configuration with this repository's actual ecosystems.
|
|
19
|
+
- Retargeted repository docs/templates/workflows from the prior template to the `github-manage-security-alerts` skill and this repository's URLs/commands.
|
package/CONTRIBUTING.md
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
## Contributing to GitHub Security Alerts Skill
|
|
2
|
+
|
|
3
|
+
Thanks for contributing.
|
|
4
|
+
|
|
5
|
+
This repository is primarily a skill + helper tooling repo, so high-signal docs and safe defaults matter as much as code changes.
|
|
6
|
+
|
|
7
|
+
### Development setup
|
|
8
|
+
|
|
9
|
+
1. Clone the repository.
|
|
10
|
+
2. Ensure Python 3.10+ is available.
|
|
11
|
+
3. (Optional) create and activate a virtual environment.
|
|
12
|
+
|
|
13
|
+
PowerShell example:
|
|
14
|
+
|
|
15
|
+
```powershell
|
|
16
|
+
python -m venv .venv
|
|
17
|
+
.\.venv\Scripts\Activate.ps1
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
### Local sanity checks
|
|
21
|
+
|
|
22
|
+
From repo root, run:
|
|
23
|
+
|
|
24
|
+
```powershell
|
|
25
|
+
python -m compileall ".github/skills/github-manage-security-alerts/scripts"
|
|
26
|
+
python ".github/skills/github-manage-security-alerts/scripts/manage_github_security_alerts.py" --help
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
If you touched command behavior, include example command invocations and expected output snippets in your PR description.
|
|
30
|
+
|
|
31
|
+
### Security requirements
|
|
32
|
+
|
|
33
|
+
- **Do not** commit secrets.
|
|
34
|
+
- **Do not** pass GitHub tokens as CLI literals.
|
|
35
|
+
- Use environment variables (`GITHUB_TOKEN`, `GH_TOKEN`, or `--token-env`).
|
|
36
|
+
- Prefer `--dry-run` for mutation commands in docs/examples.
|
|
37
|
+
|
|
38
|
+
### Commit messages
|
|
39
|
+
|
|
40
|
+
This repo includes commit message conventions in:
|
|
41
|
+
|
|
42
|
+
- `.github/copilot-commit-message-instructions.md`
|
|
43
|
+
|
|
44
|
+
### Pull request checklist
|
|
45
|
+
|
|
46
|
+
- [ ] Documentation updated (README/SKILL/help text as needed)
|
|
47
|
+
- [ ] Commands in docs are still valid
|
|
48
|
+
- [ ] No secrets or tokens in changes
|
|
49
|
+
- [ ] Sanity checks pass locally
|
|
50
|
+
- [ ] Scope is focused and reversible
|
package/LICENSE
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
This is free and unencumbered software released into the public domain.
|
|
2
|
+
|
|
3
|
+
Anyone is free to copy, modify, publish, use, compile, sell, or
|
|
4
|
+
distribute this software, either in source code form or as a compiled
|
|
5
|
+
binary, for any purpose, commercial or non-commercial, and by any
|
|
6
|
+
means.
|
|
7
|
+
|
|
8
|
+
In jurisdictions that recognize copyright laws, the author or authors
|
|
9
|
+
of this software dedicate any and all copyright interest in the
|
|
10
|
+
software to the public domain. We make this dedication for the benefit
|
|
11
|
+
of the public at large and to the detriment of our heirs and
|
|
12
|
+
successors. We intend this dedication to be an overt act of
|
|
13
|
+
relinquishment in perpetuity of all present and future rights to this
|
|
14
|
+
software under copyright law.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
19
|
+
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
|
20
|
+
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
|
21
|
+
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
22
|
+
OTHER DEALINGS IN THE SOFTWARE.
|
|
23
|
+
|
|
24
|
+
For more information, please refer to <https://unlicense.org>
|
package/LICENSE.txt
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
This is free and unencumbered software released into the public domain.
|
|
2
|
+
|
|
3
|
+
Anyone is free to copy, modify, publish, use, compile, sell, or
|
|
4
|
+
distribute this software, either in source code form or as a compiled
|
|
5
|
+
binary, for any purpose, commercial or non-commercial, and by any
|
|
6
|
+
means.
|
|
7
|
+
|
|
8
|
+
In jurisdictions that recognize copyright laws, the author or authors
|
|
9
|
+
of this software dedicate any and all copyright interest in the
|
|
10
|
+
software to the public domain. We make this dedication for the benefit
|
|
11
|
+
of the public at large and to the detriment of our heirs and
|
|
12
|
+
successors. We intend this dedication to be an overt act of
|
|
13
|
+
relinquishment in perpetuity of all present and future rights to this
|
|
14
|
+
software under copyright law.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
19
|
+
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
|
20
|
+
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
|
21
|
+
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
22
|
+
OTHER DEALINGS IN THE SOFTWARE.
|
|
23
|
+
|
|
24
|
+
For more information, please refer to <https://unlicense.org>
|
package/README.md
ADDED
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
# GitHub Security Alerts Skill
|
|
2
|
+
|
|
3
|
+
[](https://github.com/Nick2bad4u/Github-Security-CodeScanning-Alerts-Skill/releases) [](https://github.com/Nick2bad4u/Github-Security-CodeScanning-Alerts-Skill/stargazers) [](https://github.com/Nick2bad4u/Github-Security-CodeScanning-Alerts-Skill/forks) [](https://github.com/Nick2bad4u/Github-Security-CodeScanning-Alerts-Skill/issues) [](https://github.com/Nick2bad4u/Github-Security-CodeScanning-Alerts-Skill/pulls?q=sort%3Aupdated-desc+is%3Apr+is%3Aopen) [](https://github.com/Nick2bad4u/Github-Security-CodeScanning-Alerts-Skill/blob/main/LICENSE) [](https://github.com/Nick2bad4u/Github-Security-CodeScanning-Alerts-Skill/network/updates)
|
|
4
|
+
|
|
5
|
+
A Copilot / AI skill for inspecting and managing GitHub repository security alerts across:
|
|
6
|
+
|
|
7
|
+
- code scanning
|
|
8
|
+
- Dependabot
|
|
9
|
+
- Dependabot malware
|
|
10
|
+
- secret scanning
|
|
11
|
+
|
|
12
|
+
This repository provides:
|
|
13
|
+
|
|
14
|
+
- a reusable `github-manage-security-alerts` skill (`SKILL.md`)
|
|
15
|
+
- a Python CLI helper to inspect and triage alerts
|
|
16
|
+
- GitHub automation for release/security hygiene
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## What this skill can do
|
|
21
|
+
|
|
22
|
+
With a GitHub token in an environment variable, you can:
|
|
23
|
+
|
|
24
|
+
- summarize repository alert posture (`summary`)
|
|
25
|
+
- export full alert snapshots for bulk triage (`export-alerts`)
|
|
26
|
+
- list/show/update code scanning alerts
|
|
27
|
+
- list/show/update Dependabot alerts
|
|
28
|
+
- list/show/update malware alerts (Dependabot malware subset)
|
|
29
|
+
- list/show/update secret scanning alerts
|
|
30
|
+
- inspect secret locations and secret scan history
|
|
31
|
+
- inspect repository security setup overview
|
|
32
|
+
- perform bulk alert updates (`bulk-update-alerts`) with `--dry-run`
|
|
33
|
+
- fall back to raw REST calls for unsupported endpoints (`api-call`)
|
|
34
|
+
|
|
35
|
+
> The helper is repository-agnostic: pass `--repo` to any local checkout, or pass explicit `--repository owner/repo`.
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
## Repository layout
|
|
40
|
+
|
|
41
|
+
```text
|
|
42
|
+
SKILL.md
|
|
43
|
+
agents/
|
|
44
|
+
openai.yaml
|
|
45
|
+
assets/
|
|
46
|
+
github-manage-security-alerts-small.svg
|
|
47
|
+
github-manage-security-alerts.png
|
|
48
|
+
scripts/
|
|
49
|
+
manage_github_security_alerts.py
|
|
50
|
+
github_security_api.py
|
|
51
|
+
github_security_cli.py
|
|
52
|
+
github_security_common.py
|
|
53
|
+
github_security_operations.py
|
|
54
|
+
github_security_render.py
|
|
55
|
+
README.md
|
|
56
|
+
CONTRIBUTING.md
|
|
57
|
+
SECURITY.md
|
|
58
|
+
CHANGELOG.md
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
---
|
|
62
|
+
|
|
63
|
+
## Publishing
|
|
64
|
+
|
|
65
|
+
The skill is packaged for GitHub releases and npm as `github-manage-security-alerts-skill`.
|
|
66
|
+
|
|
67
|
+
For the first npm publish, publish locally once so the package exists:
|
|
68
|
+
|
|
69
|
+
```powershell
|
|
70
|
+
npm run release:verify
|
|
71
|
+
npm publish
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Then configure npm trusted publishing for staged publishing:
|
|
75
|
+
|
|
76
|
+
- Organization or user: `Nick2bad4u`
|
|
77
|
+
- Repository: `Github-Security-CodeScanning-Alerts-Skill`
|
|
78
|
+
- Workflow filename: `release-skill.yml`
|
|
79
|
+
- Allowed action: `npm stage publish`
|
|
80
|
+
|
|
81
|
+
CLI equivalent:
|
|
82
|
+
|
|
83
|
+
```powershell
|
|
84
|
+
npm trust github "github-manage-security-alerts-skill" --repo "Nick2bad4u/Github-Security-CodeScanning-Alerts-Skill" --file "release-skill.yml" --allow-stage-publish
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
After that, create releases from GitHub Actions by pushing a `vX.Y.Z` tag or running the `Release Skill Bundle` workflow manually with an explicit version. The workflow uses npm OIDC trusted publishing to stage the package and does not require an npm automation token.
|
|
88
|
+
|
|
89
|
+
Approve the staged package after reviewing it:
|
|
90
|
+
|
|
91
|
+
```powershell
|
|
92
|
+
npm stage list "github-manage-security-alerts-skill"
|
|
93
|
+
npm stage approve "<stage-id>"
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
---
|
|
97
|
+
|
|
98
|
+
## Quick start
|
|
99
|
+
|
|
100
|
+
### 1) Prerequisites
|
|
101
|
+
|
|
102
|
+
- Python 3.10+
|
|
103
|
+
- A GitHub token exported to an environment variable (recommended: `GITHUB_TOKEN`)
|
|
104
|
+
|
|
105
|
+
### 2) Set your token (do not pass it on CLI)
|
|
106
|
+
|
|
107
|
+
#### PowerShell
|
|
108
|
+
|
|
109
|
+
```powershell
|
|
110
|
+
$env:GITHUB_TOKEN = "<your-token>"
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
#### Bash
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
export GITHUB_TOKEN="<your-token>"
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
### 3) Run the helper
|
|
120
|
+
|
|
121
|
+
From repository root:
|
|
122
|
+
|
|
123
|
+
```powershell
|
|
124
|
+
python "scripts/manage_github_security_alerts.py" summary --repo "."
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
Machine-readable output:
|
|
128
|
+
|
|
129
|
+
```powershell
|
|
130
|
+
python "scripts/manage_github_security_alerts.py" summary --repo "." --json
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
---
|
|
134
|
+
|
|
135
|
+
## Common commands
|
|
136
|
+
|
|
137
|
+
```powershell
|
|
138
|
+
# Export full alert sets for triage
|
|
139
|
+
python "scripts/manage_github_security_alerts.py" export-alerts --repo "." --json
|
|
140
|
+
|
|
141
|
+
# List open high/error code scanning alerts
|
|
142
|
+
python "scripts/manage_github_security_alerts.py" list-code-scanning --repo "." --state open --severity high,error
|
|
143
|
+
|
|
144
|
+
# Dismiss a code scanning alert (dry-run first)
|
|
145
|
+
python "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
|
|
146
|
+
|
|
147
|
+
# List open Dependabot alerts
|
|
148
|
+
python "scripts/manage_github_security_alerts.py" list-dependabot --repo "." --state open
|
|
149
|
+
|
|
150
|
+
# List open secret scanning alerts
|
|
151
|
+
python "scripts/manage_github_security_alerts.py" list-secret-scanning --repo "." --state open
|
|
152
|
+
|
|
153
|
+
# Bulk update (preview only)
|
|
154
|
+
python "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
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
For the full command surface and workflows, see:
|
|
158
|
+
|
|
159
|
+
- `SKILL.md`
|
|
160
|
+
|
|
161
|
+
---
|
|
162
|
+
|
|
163
|
+
## Security notes
|
|
164
|
+
|
|
165
|
+
- Never paste tokens into command arguments or commit them to git.
|
|
166
|
+
- Prefer environment variables and secret managers.
|
|
167
|
+
- Use `--dry-run` before mutation and bulk mutation actions.
|
|
168
|
+
|
|
169
|
+
More details: [`SECURITY.md`](./SECURITY.md)
|
|
170
|
+
|
|
171
|
+
---
|
|
172
|
+
|
|
173
|
+
## Contributing
|
|
174
|
+
|
|
175
|
+
Contributions are welcome. Please read:
|
|
176
|
+
|
|
177
|
+
- [`CONTRIBUTING.md`](./CONTRIBUTING.md)
|
|
178
|
+
- [`CHANGELOG.md`](./CHANGELOG.md)
|
|
179
|
+
|
|
180
|
+
---
|
|
181
|
+
|
|
182
|
+
## Releases and downloads
|
|
183
|
+
|
|
184
|
+
This repository includes a release workflow that creates a downloadable zip bundle:
|
|
185
|
+
|
|
186
|
+
- Workflow: `.github/workflows/release-skill.yml`
|
|
187
|
+
- Trigger:
|
|
188
|
+
- push a tag like `v0.1.0`
|
|
189
|
+
- run manually via **workflow_dispatch** with:
|
|
190
|
+
- `release_type`: `patch` / `minor` / `major`
|
|
191
|
+
- `version`: optional explicit `x.y.z` (overrides `release_type`)
|
|
192
|
+
- `ref`: branch to release from (default `main`)
|
|
193
|
+
- Asset: `github-security-codescanning-alerts-skill-<tag>.zip`
|
|
194
|
+
|
|
195
|
+
Examples:
|
|
196
|
+
|
|
197
|
+
```powershell
|
|
198
|
+
# Manual patch bump from main
|
|
199
|
+
gh workflow run "Release Skill Bundle" -f release_type=patch -f ref=main
|
|
200
|
+
|
|
201
|
+
# Manual explicit release version
|
|
202
|
+
gh workflow run "Release Skill Bundle" -f release_type=patch -f version=0.2.0 -f ref=main
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
---
|
|
206
|
+
|
|
207
|
+
## License
|
|
208
|
+
|
|
209
|
+
Released under [The Unlicense](./LICENSE).
|
package/SECURITY.md
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# Security Policy
|
|
2
|
+
|
|
3
|
+
## Supported scope
|
|
4
|
+
|
|
5
|
+
This repository contains automation and helper scripts for GitHub repository security alert triage.
|
|
6
|
+
|
|
7
|
+
Security-sensitive areas include:
|
|
8
|
+
|
|
9
|
+
- credential/token handling
|
|
10
|
+
- API mutation commands (`update-code-scanning`, `update-dependabot`, `update-secret-scanning`, `bulk-update-alerts`)
|
|
11
|
+
- workflow automation that can post comments or update repository state
|
|
12
|
+
|
|
13
|
+
## Reporting a vulnerability
|
|
14
|
+
|
|
15
|
+
If you discover a vulnerability, please avoid opening a public issue with exploit details.
|
|
16
|
+
|
|
17
|
+
Instead, contact the maintainer privately (for example via GitHub security reporting or direct private channel) and include:
|
|
18
|
+
|
|
19
|
+
1. affected file(s) / workflow(s)
|
|
20
|
+
2. reproducible steps
|
|
21
|
+
3. impact assessment
|
|
22
|
+
4. any suggested mitigation
|
|
23
|
+
|
|
24
|
+
## Secret handling rules
|
|
25
|
+
|
|
26
|
+
- Never hardcode GitHub tokens.
|
|
27
|
+
- Never include tokens in command arguments.
|
|
28
|
+
- Use environment variables (e.g. `GITHUB_TOKEN`, `GH_TOKEN`).
|
|
29
|
+
- Prefer secret manager retrieval into environment variables.
|
|
30
|
+
|
|
31
|
+
PowerShell example:
|
|
32
|
+
|
|
33
|
+
```powershell
|
|
34
|
+
$env:GITHUB_TOKEN = Get-Secret GITHUB_TOKEN -AsPlainText
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Operational safety
|
|
38
|
+
|
|
39
|
+
- Use `--dry-run` for mutation commands before applying changes.
|
|
40
|
+
- Verify target repository (`--repo` or `--repository owner/repo`) before running mutations.
|
|
41
|
+
- Re-check state after changes (`summary`, list/show alert commands).
|
package/SKILL.md
ADDED
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: "github-manage-security-alerts"
|
|
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
|
+
license: "Unlicense"
|
|
5
|
+
metadata:
|
|
6
|
+
short-description: "Inspect and triage GitHub security alerts"
|
|
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
|
|
30
|
+
- or pass `--repository owner/repo` explicitly
|
|
31
|
+
- authenticate via environment variable instead of putting a token on the command line
|
|
32
|
+
- optionally override the API base URL for custom environments
|
|
33
|
+
|
|
34
|
+
## Compatibility
|
|
35
|
+
|
|
36
|
+
Requires Python 3.
|
|
37
|
+
Uses the GitHub REST API directly with a token supplied through an environment variable such as `GITHUB_TOKEN` or `GH_TOKEN`.
|
|
38
|
+
Supports GitHub.com and standard GHES API base URL derivation from git remotes, with a raw API fallback for anything not wrapped yet.
|
|
39
|
+
|
|
40
|
+
## Invocation hints
|
|
41
|
+
|
|
42
|
+
Use `repo` when the target is a local checkout, defaulting to `.`.
|
|
43
|
+
Use optional `repository` and `token_env` values when auto-detection is not enough.
|
|
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
|
+
```
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
interface:
|
|
2
|
+
display_name: "GitHub Manage Security Alerts"
|
|
3
|
+
short_description: "Inspect and triage GitHub security alerts"
|
|
4
|
+
icon_small: "./assets/github-manage-security-alerts-small.svg"
|
|
5
|
+
icon_large: "./assets/github-manage-security-alerts.png"
|
|
6
|
+
brand_color: "#24292F"
|
|
7
|
+
default_prompt: "Use $github-manage-security-alerts to inspect GitHub security alerts, summarize exposure, and apply safe triage actions."
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="400" height="400" viewBox="0 0 400 400" role="img" aria-labelledby="title desc">
|
|
2
|
+
<title id="title">GitHub Manage Security Alerts</title>
|
|
3
|
+
<desc id="desc">Security shield with alert rows.</desc>
|
|
4
|
+
<rect width="400" height="400" rx="88" fill="#f6f8fa"/>
|
|
5
|
+
<path d="M200 70 292 108v76c0 74-38 120-92 146-54-26-92-72-92-146v-76z" fill="#dbeafe" stroke="#24292f" stroke-width="16" stroke-linejoin="round"/>
|
|
6
|
+
<path d="M166 168h68M166 210h68" stroke="#24292f" stroke-width="16" stroke-linecap="round"/>
|
|
7
|
+
<circle cx="258" cy="168" r="12" fill="#dc2626"/>
|
|
8
|
+
<circle cx="258" cy="210" r="12" fill="#f59e0b"/>
|
|
9
|
+
<path d="m152 256 30 28 66-78" fill="none" stroke="#059669" stroke-width="18" stroke-linecap="round" stroke-linejoin="round"/>
|
|
10
|
+
</svg>
|
|
Binary file
|