Skip to content

Commit 77cd292

Browse files
authored
Merge pull request #44100 from github/repo-sync
Repo sync
2 parents 8c25364 + 543602e commit 77cd292

32 files changed

Lines changed: 1404 additions & 52 deletions

File tree

content/code-security/concepts/secret-security/about-push-protection.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ Push protection blocks secrets detected in:
2828
* Commits made in the {% data variables.product.prodname_dotcom %} UI{% ifversion push-protection-delegated-bypass-file-upload-support %}
2929
* File uploads to a repository on {% data variables.product.github %}{% endif %}{% ifversion secret-scanning-push-protection-content-endpoints %}
3030
* Requests to the REST API{% endif %}
31-
* Interactions with the {% data variables.product.github %} MCP server (public repositories only)
3231

3332
When push protection detects a potential secret during a push attempt, it will block the push and provide a detailed message explaining the reason for the block. You will need to review the code in question, remove any sensitive information, and reattempt the push.
3433

content/code-security/concepts/secret-security/working-with-push-protection-and-the-github-mcp-server.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,4 @@ To resolve the block, you can either:
3232

3333
* [AUTOTITLE](/code-security/secret-scanning/introduction/about-push-protection)
3434
* [About the {% data variables.product.github %} MCP server](/copilot/concepts/about-mcp#about-the-github-mcp-server)
35+
* [AUTOTITLE](/code-security/how-tos/use-ghas-with-ai-coding-agents/scan-for-secrets-with-github-mcp-server)

content/code-security/how-tos/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ children:
1515
- manage-security-alerts
1616
- /maintain-quality-code
1717
- /report-and-fix-vulnerabilities
18+
- /use-ghas-with-ai-coding-agents
1819
- /view-and-interpret-data
1920
---
2021

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
title: Use GitHub Advanced Security with AI coding agents
3+
shortTitle: Advanced Security with AI agents
4+
intro: 'Catch secrets, vulnerabilities, and insecure dependencies while you code, directly from {% data variables.product.prodname_copilot %} agent mode and other MCP-compatible tools.'
5+
versions:
6+
fpt: '*'
7+
ghec: '*'
8+
contentType: how-tos
9+
children:
10+
- /scan-for-secrets-with-github-mcp-server
11+
---
Lines changed: 152 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,152 @@
1+
---
2+
title: Scanning for secrets with the GitHub MCP server
3+
shortTitle: Scan for secrets with MCP
4+
allowTitleToDifferFromFilename: true
5+
intro: 'Detect exposed secrets in real time from your AI coding agent, before they ever reach your repository.'
6+
versions:
7+
feature: copilot
8+
permissions: 'People with write access to a repository.'
9+
contentType: how-tos
10+
category:
11+
- Protect your secrets
12+
---
13+
14+
The {% data variables.product.github %} Model Context Protocol (MCP) server lets you run {% data variables.product.prodname_secret_scanning %} directly from {% data variables.product.prodname_copilot %} agent mode, {% data variables.copilot.copilot_cli %}, and other MCP-compatible tools. Scan your code for exposed keys, tokens, and credentials as you work, and fix them before you push.
15+
16+
The secret scanning tools are only available via the {% data variables.product.github %} remote MCP server. **Local MCP server configurations are not supported**.
17+
18+
This works with any MCP-compatible agent or IDE, including {% data variables.product.prodname_vscode %}, JetBrains, Claude Code, Cursor, and Windsurf. The experience varies across clients.
19+
20+
> [!NOTE] Findings returned by MCP-invoked scans are **ephemeral**. They are surfaced in your agent's chat for the current session only and are not persisted as alerts on {% data variables.product.github %}. This means these findings won't appear in the Security tab, in the {% data variables.product.prodname_secret_scanning %} alerts list, or in the REST/GraphQL APIs for alerts. MCP scans should be treated as a pre-commit safety check, not as a system of record. Remediate findings before they are pushed to the repository and persisted in Git history.
21+
22+
## Prerequisites
23+
24+
* **{% data variables.product.prodname_GH_secret_protection %}** is enabled for the repository.
25+
* **{% data variables.product.github %} MCP server** is connected in your IDE or agent. See [AUTOTITLE](/copilot/how-tos/provide-context/use-mcp/set-up-the-github-mcp-server).
26+
* Your organization's **security configuration** determines which secret types are detected and whether push protection is enforced. The MCP tools respect your organization's push protection configuration (repository-level push protection settings are not used).
27+
28+
## Step 1: Install and configure tools
29+
30+
### Enable the `secret_protection` toolset
31+
32+
Enable the `secret_protection` toolset to make the scanning tools available to your agent. The default toolsets do not include it.
33+
34+
The `run_secret_scanning` tool is currently attached to the `copilot` toolset rather than `secret_protection`. You must explicitly include `run_secret_scanning` as an additional tool alongside the `secret_protection` toolset in your MCP configuration.
35+
36+
{% cli %}
37+
38+
{% data variables.copilot.copilot_cli %} has the {% data variables.product.github %} MCP server built in:
39+
40+
```shell
41+
copilot mcp --toolsets=secret_protection --tools=run_secret_scanning
42+
```
43+
44+
{% endcli %}
45+
46+
{% vscode %}
47+
48+
Add the `secret_protection` toolset and the `run_secret_scanning tool` to your MCP configuration:
49+
50+
```json copy
51+
{
52+
"servers": {
53+
"github": {
54+
"url": "https://api.githubcopilot.com/mcp/",
55+
"headers": {
56+
"X-MCP-Toolsets": "secret_protection",
57+
"X-MCP-Tools": "run_secret_scanning"
58+
}
59+
}
60+
}
61+
}
62+
```
63+
64+
{% endvscode %}
65+
66+
{% jetbrains %}
67+
68+
In your JetBrains IDE, edit your MCP server configuration to include the `secret_protection` toolset and `run_secret_scanning` tool headers. For more information on configuring MCP servers in JetBrains, see [MCP Server](https://www.jetbrains.com/help/idea/mcp-server.html) in the JetBrains documentation.
69+
70+
```json copy
71+
{
72+
"servers": {
73+
"github": {
74+
"type": "http",
75+
"url": "https://api.githubcopilot.com/mcp/",
76+
"headers": {
77+
"GitHub-MCP-Toolsets": "secret_protection",
78+
"GitHub-MCP-Tools": "run_secret_scanning"
79+
}
80+
}
81+
}
82+
}
83+
```
84+
85+
{% endjetbrains %}
86+
87+
### (Optional) Install the {% data variables.product.prodname_AS %} plugin
88+
89+
The [{% data variables.product.prodname_AS %} plugin](https://github.com/github/copilot-plugins/tree/main/plugins/advanced-security) gives you a `/secret-scanning` slash command for a streamlined scanning experience in {% data variables.copilot.copilot_cli %} and {% data variables.product.prodname_vscode %}.
90+
The plugin uses the MCP tools under the hood, so you'll still need to enable the `secret_protection` toolset.
91+
92+
Instructions for installing the plugin:
93+
* For **{% data variables.copilot.copilot_cli %}**, see [AUTOTITLE](/copilot/how-tos/copilot-cli/customize-copilot/plugins-finding-installing#installing-plugins).
94+
* For **{% data variables.product.prodname_vscode %}**, see [Discover and install plugins](https://code.visualstudio.com/docs/copilot/customization/agent-plugins#_discover-and-install-plugins) in the {% data variables.product.prodname_vscode %} documentation.
95+
96+
## Step 2: Scan your code
97+
98+
Once the toolset is enabled, you can trigger a scan in several ways depending on your client.
99+
100+
**Natural-language prompt**. In any MCP-compatible agent, you can ask:
101+
102+
> "Scan my current changes for exposed secrets and show me the files and lines I should update before I commit."
103+
104+
> "Run {% data variables.product.prodname_secret_scanning %} on the files I've changed since my last commit and summarize any high-confidence findings."
105+
106+
**Slash command (requires the {% data variables.product.prodname_AS %} plugin)**. If you installed the optional plugin in Step 1, you can also use:
107+
108+
>"/secret-scanning Review the staged diff for credentials, keys, or tokens and propose replacements using environment variables."
109+
110+
**Direct tool invocation:** You can also invoke the scanning tool directly from your client.
111+
112+
{% cli %}
113+
114+
Run `copilot --add-github-mcp-tool run_secret_scanning`.
115+
116+
{% endcli %}
117+
118+
{% vscode %}
119+
120+
Type `/secret-scanning` in {% data variables.copilot.copilot_chat_short %}.
121+
122+
{% endvscode %}
123+
124+
{% jetbrains %}
125+
126+
1. In your IDE, open {% data variables.copilot.copilot_chat_short %}
127+
1. Click the **Agent** tab
128+
1. Use a prompt like: "Scan my recent changes for exposed secrets before I commit." You can also click the tools icon in the chat box to browse available `secret_protection` tools directly.
129+
130+
{% endjetbrains %}
131+
132+
The agent returns:
133+
134+
* The **type** of secret found
135+
* The **file and line** where it was detected
136+
* **Remediation steps**, such as removing or rotating the credential
137+
138+
If push protection is enabled, the MCP server also blocks secrets from being included in any actions it takes on your behalf, such as commits, pull requests, or the creation of files. See [AUTOTITLE](/code-security/concepts/secret-security/working-with-push-protection-and-the-github-mcp-server).
139+
140+
## Troubleshooting
141+
142+
| Problem | Check |
143+
|---|---|
144+
| Scanning returns no results | Verify the `secret_protection` toolset is enabled in your MCP configuration. |
145+
| Repository not eligible |{% data variables.product.prodname_secret_scanning_caps %} via MCP is available to public repositories and requires {% data variables.product.prodname_GH_secret_protection %} to be enabled for private and internal repositories. |
146+
| Agent doesn't recognize the tool | Confirm your IDE or agent supports MCP. See [AUTOTITLE](/copilot/concepts/context/mcp#availability). |
147+
| Unexpected detection results | Your organization's security configuration controls which patterns are scanned. Check your repository security settings. |
148+
| Tool works in one client but not another | The experience varies across MCP-compatible clients. Check your client's MCP documentation for supported features. |
149+
150+
## Further reading
151+
152+
* [AUTOTITLE](/copilot/how-tos/provide-context/use-mcp-in-your-ide/configure-toolsets)

content/code-security/reference/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,5 @@ children:
1414
- /supply-chain-security
1515
- /code-quality
1616
- /permissions
17+
- /security-incident-response
1718
---

content/code-security/reference/secret-security/understanding-github-secret-types.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ versions:
55
fpt: '*'
66
ghes: '*'
77
ghec: '*'
8-
shortTitle: GitHub secret types
8+
shortTitle: Understand secret types
99
redirect_from:
1010
- /code-security/getting-started/understanding-github-secret-types
1111
contentType: reference
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
title: Reference for security incident response
3+
shortTitle: Incident response
4+
intro: Find reference information to support your investigation and response to security incidents.
5+
versions:
6+
fpt: '*'
7+
ghec: '*'
8+
ghes: '*'
9+
contentType: reference
10+
children:
11+
- /investigation-tools
12+
- /investigation-areas
13+
---

0 commit comments

Comments
 (0)