Repository navigation
Add secret scanning alert update tool - #3889
Open
belaltaher8 wants to merge 3 commits into
Open
belaltaher8 wants to merge 3 commits into
belaltaher8 wants to merge 3 commits into
Conversation
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The documentation omits that manual validity overrides are limited to custom-pattern alerts, potentially leading callers to request unsupported updates that return 422 errors.
1 open issue
What changed in this PR
Adds opt-in secret-scanning alert updates to GitHub MCP Server, extending the existing security-alert write tools.
Changes:
- Support reopening or resolving alerts, changing assignees, and setting or clearing validity overrides.
- Add strict input validation, scope enforcement, read-only exclusion, and minimal labeled responses.
- Add protocol, schema, and CLI coverage, plus documentation and triage guidance.
| File | Description |
|---|---|
README.md |
Documents the new tool and parameters. |
pkg/skills/catalog/tools.go |
Adds the tool to the security-triage catalog. |
pkg/skills/catalog/skills/security-alert-triage/SKILL.md |
Explains update usage and credential-revocation limits. |
pkg/skills/catalog/skills/security-alert-triage/references/alert-sources.md |
Adds the tool and clarifies alert dispositions. |
pkg/github/update_secret_scanning_alert.go |
Implements validation, authenticated updates, and narrow responses. |
pkg/github/update_secret_scanning_alert_test.go |
Covers updates, validation, errors, precision, and registration. |
pkg/github/typed_security_outputs_test.go |
Adds typed output-schema coverage. |
pkg/github/tools.go |
Registers the new tool. |
pkg/github/__toolsnaps__/update_secret_scanning_alert.snap |
Records the tool’s schema and annotations. |
cmd/github-mcp-server/main_test.go |
Checks CLI scopes and read-only exclusion. |
Review effort: Max (adaptive)
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
belaltaher8
force-pushed
the
belaltaher8-oss-secret-scanning-alert-update
branch
from
November 18, 2026 20:12
29c566c to
1f9f286
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
Add
update_secret_scanning_alertto reopen or resolve alerts, change an assignee, and set or clear a custom-pattern validity override through GitHub's public REST API. Depends on #3888; this PR contains only the secret-scanning layer.Why
Secret scanning alerts can currently be read but not updated through this server. This adds an opt-in write tool without changing the existing read helpers or the lower alert-update implementations.
What changed
secret_protection, exclude it from read-only mode, requiresecurity_events, and attach the existing security-alert IFC label to successful results.MCP impact
update_secret_scanning_alertrequires separateowner,repo, andalertNumber, plus at least one of state, assignee, or validity. Resolving requires a non-null resolution. Omitted fields remain unchanged; explicit nulls retain their PATCH meaning. Unknown fields and invalid enums are rejected, including through direct/library calls. No confirmation Boolean or approval endpoint is added.Prompts tested (tool changes only)
Prompt-equivalent registered MCP calls were tested against mocked HTTP responses in legacy and modern protocol eras; natural-language routing and live GitHub writes were not run.
Security / limits
Uses the authenticated client and existing GitHub error handling. GitHub enforces repository permissions and delegated dismissal policy; there are no fallback writes, permission bypasses, licensing changes, or identity changes. Resolving as
revokeddoes not revoke or rotate credentials, and a validity override does not validate a secret. The custom-pattern restriction is documentation, not a new client-side policy check or extra API request.The output projection excludes literal secrets, comments, metadata, and full user objects. Original JSON is validated before SDK numeric conversion and reread in the handler, preserving IDs above 2^53 through int64 maximum and rejecting fractional/overflowing targets. Responses must identify the requested alert. No invented comment-length limit or unsupported top-level schema combinators are introduced. A malformed or unexpected success response reports that the update may already have applied; inspect with
get_secret_scanning_alertandhide_secret: truebefore retrying.Tool renaming
deprecated_tool_aliases.goNote: if you're renaming tools, you must add the tool aliases. For more information on how to do so, please refer to the official docs.
Lint & tests
./script/lint./script/testCommands run and results:
go test ./pkg/github ./cmd/github-mcp-server ./pkg/skills/catalog -run 'Test(Update(SecretScanning|CodeScanning|Dependabot)Alert|.*UpdateListScopes|CatalogToolRequirementsAreRegistered|ToolsetInstructionsAreCoveredBySkills)' -count=1— passed on the final rebased stack.script/lint— passed, 0 issues, on the final rebased stack.script/test— passed, full race suite (go test -race ./...), on the final rebased stack.UPDATE_TOOLSNAPS=true go test ./...— passed during initial implementation.UPDATE_TOOLSNAPS=true go test ./pkg/github -run TestUpdateSecretScanningAlert -count=1— passed after the validity-description clarification; snapshot refreshed.script/generate-docs— passed on the final rebased stack; generated files unchanged after regeneration.go build ./cmd/github-mcp-server ./cmd/mcpcurl— passed on the final rebased stack.go run ./cmd/github-mcp-server list-scopes --toolsets=all --output=json— passed during implementation; 150 tools, including all three alert-update tools withsecurity_events.Focused coverage includes protocols
2025-11-25and2026-07-28, exact ID boundaries, direct/library input validation, null versus omission, all supported update reasons, assignment and validity changes, actual returned state, narrow output, upstream failures, IFC labels, opt-in/read-only/scope filtering, portable advertised schemas, cloud/enterprise configured-client inheritance, and unchanged shared-client defaults. Uncertain-success tests cover malformed/empty/type-invalid/mismatched responses and 202/204 with exactly one PATCH and no retry. Existing read helpers and both lower update implementations/tests/snapshots are unchanged relative to the updated base. Live PAT-dependent e2e tests were not run.Docs
Regenerated README tool documentation and updated the security-alert source reference. Tool and field descriptions explain custom-pattern-only validity overrides, as documented in the public changelog. The versioned public REST schema includes all requested PATCH fields; no newer API version is required.
Skills
Updated
security-alert-triageand its optional tool catalog entry. Guidance distinguishes alert disposition, secret values, custom-pattern-only manual validity overrides, actual credential revocation, and inspecting the alert before retrying an uncertain update.