Application card: GitHub security and quality AI features

Use GitHub's AI-powered code security and code quality features responsibly by understanding their purposes, capabilities, and limitations.

What is an Application Card?

GitHub’s application and platform cards are intended to help you understand how our AI technology works, the choices application owners can make that influence application performance and behavior, and the importance of considering the whole application, including the technology, the people, and the environment. Application cards are created for AI applications and platform cards are created for AI platform services. These resources can support the development or deployment of your own applications and can be shared with users or stakeholders impacted by them.

As part of its commitment to responsible AI, GitHub adheres to Microsoft's six core principles: fairness, reliability and safety, privacy and security, inclusiveness, transparency, and accountability. These principles are embedded in the Responsible AI Standard, which guides teams in designing, building, and testing AI applications. Application and Platform Cards play a key role in operationalizing these principles by offering transparency around capabilities, intended uses, and limitations. For further insight, readers are encouraged to explore Microsoft’s Responsible AI Transparency Report and GitHub Terms.

1. Overview

GitHub's security and quality platform includes several AI-powered capabilities that help developers find and fix security vulnerabilities, detect leaked secrets, and improve code quality. This application card covers the following experiences:

Copilot Autofix is an expansion of code scanning that provides users with targeted recommendations to help them fix code scanning alerts, avoiding the introduction of new security vulnerabilities. Potential fixes are generated automatically by large language models (LLMs) using data from the codebase and from code scanning analysis. Copilot Autofix is available for CodeQL analysis and does not require a GitHub Copilot subscription.

Code scanning users can already see security alerts on their pull requests. However, developers often have little training in secure coding, so fixing these alerts requires substantial effort. Copilot Autofix lowers the barrier of entry by combining information on best practices with details of the codebase and alert to suggest a potential fix. Instead of starting with a search for information about the vulnerability, the developer starts with a code suggestion that demonstrates a potential solution for their codebase. The developer evaluates the potential fix to determine whether it is the best solution for their codebase and to ensure that it maintains the intended behavior.

Secret scanning's generic secret detection is an AI-powered expansion of secret scanning that identifies unstructured secrets in source code or other GitHub surfaces and generates an alert. GitHub Secret Protection and GitHub Advanced Security users can already receive secret scanning alerts for partner or custom patterns found in their source code, but unstructured secrets are not easily discoverable. Secret scanning uses models to identify these secrets. When a finding is detected, an alert is displayed in the "Generic" list of secret scanning alerts (under the Security and quality tab of the repository, organization, or enterprise), so that maintainers and security managers can review the alert and, where necessary, remove the credential or implement a fix. Generic secret detection does not require a GitHub Copilot subscription.

Secret scanning's custom pattern regular expression generator makes it possible to define custom secret scanning patterns without knowledge of regular expressions. Users input a natural language description of what they want to detect, along with optional example strings, and the generator produces up to three candidate regular expressions. These patterns can then be validated via the dry-run mechanism before being deployed as custom patterns. The regular expression generator does not require a GitHub Copilot subscription.

GitHub Code Quality helps users improve code reliability, maintainability, and overall project health by surfacing actionable feedback and offering automatic fixes for findings in pull requests and on the default branch. When Code Quality is enabled, two types of analysis run: CodeQL quality queries identify problems with the maintainability, reliability, or style of code, and LLM-powered analysis provides additional insights beyond what deterministic engines can find. When a quality issue is detected, Copilot Autofix suggests a relevant fix. On pull requests, results are displayed as comments left by the github-code-quality bot. On the default branch, LLM-powered findings are displayed in the AI findings dashboard under the Security and quality tab. Additionally, Code Quality can automatically generate a code coverage CI workflow for your repository using an AI-powered agent, reducing the manual effort required to set up coverage tracking.

The primary supported language for GitHub Code Security AI features is English.

2. Key terms

The following list provides a glossary of key terms related to GitHub Code Security AI features:

3. Key features or capabilities

The key features and capabilities outlined here describe what GitHub Code Security AI features are designed to do and how they perform across supported tasks.

4. Intended uses

GitHub Code Security AI features can be used in multiple scenarios across a variety of industries. Some examples of use cases include:

5. Models and training data

Copilot Autofix uses internal GitHub Copilot APIs interfacing with the large language models, which produce both suggested fixes in code and explanatory text for those fixes.

Generic secret detection uses models to scan for unstructured secrets.

The custom pattern regular expression generator uses LLMs and the GitHub Copilot API to generate regular expressions that match user-provided descriptions and examples.

GitHub Code Quality's LLM-powered analysis uses Copilot language models to analyze recently changed files for quality issues. The CodeQL quality queries component does not use an LLM. Copilot Autofix for Code Quality findings uses the same LLM pipeline as Copilot Autofix for code scanning.

For a comparison of the models available for Copilot, see AI model comparison. For the full list of supported models, see Supported AI models in GitHub Copilot. For information on where models are hosted, see Hosting of models for GitHub Copilot. To learn more about the data used to train the foundation models behind GitHub security and quality, see What data has GitHub Copilot been trained on? in the GitHub Copilot FAQ.

Data handled by Copilot Autofix is not employed for LLM training purposes. The use of this feature is governed by the existing terms and conditions associated with GitHub Advanced Security. For more information, see GitHub Terms for Additional Products and Features.

6. Performance

When Copilot Autofix is enabled for a repository, code scanning alerts are processed through the following pipeline:

  1. Input processing: When a code scanning alert is identified, GitHub assembles the relevant data into a prompt for the language model. This data includes:
  2. Language model analysis: The assembled prompt is sent to the language model, which analyzes the alert context, code structure, and query help information.
  3. Response generation: The model generates a potential fix, including both the proposed code change and an explanatory text describing the fix.
  4. Output formatting: The suggestion is stored within the code scanning backend and displayed as an inline suggestion on the pull request or alert detail page. No user interaction is needed beyond enabling code scanning on the codebase and creating a pull request.

Differences by experience

AI secret detection processes input and produces output as follows:

  1. Input processing: Input is limited to text (typically code) that a user has checked into a repository. The system provides this text to the model along with a meta prompt asking the model to find unstructured secrets within the scope of the input. The user does not interact with the model directly. Multiple models may be used to validate a single finding.
  2. Model analysis: The model scans for strings that resemble unstructured secrets like passwords.
  3. Response generation: The model verifies that the identified strings included in the response actually exist in the input.
  4. Output formatting: Detected strings are surfaced as alerts on the secret scanning alerts page in a separate list from regular secret scanning alerts. Each alert notes that it was detected by AI. For information on how to view alerts for generic secrets, see Viewing and filtering alerts from secret scanning.

Custom pattern regex generator processes input and produces output as follows:

  1. Input processing: Users input a natural language text description of the pattern they want to detect, along with optional example strings that should be matched.
  2. Language model analysis: The description and examples are sent to the LLM via the GitHub Copilot API, which generates regular expressions matching the input.
  3. Response generation: The model returns up to three candidate regular expressions. Each result includes an AI-generated plain language description. Some results may be quite similar, and some may not match every instance of the intended pattern.
  4. Output formatting: Results are displayed in the custom pattern definition form. When you click Use result, the expression and any examples are copied to the main custom pattern form, where you can perform a dry run to validate the pattern across your repository or organization. For more information, see Defining custom patterns for secret scanning.

GitHub Code Quality LLM-powered analysis processes input and produces output as follows:

  1. Input processing: After each push to the default branch, recently changed files are combined with other relevant contextual information to form a prompt. The prompt is sent to a Copilot language model.
  2. Language model analysis: The language model analyzes the code for maintainability, reliability, and other quality issues.
  3. Response generation: The model generates a response that can include natural language suggestions and code suggestions linked to specific lines.
  4. Output formatting: Findings are displayed in the AI findings dashboard under the Security and quality tab. Where Code Quality provides a code suggestion, it is presented as a suggested change that can be applied with a couple of clicks.

Copilot Autofix for Code Quality findings on pull requests:

  1. Input processing: Code quality findings from CodeQL analysis on a pull request are sent to the LLM along with surrounding code context.
  2. Language model analysis: The LLM analyzes the finding and generates a potential fix.
  3. Response generation: If the LLM can generate a fix, it produces a suggested code change.
  4. Output formatting: The github-code-quality bot posts a comment on the pull request with the suggested change. Users can also request autofix generation for results on the default branch.

7. Limitations

Understanding GitHub Code Security AI features' limitations is crucial to determine if it is used within safe and effective boundaries. While we encourage customers to leverage GitHub Code Security AI features in their innovative solutions or applications, it's important to note that GitHub Code Security AI features was not designed for every possible scenario. We encourage users to refer to GitHub Terms as well as the following considerations when choosing a use case:

Limitations specific to AI secret detection

Limitations specific to the custom pattern regex generator

Limitations specific to GitHub Code Quality

8. Evaluations

Performance and safety evaluations assess whether AI applications are operating reliably and securely by examining factors like groundedness, relevance, and coherence while identifying the risks of generating harmful content. The following evaluations were conducted with safety components already in place, which are also described in 9. Safety components and mitigations.

Performance and quality evaluations

GitHub Security AI features are evaluated across its supported surfaces using a combination of industry-standard benchmarks (e.g., SWE-Bench) and internally developed evaluation suites. Benchmark tasks are sourced from public open-source repositories and synthetic scenarios; no real user queries or customer code are used without permission. Each evaluation includes multiple independent runs to account for nondeterminism in model outputs. Key metrics include resolution rate (percentage of tasks successfully completed), token efficiency, latency, and tool call reliability. Models are re-evaluated when updates are made and monitored continuously in production via error rates, response latency, and aggregate usage patterns.

Performance and quality evaluation methods

New models undergo a staged evaluation process before deployment to Code Security, Code Quality, and Secret Protection. Integrator teams run benchmark suites specific to their surface, testing the model on representative coding tasks such as bug fixes, code generation, and multi-file refactoring. Results are reviewed against established baselines and existing production models. Models must meet or exceed baseline performance across key metrics like resolution rate, token efficiency, and latency, before advancing to the next stage.

Risk and safety evaluations

Evaluating potential risks associated with AI-generated content is essential for safeguarding against content risks with varying degrees of severity. This includes evaluating an AI application's predisposition towards generating harmful content or testing vulnerabilities to jailbreak attacks. For GitHub, we conduct performance evaluations, including those which are adapted for coding purposes from Microsoft Foundry:

Evaluation data for quality and safety

Our evaluation data is custom-built to assess AI application performance across key areas of safety and quality, simulating real-world scenarios and risks. We begin by identifying relevant evaluation aspects of concern based on multi-disciplinary research and expert input. These concerns are translated into targeted evaluation objectives and guide formulation of evaluation metrics. For safety, we create adversarial prompts to elicit undesirable or edge-case responses, which are then scored using AI-assisted annotators trained to assess alignment with GitHub’s standards. For quality, we craft rubric-based prompts relevant to scenarios including evaluating retrieval-augmented generation (RAG) applications and agents. Datasets are curated from diverse sources including synthetic and public datasets to simulate real-world user scenarios. Using the curated datasets, both evaluations undergo iterative refinement and human alignment to improve metric efficacy and reliability. This methodology forms the foundation of repeatable, rigorous assessments that reflect how customers use evaluations to build better AI.

Custom evaluations

GitHub uses an automated test harness to continuously monitor the quality of Copilot Autofix suggestions. The test harness includes a set of over 2,300 alerts from a diverse set of public repositories where the highlighted code has test coverage. Suggestions for these alerts are tested to determine how much a developer would need to edit them before committing them to the codebase. For many of the test alerts, suggestions generated by the LLM could be committed as-is to fix the alert while continuing to successfully pass all existing CI tests.

GitHub tests the effectiveness of suggestions by merging all suggested changes, unedited, before running code scanning and the repository's unit tests on the resulting code:

  1. Was the code scanning alert fixed by the suggestion?
  2. Did the fix introduce any new code scanning alerts?
  3. Did the fix introduce any syntax errors that code scanning can detect?
  4. Has the fix changed the output of any of the repository tests?

In addition, GitHub spot-checks many successful suggestions and verifies that they fix the alert without introducing new problems. When one or more of these checks fail, manual triage showed that in many cases the proposed fix was nearly correct but needed some minor modifications that a user could identify and manually perform.

The system is also stress-tested to check for potential harm (red teaming), and a filtering system on the LLM helps prevent potentially harmful suggestions from being displayed to users.

AI secret detection has been subject to Responsible AI Red Teaming and GitHub continues to monitor the efficacy and safety of the feature over time.

Custom pattern regex generator results are validated through the dry-run mechanism, which allows users to test generated patterns across their repository or organization before deploying them as custom patterns. This built-in validation step helps ensure that generated regular expressions perform as expected before they are used in production.

GitHub Code Quality's LLM-powered analysis shares the evaluation framework of Copilot code review. Copilot Autofix suggestions for Code Quality findings follow the same test harness as Copilot Autofix for code scanning.

9. Safety components and mitigations

10. Best practices for deploying and adopting GitHub Code Security AI features

Responsible AI is a shared commitment between GitHub and its customers. While GitHub builds AI applications with safety, fairness, and transparency at the core, customers play a critical role in deploying and using these technologies responsibly within their own contexts. To support this partnership, we offer the following best practices for deployers and end users to help customers implement responsible AI effectively.

11. Learn more about GitHub Security AI features

For additional guidance on the responsible use of GitHub Security AI features, we recommend reviewing the following documentation:

Learn more about responsible AI