-
Notifications
You must be signed in to change notification settings - Fork 35
Add safe output type for code scanning alert autofixes #9962
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…, handler, Go config Co-authored-by: pelikhan <[email protected]>
Co-authored-by: pelikhan <[email protected]>
|
@copilot rename to "autofix_code_scanning" |
Co-authored-by: pelikhan <[email protected]>
…scanning_autofix Co-authored-by: pelikhan <[email protected]>
…e_scanning Co-authored-by: pelikhan <[email protected]>
|
@copilot update "security pr ..." agentic workflow to use the autofix safe output instead of create-pull-request . Adapt prompt accordingly. |
Co-authored-by: pelikhan <[email protected]>
|
@copilot keep working |
|
@copilot rename to "rename to "autofix_code_scanning_alert" |
…of create-pull-request Co-authored-by: pelikhan <[email protected]>
Updated the |
…anning_alert Co-authored-by: pelikhan <[email protected]>
|
@copilot Recompile |
Co-authored-by: pelikhan <[email protected]>
| mkdir -p /tmp/gh-aw/mcp-logs/safeoutputs | ||
| cat > /opt/gh-aw/safeoutputs/config.json << 'EOF' | ||
| {"create_pull_request":{},"missing_data":{},"missing_tool":{},"noop":{"max":1}} | ||
| {"missing_data":{},"missing_tool":{},"noop":{"max":1}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot the compiler does not add the safe output in the configuration. fix it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in commit 6c7e2a4. The compiler now properly generates the autofix_code_scanning_alert configuration in config.json. The safe outputs config now includes {"autofix_code_scanning_alert":{"max":5}} along with the other configurations.
…onfig.json Co-authored-by: pelikhan <[email protected]>
|
@copilot fix the prompt to precisely provide the argument for the list code security alerts |
…calls Co-authored-by: pelikhan <[email protected]>
Fixed in commit ddc2f2a. The prompt now provides precise argument specifications for all GitHub code scanning API calls:
Each parameter includes guidance on where to get the values (e.g., from context variables like |
Implements
autofix_code_scanning_alertsafe output type to enable AI agents to create autofixes for code scanning alerts via GitHub REST API.Implementation
Schema & Types
AutofixCodeScanningAlertOutputto agent-output.json schema with required fields:alert_number,fix_description,fix_codeHandler
github.request()to call/repos/{owner}/{repo}/code-scanning/alerts/{alert_number}/fixesendpointIntegration
AutofixCodeScanningAlertConfigGo type with parsergenerateFilteredToolsJSON()security-events: writepermission for safe outputs jobWorkflow Update
security-fix-prworkflow to useautofix-code-scanning-alertinstead ofcreate-pull-requesteditandbashtools from the workflow (no longer needed)list_code_scanning_alerts,get_code_scanning_alert, andget_file_contentsUsage
{"type": "autofix_code_scanning_alert", "alert_number": 42, "fix_description": "Fix SQL injection by using parameterized queries", "fix_code": "const query = db.prepare('SELECT * FROM users WHERE id = ?').bind(userId);"}API Call Examples
The security-fix-pr workflow now includes precise parameter guidance:
list_code_scanning_alerts:
owner: ${{ github.repository_owner }}repo: Extract from ${{ github.repository }}state: "open"sort: "created"get_code_scanning_alert:
owner: ${{ github.repository_owner }}repo: Extract from ${{ github.repository }}alert_number: From previous stepNotes
github.request()directly ascreateAutofixnot yet in @actions/github SDKX-GitHub-Api-Version: 2022-11-28security-events: read; safe outputs job gets elevated towriteautomaticallyOriginal prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.