Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions .github/workflows/code-scanning-fixer.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ You are a security-focused code analysis agent that automatically fixes code sca

Your goal is to:
1. **Check cache for previously fixed alerts**: Avoid fixing the same alert multiple times
2. **List all open alerts**: Find all open code scanning alerts (prioritizing by severity: critical, high, medium, low, warning, note, error)
2. **List open high-risk alerts**: Find open critical/high code scanning alerts (prioritizing critical over high)
3. **Select an unfixed alert**: Pick the highest severity unfixed alert that hasn't been fixed recently
Comment on lines +63 to 64
Copy link

Copilot AI Apr 21, 2026

Choose a reason for hiding this comment

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

The workflow now scopes itself to critical/high alerts, but the surrounding text still implies it handles “all severity levels” (see the earlier intro) and selects from “all open alerts”. Please update the description/wording to consistently reflect the high-risk-only scope so readers don’t expect medium/low handling from this workflow.

This issue also appears in the following locations of the same file:

  • line 84
  • line 88

Copilot uses AI. Check for mistakes.
4. **Analyze the vulnerability**: Understand the security issue and its context
5. **Generate a fix**: Create code changes that address the security issue
Expand All @@ -84,15 +84,18 @@ Use the GitHub MCP server to list all open code scanning alerts:
- `owner`: "githubnext" (the repository owner)
- `repo`: "gh-aw" (the repository name)
- `state`: "open"
- Do NOT filter by severity - get all alerts
- `severity`: "critical,high" (required to prevent oversized MCP responses)
- Medium/low/warning/note/error are intentionally excluded in this workflow so each run stays within MCP context limits
- Do NOT send `head_limit` to the default GitHub MCP tool (`list_code_scanning_alerts` does not support it)
- If using a custom wrapper that explicitly documents `head_limit`, you may use `head_limit: 20`
- Sort the results by severity (prioritize: critical > high > medium > low > warning > note > error)
- If no open alerts are found, log "No unfixed security alerts found. All alerts have been addressed!" and exit gracefully
- If you encounter tool errors, report them clearly and exit gracefully rather than trying workarounds
- Create a list of alert numbers from the results, sorted by severity (highest first)

### 3. Select an Unfixed Alert

From the list of all open alerts (sorted by severity):
From the list of open high-risk alerts (sorted by severity):
- Exclude any alert numbers that are in the cache (already fixed)
- Select the first alert from the filtered list (highest severity unfixed alert)
- If no unfixed alerts remain, exit gracefully with message: "No unfixed security alerts found. All alerts have been addressed!"
Expand Down Expand Up @@ -189,7 +192,7 @@ After successfully creating the pull request:

## Security Guidelines

- **All Severity Levels**: Fix security alerts of all severities (prioritizing critical, high, medium, low, warning, note, error in that order)
- **High-Risk Only**: This workflow only processes critical/high alerts to keep MCP responses bounded and actionable
- **Minimal Changes**: Make only the changes necessary to fix the security issue
- **No Breaking Changes**: Ensure the fix doesn't break existing functionality
- **Best Practices**: Follow security best practices for the specific vulnerability type
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/github-mcp-structural-analysis.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,9 @@ Test ONE representative tool from each toolset with minimal parameters:
3. **issues**: `list_issues` - List issues with perPage=1
4. **pull_requests**: `list_pull_requests` - List PRs with perPage=1
5. **actions**: `list_workflows` - List workflows with perPage=1
6. **code_security**: `list_code_scanning_alerts` - List alerts with minimal params
6. **code_security**: `list_code_scanning_alerts`
- Required guard params: `state: open`, `severity: critical,high`
- `head_limit` note: the GitHub MCP server's `list_code_scanning_alerts` tool does not support `head_limit`; use `head_limit: 20` only with custom wrappers that explicitly document support
7. **discussions**: `list_discussions` (if available)
8. **labels**: `get_label` - Get a single label
9. **users**: `get_user` (if available)
Expand Down
2 changes: 2 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,8 @@ network:
- **Never use `mode: remote`** — it does not work with the GitHub Actions token (`GITHUB_TOKEN`) and requires a special PAT or GitHub App token
- Never rely on direct `api.github.com` access in Copilot workflows
- **Never use direct GitHub CLI API reads in agent prompts** (for example: `gh api`, `gh repo view`, `gh pr list`) — use MCP `github` tools instead
- **Guard `list_code_scanning_alerts` calls in workflow prompts**: always include `state: open` and `severity: critical,high` to avoid oversized MCP responses
- **`head_limit` compatibility**: do **not** send `head_limit` to the default GitHub MCP tool; use `head_limit: 20` only with custom wrappers after verifying support in wrapper docs or wrapper-specific tests

See [GitHub MCP Server Documentation](skills/github-mcp-server/SKILL.md) for complete configuration details.

Expand Down
Loading