Note
AI Scan is currently in public preview and subject to change.
AI Scan produces additional security findings with an AI-based scanning engine that runs on pull requests and complements CodeQL. Unlike CodeQL alerts, AI Scan findings are only available on pull requests and do not appear as backlog alerts in the repository's security view.
While CodeQL provides high-precision static analysis for a specific set of supported languages and queries, many repositories use languages and frameworks that CodeQL does not cover. AI Scan expands code scanning coverage into these areas, helping you find vulnerabilities without adding new tools or configuration.
During the public preview, AI Scan requires a GitHub Advanced Security license and a GitHub Copilot license.
Usage consumes AI credits. See Usage-based billing for organizations and enterprises.
How AI Scan works
AI Scan runs automatically when code scanning is enabled for a repository, the repository's effective AI Scan setting is enabled, and an eligible pull request contains qualifying changes in a supported language or framework that CodeQL does not cover. These conditions also determine when AI Scan usage begins. The scan is triggered on pull request creation and after each new commit, the same as CodeQL.
AI Scan does not require CodeQL default setup and does not depend on the state of CodeQL analysis. If CodeQL analysis fails or is in a waiting state, AI Scan will still run.
AI Scan findings are advisory and do not block pull request merges. They provide signals about where code security can be improved without interrupting your workflow.
The AI scanning engine works directly with the code in the pull request and does not require a build system. It uses tools such as code search to gather additional context from the repository when deciding whether to flag an issue. It uses its own specialized prompts and does not use custom instruction files such as /.github/copilot-instructions.md or /CLAUDE.md.
Results are posted to the pull request as they are found. If the CodeQL scan takes longer to complete, you may see AI Scan findings before CodeQL results appear, or vice versa.
How AI Scan findings appear on pull requests
AI Scan findings appear alongside CodeQL alerts on the Conversation and Files changed tabs of a pull request. Each finding is labeled with an "AI" indicator so you can distinguish it from CodeQL alerts.
Each finding includes a description of the security issue and an explanation of the risk. Most findings also include a suggested remediation, but not every finding has one. Where a suggested remediation is available, Copilot Autofix is included and provides a recommended code change to fix the issue, the same way it does for CodeQL alerts. Findings also include a thumbs up/down feedback mechanism that helps improve detection quality over time.
Limitations
- AI Scan analyzes pull requests only. Full repository scans are not supported.
- AI Scan findings cannot yet be used in rulesets to enforce merge requirements.
- AI Scan does not run on pull requests from forks or pull requests created by Dependabot.
- Detection categories and supported languages may change as the feature evolves.
- As with any AI-based tool, AI Scan findings may include false positives. Use the feedback mechanism to report inaccurate results.
Supported languages
AI Scan is designed to cover languages and frameworks that are not currently supported by CodeQL. This includes, but is not limited to, languages such as PHP, Shell/Bash, Terraform configuration (HCL), and Dockerfiles, as well as framework coverage gaps such as JSP for Java and Blazor for C#.
For a full list of languages supported by CodeQL, see Code scanning with CodeQL.
Detection categories
AI Scan currently covers the following categories. These categories describe how findings are classified. The scanning engine may evolve over time as models improve.
- String injection — Unsafe string-built SQL, HTML, shell, JSON, or YAML with missing or incorrect escaping or sanitization.
- Weak cryptography — Weak algorithms, small keys, insecure randomness, missing encryption, or weak password hashing.
- Broken access control — Path traversal, CSRF gaps, or user-driven open redirects.
- Sensitive data exposure — Secrets, tokens, passwords, or stack traces stored, logged, or sent without adequate protection.
- Security misconfiguration — Risky defaults or settings, such as disabling security controls or enabling debug features.
- Authentication failures — Missing TLS or validation, insecure authentication flows, or missing rate limiting.
- Data integrity failures — Unsafe deserialization, HTTP for sensitive actions, prototype pollution, or executing untrusted content.
- Server-side request forgery (SSRF) — Server fetches attacker-controlled URLs, hosts, or protocols.
- Supply chain risks — Unpinned third-party actions, packages, or images, or downloads without integrity checks.
Enabling AI Scan
AI Scan is not allowed at the enterprise level by default and disabled at the organization and repository levels. Enterprise owners must allow AI Scan before organization administrators can enable it. Enabling AI Scan for an organization applies it to eligible repositories where code scanning is enabled. Repository administrators can opt out for individual repositories. For an eligible public repository owned by a personal account, a repository administrator must enable AI Scan directly for the repository.
You do not need to select a model to enable AI Scan.
- Enterprise: The AI Scan policy under "Code Security" controls whether organizations can enable the feature. See Enforcing policies for code security and analysis for your enterprise.
- Organization: The AI Scan setting under "Code scanning" enables AI Scan for eligible repositories in the organization where code scanning is enabled. See Configuring global security settings for your organization.
- Repository: For an organization-owned repository, the AI Scan toggle under "Code scanning" lets repository administrators opt out when AI Scan is enabled for the organization. For an eligible public repository owned by a personal account, the toggle enables or disables AI Scan directly.
You can use the REST API to manage the organization or repository ai-scan setting. See REST API endpoints for code scanning.