|
| 1 | +--- |
| 2 | +title: AI-powered security detections in pull requests |
| 3 | +shortTitle: AI-powered security detections |
| 4 | +allowTitleToDifferFromFilename: true |
| 5 | +intro: 'AI-powered security detections use an AI-based scanning engine to find security vulnerabilities in pull requests for languages and frameworks not covered by {% data variables.product.prodname_codeql %}.' |
| 6 | +versions: |
| 7 | + feature: ai-powered-security-detections |
| 8 | +contentType: concepts |
| 9 | +category: |
| 10 | + - Find and fix code vulnerabilities |
| 11 | +--- |
| 12 | + |
| 13 | +> [!NOTE] |
| 14 | +> AI-powered security detections are currently in {% data variables.release-phases.public_preview %} and subject to change. |
| 15 | +
|
| 16 | +AI-powered security detections are additional security findings produced by an AI-based scanning engine that runs on pull requests and complements {% data variables.product.prodname_codeql %}. Unlike {% data variables.product.prodname_codeql %} alerts, AI-powered findings are only available on pull requests and do not appear as backlog alerts in the repository's security view. |
| 17 | + |
| 18 | +While {% data variables.product.prodname_codeql %} provides high-precision static analysis for a specific set of supported languages and queries, many repositories use languages and frameworks that {% data variables.product.prodname_codeql %} does not cover. AI-powered detections expand {% data variables.product.prodname_code_scanning %} coverage into these areas, helping you find vulnerabilities without adding new tools or configuration. |
| 19 | + |
| 20 | +During the {% data variables.release-phases.public_preview %}, AI-powered security detections require a {% data variables.product.prodname_GHAS %} license and a {% data variables.product.prodname_copilot %} license. |
| 21 | + |
| 22 | +Usage consumes {% data variables.product.prodname_ai_credits_short %}. See [AUTOTITLE](/copilot/concepts/billing/usage-based-billing-for-organizations-and-enterprises). |
| 23 | + |
| 24 | +## How AI-powered security detections work |
| 25 | + |
| 26 | +AI-powered security detections run automatically on pull requests in repositories where {% data variables.product.prodname_codeql %} default setup is enabled and AI-powered detections have been opted into. The AI-based scan is triggered on pull request creation and after each new commit, the same as {% data variables.product.prodname_codeql %}. |
| 27 | + |
| 28 | +AI-powered findings are advisory and do not block pull request merges. They provide signals about where code security can be improved without interrupting your workflow. |
| 29 | + |
| 30 | +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`. |
| 31 | + |
| 32 | +The AI scan runs independently of {% data variables.product.prodname_codeql %}'s status. If {% data variables.product.prodname_codeql %} default setup fails or is in a waiting state, AI-powered detections will still run. |
| 33 | + |
| 34 | +Results are posted to the pull request as they are found. If the {% data variables.product.prodname_codeql %} scan takes longer to complete, you may see AI-powered findings before {% data variables.product.prodname_codeql %} results appear, or vice versa. |
| 35 | + |
| 36 | +## How findings appear on pull requests |
| 37 | + |
| 38 | +AI-powered findings appear alongside {% data variables.product.prodname_codeql %} alerts on the **Conversation** and **Files changed** tabs of a pull request. Each AI-powered finding is labeled with an "AI" indicator so you can distinguish it from {% data variables.product.prodname_codeql %} alerts. |
| 39 | + |
| 40 | +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, {% data variables.copilot.copilot_autofix_short %} is included and provides a recommended code change to fix the issue, the same way it does for {% data variables.product.prodname_codeql %} alerts. Findings also include a thumbs up/down feedback mechanism that helps improve detection quality over time. |
| 41 | + |
| 42 | +## Limitations |
| 43 | + |
| 44 | +* AI-powered security detections analyze pull requests only. Full repository scans are not supported. |
| 45 | +* AI-powered findings cannot yet be used in rulesets to enforce merge requirements |
| 46 | +* Detection categories and supported languages may change as the feature evolves. |
| 47 | +* As with any AI-based tool, findings may include false positives. Use the feedback mechanism to report inaccurate results. |
| 48 | + |
| 49 | +## Supported languages |
| 50 | + |
| 51 | +AI-powered security detections are designed to cover languages and frameworks that are not currently supported by {% data variables.product.prodname_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#. |
| 52 | + |
| 53 | +For a full list of languages supported by {% data variables.product.prodname_codeql %}, see [AUTOTITLE](/code-security/concepts/code-scanning/codeql/about-code-scanning-with-codeql#supported-languages-and-frameworks). |
| 54 | + |
| 55 | +## Detection categories |
| 56 | + |
| 57 | +AI-powered security detections currently cover the following categories. These categories describe how findings are classified. The AI scanner may evolve over time as models improve. |
| 58 | + |
| 59 | +* **String injection** — Unsafe string-built SQL, HTML, shell, JSON, or YAML with missing or incorrect escaping or sanitization. |
| 60 | +* **Weak cryptography** — Weak algorithms, small keys, insecure randomness, missing encryption, or weak password hashing. |
| 61 | +* **Broken access control** — Path traversal, CSRF gaps, or user-driven open redirects. |
| 62 | +* **Sensitive data exposure** — Secrets, tokens, passwords, or stack traces stored, logged, or sent without adequate protection. |
| 63 | +* **Security misconfiguration** — Risky defaults or settings, such as disabling security controls or enabling debug features. |
| 64 | +* **Authentication failures** — Missing TLS or validation, insecure authentication flows, or missing rate limiting. |
| 65 | +* **Data integrity failures** — Unsafe deserialization, HTTP for sensitive actions, prototype pollution, or executing untrusted content. |
| 66 | +* **Server-side request forgery (SSRF)** — Server fetches attacker-controlled URLs, hosts, or protocols. |
| 67 | +* **Supply chain risks** — Unpinned third-party actions, packages, or images, or downloads without integrity checks. |
| 68 | + |
| 69 | +## Enabling AI-powered security detections |
| 70 | + |
| 71 | +AI-powered security detections are not allowed at the enterprise level by default and disabled at the organization and repository levels. Enterprise administrators must explicitly allow the feature before organizations can enable it. Organization administrators must explicitly opt in to the feature. Repository administrators can opt-out of the feature. Additionally, you need to have the {% data variables.product.prodname_codeql %} default setup enabled. |
| 72 | + |
| 73 | +You do not need to select a model to enable AI-powered security detections. |
| 74 | + |
| 75 | +* **Enterprise**: The **AI Findings** policy under "Code Security" controls whether organizations can enable the feature. See [AUTOTITLE](/admin/enforcing-policies/enforcing-policies-for-your-enterprise/enforcing-policies-for-code-security-and-analysis-for-your-enterprise#enforcing-a-policy-to-manage-the-use-of-ai-powered-security-detections-in-your-enterprises-repositories). |
| 76 | +* **Organization**: The **AI findings** setting under "Code scanning" enables AI-powered detections for repositories in the organization. See [AUTOTITLE](/code-security/how-tos/secure-at-scale/configure-organization-security/establish-complete-coverage/configuring-global-security-settings-for-your-organization#enabling-ai-powered-security-detections). |
| 77 | +* **Repository**: The **AI findings** toggle under "Code scanning" enables or disables AI-powered detections for the individual repository. Repositories inherit the organization setting but can opt out individually. |
0 commit comments