Skip to content

add optional secret hiding to secret scanning alert tools - #3838

Merged
SamMorrowDrums merged 2 commits into
mainfrom
ashwinmohan86-secret-alert-hiding
Nov 13, 2026
Merged

SamMorrowDrums merged 2 commits into
mainfrom
ashwinmohan86-secret-alert-hiding

Conversation

@AshwinMohan86

Copy link
Copy Markdown
Contributor

Summary

Callers can request secret scanning alert details without receiving secret values. Both alert tools now accept optional hide_secret, with existing behavior unchanged unless it is true.

Why

The REST API supports excluding secrets, but these tools do not expose that option. Filtering at the API avoids retrieving secret values just to discard them.

What changed

  • Forward hide_secret to the REST API for single-alert and repository-list requests.
  • Preserve filters, pagination, permissions and output labels.

MCP impact

  • No tool or API changes
  • Tool schema or behavior changed
  • New tool added

Both tools gain an optional boolean. Omitted or false retains secret values; true requests their omission from both text and structured responses.

Prompts tested (tool changes only)

  • No natural-language prompts or live alerts tested. Synthetic MCP calls cover both tools with omitted, false and true options, including text and structured output, schema validation and unchanged labels.

Security / limits

  • No security or limits impact
  • Auth / permissions considered
  • Data exposure, filtering, or token/size limits considered

Existing authorization and private-untrusted labels remain unchanged. Secret omission is opt-in and happens at the REST API, not after fetching the secret.

Tool renaming

  • I am renaming tools as part of this PR (e.g. a part of a consolidation effort)
    • I have added the new tool aliases in deprecated_tool_aliases.go
  • I am not renaming tools as part of this PR

Note: 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

  • Linted locally with ./script/lint
  • Tested locally with ./script/test

script/lint passed. script/test passed with the full race-enabled suite. UPDATE_TOOLSNAPS=true script/test, script/generate-docs, and go build ./cmd/github-mcp-server ./cmd/mcpcurl passed.

Docs

  • Not needed
  • Updated (README / docs / examples)

Generated tool documentation includes the new option.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@AshwinMohan86
AshwinMohan86 marked this pull request as ready for review November 13, 2026 05:10
@AshwinMohan86
AshwinMohan86 requested a review from a team as a code owner November 13, 2026 05:10
Copilot AI adaptive review requested due to automatic review settings November 13, 2026 05:10

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

The security-sensitive schema and REST changes rely solely on upstream hide_secret support for secret omission across output formats, requiring maintainer judgment.

No open issues 🎉

What changed in this PR

Adds opt-in secret omission to the GitHub MCP Server’s secret scanning alert tools. Callers can set hide_secret: true to request responses without secret values; omitted or false keeps existing behavior.

Changes:

  • Add optional hide_secret inputs to single-alert and repository-list tools and forward them to the REST API.
  • Preserve existing filters, pagination, permissions, and output labels.
  • Add tests for omitted, false, and true options across direct and protocol calls, plus updated documentation and schema snapshots.
File Description
README.md Documents the optional parameter for both tools.
pkg/​github/​security_outputs.go Adds typed inputs for the secret-hiding option.
pkg/​github/​secret_scanning.go Exposes the option and includes it in REST requests.
pkg/​github/​secret_scanning_test.go Covers query forwarding, output formats, labels, and pagination defaults.
pkg/​github/​__toolsnaps__/​list_secret_scanning_alerts.snap Records the updated list-tool input schema.
pkg/​github/​__toolsnaps__/​get_secret_scanning_alert.snap Records the updated single-alert input schema.

Review effort: Max (dynamic)

@SamMorrowDrums SamMorrowDrums left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Verified hide_secret is in the REST OpenAPI spec for both endpoints, go-github v92 doesn't expose it (so the hand-built request is justified), and path escaping matches existing convention. CI green.

@SamMorrowDrums
SamMorrowDrums merged commit 0663b83 into main Nov 13, 2026
21 checks passed
@SamMorrowDrums
SamMorrowDrums deleted the ashwinmohan86-secret-alert-hiding branch November 13, 2026 17:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants