Suggested fixes for code scanning alerts
When code scanning finds a vulnerability in a pull request, an agent proposes a fix with an explanation, and a developer reviews and merges it.
The use case
Security teams can find vulnerabilities faster than developers fix them, so alerts pile up. When code scanning flags an issue like SQL injection or cross-site scripting in a pull request, an autofix feature proposes a code change and explains why it fixes the problem. The developer still reviews the suggested change, runs tests, checks it does not break behavior, and decides whether to merge. Security teams track which fixes were accepted and keep scanning rules current. Suggested fixes are not guaranteed to be correct or complete.
Example workflow
- Enable code scanning on the repository
- Open a pull request that triggers an alert
- Review the suggested fix and explanation
- Run tests and edit the change if needed
- Merge and confirm the alert closes
Tools
- GitHub Copilot Autofix
- GitHub Advanced Security
- CodeQL
Risks and guardrails
- Fixes can be incomplete
- Behavior changes from patches
- Over-trust in suggested code
- Keep human code review
Sources
Written by Agents Lookup. Credits and official pages for the tools this use case names:
- GitHub blog: Copilot Autofix: github.blog/news-insights/product-news/secure-code-more-than-three-times-faster-with-copilot-autofix