text
stringlengths
12
91.7k
metadata
dict
About types of alerts About user alerts If the same secret appears multiple times within a single file, only one alert is created. To help you triage alerts more effectively, separates alerts into two lists: Default alerts Generic alerts Default alerts list The default alerts list displays alerts that relate to...
{ "source": "github-docs/code-security/concepts/secret-security/about-alerts.md", "title": "About secret scanning alerts" }
About bypass requests for push protection When push protection blocks a commit containing a secret, contributors may need to bypass the block to complete their push. If delegated bypass for push protection is enabled, contributors without bypass privileges must submit a bypass request and wait for approval from designa...
{ "source": "github-docs/code-security/concepts/secret-security/bypass-requests.md", "title": "Bypass requests for push protection" }
Push protection prevents you from accidentally committing secrets to a repository by blocking pushes containing supported secrets. When you attempt to push a supported secret from the command line to a repository secured by push protection, will block the push. You should either: Remove the secret from your branch. F...
{ "source": "github-docs/code-security/concepts/secret-security/command-line-push-protection.md", "title": "Push protection from the command line" }
You can define custom patterns to identify secrets that are not detected by the default patterns supported by . For example, you might have a secret pattern that is internal to your organization. For a list of supported secrets and service providers, see AUTOTITLE. Custom patterns for are defined as regular expression...
{ "source": "github-docs/code-security/concepts/secret-security/custom-patterns.md", "title": "Custom patterns" }
About delegated bypass for push protection With delegated bypass for push protection, you can: Grant bypass permissions to select individuals, roles, and teams, allowing them to push commits that are initially blocked by push protection. Grant exemptions to select actors, skipping push protection entirely for all of ...
{ "source": "github-docs/code-security/concepts/secret-security/delegated-bypass.md", "title": "Delegated bypass for push protection" }
About public monitoring monitors for secrets leaked across in real time. Public monitoring attributes publicly exposed secrets back to your enterprise, based on where your people commit. detects secrets in repositories that your enterprise owns. Public monitoring extends this detection to secrets found in arbitrary ...
{ "source": "github-docs/code-security/concepts/secret-security/public-monitoring.md", "title": "Public monitoring for secret scanning" }
About push protection and the MCP server Push protection prevents you from inadvertently exposing secrets, such as tokens, keys and credentials, in your repository. When you're interacting with the MCP server, push protection blocks secrets in AI-generated responses as well as preventing secrets from being included i...
{ "source": "github-docs/code-security/concepts/secret-security/push-protection-and-the-github-mcp-server.md", "title": "Working with push protection and the GitHub MCP server" }
About push protection from the REST API Push protection prevents you from accidentally committing secrets to a repository by blocking pushes containing supported secrets. The "Create a blob" and "Create or update file contents" endpoints in the REST API include push protection. See AUTOTITLE and AUTOTITLE. If you make ...
{ "source": "github-docs/code-security/concepts/secret-security/push-protection-from-the-rest-api.md", "title": "Working with push protection from the REST API" }
Overview The metrics overview for push protection on security overview helps you understand how well you are preventing secret leaks in your organization or across organizations in your enterprise. You can view the entire dataset or filter for specific criteria, making it easy to identify repositories where you may ne...
{ "source": "github-docs/code-security/concepts/secret-security/push-protection-metrics.md", "title": "Secret scanning push protection metrics" }
What is push protection? Push protection is a feature designed to prevent hardcoded credentials, such as secrets or tokens, from ever being pushed to your repository. Rather than alerting you to credential leaks after the fact, push protection blocks pushes that contain secrets before they reach your repository. How ...
{ "source": "github-docs/code-security/concepts/secret-security/push-protection.md", "title": "Push protection" }
What are secrets? Secrets are credentials that grant access to sensitive systems and data. Common examples include: API keys and tokens used to authenticate with external services Database passwords and connection strings Cloud provider credentials and service account tokens Certificates and encryption keys When se...
{ "source": "github-docs/code-security/concepts/secret-security/secret-leakage-risks.md", "title": "Secret leakage risks" }
About scans public repositories and public npm packages for secrets issued by specific service providers who joined our partnership program, and alerts the relevant service provider whenever a secret is detected in a commit. The service provider validates the string and then decides whether they should revoke the sec...
{ "source": "github-docs/code-security/concepts/secret-security/secret-scanning-for-partners.md", "title": "Secret scanning for partners" }
When credentials like API keys and passwords are committed to repositories as hardcoded secrets, they become targets for unauthorized access. automatically detects credential leaks so you can secure them before they're exploited. [!TIP] At any time, you can run a free assessment of your organization's code for leake...
{ "source": "github-docs/code-security/concepts/secret-security/secret-scanning.md", "title": "Secret scanning" }
Hardcoded credentials in your repositories can lead to credential leaks, unauthorized access, data breaches, and significant costs to your organization. For details about these risks and how to protect against them, see AUTOTITLE. provides tools to help you understand and address your organization's exposure to leaked...
{ "source": "github-docs/code-security/concepts/secret-security/secret-security-with-github.md", "title": "Secret security with GitHub" }
secrets are used to securely store sensitive information like API keys, tokens, and passwords in repositories. When you store the sensitive information as a secret, you remove the need to hardcode the credential or key, and prevent exposure of it in your code or logs. The secret can then be used to authenticate servic...
{ "source": "github-docs/code-security/concepts/secret-security/secret-types.md", "title": "GitHub secret types" }
About validity checks Validity checks, a feature of , verify whether a detected secret is still active and could be exploited. This helps you prioritize remediation by focusing first on secrets that are confirmed to be active. You can enable automatic validity checks for detected secrets. Once enabled, will periodical...
{ "source": "github-docs/code-security/concepts/secret-security/validity-checks.md", "title": "Validity checks" }
Once you have identified security alerts the next step is to identify the most urgent alerts and get them fixed. Security campaigns are a way to group alerts and share them with developers, so you can collaborate to remediate vulnerabilities in the code and any exposed secrets. Security campaigns in your day-to-day wo...
{ "source": "github-docs/code-security/concepts/security-at-scale/about-security-campaigns.md", "title": "About security campaigns" }
About security tools for auditors provides tools for security auditors and developers to review and analyze responses to security alerts within an enterprise or organization. This guide describes the tools, which include historical timelines, security overview, audit logs, the API, and webhooks. Security auditors can ...
{ "source": "github-docs/code-security/concepts/security-at-scale/audit-security-alerts.md", "title": "Auditing security alerts" }
Delegated alert dismissal lets you restrict which users can directly dismiss an alert. When you enable the feature: Users with write access to a repository must request to dismiss alerts in that repository. Organization owners and security managers can approve or deny dismissal requests, as well as dismiss alerts dir...
{ "source": "github-docs/code-security/concepts/security-at-scale/delegated-alert-dismissal.md", "title": "Delegated alert dismissal" }
About securing your organization has many features that help you improve and maintain the quality of your code. Some features are included in all plans. Additional features are available to organizations on and that if you purchase a product: You can easily enable and manage 's security features throughout your o...
{ "source": "github-docs/code-security/concepts/security-at-scale/organization-security.md", "title": "Enabling security features at scale" }
Security overview provides insights into the security of code stored in repositories in your organization. All organizations on can use the free to evaluate the exposure of their organization to leaked secrets, see AUTOTITLE. accounts that purchase have access to views with additional insights. The information be...
{ "source": "github-docs/code-security/concepts/security-at-scale/security-overview.md", "title": "Security overview" }
Before enabling organization-wide, run a pilot to validate the solution with a small set of repositories. A pilot helps you refine your rollout strategy, identify workflow adjustments, and demonstrate security value to stakeholders. This article will help you choose the best repositories for your pilot. A successful p...
{ "source": "github-docs/code-security/concepts/security-at-scale/select-pilot-repositories.md", "title": "Best practices for selecting pilot repositories" }
You can allow users to identify their projects' dependencies by enabling the dependency graph for . For more information, see Enabling the dependency graph for your enterprise. You can also allow users to find and fix vulnerabilities in their code dependencies by enabling and . For more information, see AUTOTITLE. Aft...
{ "source": "github-docs/code-security/concepts/security-at-scale/supply-chain-security.md", "title": "Supply chain security for your enterprise" }
The dependabot.yml file is an optional configuration file that gives you fine-grained control over how monitors and updates dependencies (mainly version updates but also security updates) in your repository. Without a dependabot.yml file, can still create security updates for vulnerable dependencies if you've enabled...
{ "source": "github-docs/code-security/concepts/supply-chain-security/about-the-dependabot-yml-file.md", "title": "About the dependabot.yml file" }
Best practices for maintaining dependencies Staying up to date on dependencies is crucial to maintaining a secure software environment. Here are some recommendations: Adopt security-focused dependency management tools Use and set up tools that scan your dependencies for vulnerabilities and automatically suggest upd...
{ "source": "github-docs/code-security/concepts/supply-chain-security/best-practices-for-maintaining-dependencies.md", "title": "Best practices for maintaining dependencies" }
Monitor security advisories Subscribe to security advisories for the languages and frameworks you use. Automate the integration of advisories into your development workflow to stay informed of new vulnerabilities. Keep an eye on the dashboards provided by your dependency management tools. Be aware of cr...
{ "source": "github-docs/code-security/concepts/supply-chain-security/best-practices-for-maintaining-dependencies.md", "title": "Best practices for maintaining dependencies" }
Response plan for vulnerabilities Have a clear incident response plan for when vulnerabilities are identified in dependencies. Ensure the team knows how to quickly address and remediate security issues. By following these practices, you can significantly reduce the risk posed by outdated and vulnerable dependen...
{ "source": "github-docs/code-security/concepts/supply-chain-security/best-practices-for-maintaining-dependencies.md", "title": "Best practices for maintaining dependencies" }
Metrics for help you understand the security posture of your organization's dependencies and track progress in resolving vulnerabilities. You can use these metrics to prioritize remediation efforts and focus on the most critical security issues. Metrics for are available on your organization's security overview. Who...
{ "source": "github-docs/code-security/concepts/supply-chain-security/dependabot-alert-metrics.md", "title": "Metrics for Dependabot alerts" }
Software often relies on packages from various sources, creating dependency relationships that can unknowingly introduce security vulnerabilities. When your code depends on packages with known security vulnerabilities, you become a target for attackers seeking to exploit your system—potentially gaining access to your c...
{ "source": "github-docs/code-security/concepts/supply-chain-security/dependabot-alerts.md", "title": "Dependabot alerts" }
About allow you to instruct to automatically triage and . You can use to: Automatically dismiss or snooze certain alerts Specify the you want to open pull requests for Rules are applied before alert notifications are sent, so enabling rules that auto-dismiss low-risk alerts will help reduce notification noise....
{ "source": "github-docs/code-security/concepts/supply-chain-security/dependabot-auto-triage-rules.md", "title": "Dependabot auto-triage rules" }
[!NOTE] Job logs are only available for repositories with enabled. Whenever a job runs, the details of the job are captured in the job logs list, which is accessible from the dependency graph. What job logs contain For each manifest file in your repository, maintains a list of recent job runs. Every log entry incl...
{ "source": "github-docs/code-security/concepts/supply-chain-security/dependabot-job-logs.md", "title": "Dependabot job logs" }
About on runners [!IMPORTANT] If is enabled for a repository, it will always run on , bypassing both Actions policy checks and disablement at the repository or organization level. This ensures that security and version update workflows always run when Dependabot is enabled. Using runners allows you to more easily...
{ "source": "github-docs/code-security/concepts/supply-chain-security/dependabot-on-actions.md", "title": "Dependabot on GitHub Actions runners" }
Pull requests for security updates If you've enabled security updates, pull requests for security updates are triggered by a alert for a dependency on your default branch. automatically raises a pull request to update the vulnerable dependency. Each pull request contains everything you need to quickly and safely revi...
{ "source": "github-docs/code-security/concepts/supply-chain-security/dependabot-pull-requests.md", "title": "Dependabot pull requests" }
<!--Marketing-LINK: From /features/security/software-supply-chain page "About Dependabot security updates".-- About make it easier for you to fix vulnerable dependencies in your repository. If you enable , when a alert is raised for a vulnerable dependency in the dependency graph of your repository, automatically ...
{ "source": "github-docs/code-security/concepts/supply-chain-security/dependabot-security-updates.md", "title": "Dependabot security updates" }
About takes the effort out of maintaining your dependencies. You can use it to ensure that your repository automatically keeps up with the latest releases of the packages and applications it depends on. You enable by checking a dependabot.yml configuration file into your repository. Updates for packages The dependa...
{ "source": "github-docs/code-security/concepts/supply-chain-security/dependabot-version-updates.md", "title": "Dependabot version updates" }
The dependency graph can identify your project's dependencies using the following methods. Method How it works ------ ------------ Static analysis Parses manifest and lock files in your repository graph jobs Uses a workflow to generate dependency snapshots Automatic submission Runs a built-in workflow...
{ "source": "github-docs/code-security/concepts/supply-chain-security/dependency-graph-data.md", "title": "How the dependency graph recognizes dependencies" }
<!--Marketing-LINK: From /features/security and /features/security/software-supply-chain pages "How GitHub's dependency graph is generated".-- About the dependency graph For information on the supported ecosystems and manifest files, see AUTOTITLE. When you create a pull request containing changes to dependencies that...
{ "source": "github-docs/code-security/concepts/supply-chain-security/dependency-graph.md", "title": "Dependency graph" }
About dependency review For pull requests that contain changes to package manifests or lock files, you can display a dependency review to see what has changed. The dependency review includes details of changes to indirect dependencies in lock files, and it tells you if any of the added or updated dependencies contain k...
{ "source": "github-docs/code-security/concepts/supply-chain-security/dependency-review.md", "title": "Dependency review" }
Immutable releases are releases where the assets and associated Git tag cannot be changed after publication. The use of this type of release increases security by blocking supply chain attacks. Attackers cannot: Inject vulnerabilities or malware into current project releases. Make changes to assets and tags that may ...
{ "source": "github-docs/code-security/concepts/supply-chain-security/immutable-releases.md", "title": "Immutable releases" }
The provides a unified view of software artifacts that your organization builds with , such as container images, packages, or builds of your production code. The page shows you how an artifact was built, where it is stored or running, and which compliance and security metadata is associated with the artifact. Teams in...
{ "source": "github-docs/code-security/concepts/supply-chain-security/linked-artifacts.md", "title": "About linked artifacts" }
Software often relies on packages from various sources, creating dependency relationships that can threaten your project's security. For example, bad actors can use malicious packages to execute malware attacks, gaining access to your code, data, users, and contributors. To help keep your project secure, can check you...
{ "source": "github-docs/code-security/concepts/supply-chain-security/malware-alerts.md", "title": "Dependabot malware alerts" }
What are multi-ecosystem updates? Multi-ecosystem updates allow to group dependency updates across different package ecosystems such as npm, Docker, Python, and Terraform into a single pull request per group. Instead of receiving separate pull requests for each ecosystem, you receive one consolidated pull request cont...
{ "source": "github-docs/code-security/concepts/supply-chain-security/multi-ecosystem-updates.md", "title": "Multi-ecosystem updates" }
Overview Open source license compliance helps you track dependency licenses and enforce policy for the open source software in your supply chain. You can use license compliance to reduce legal and operational risk, catching nonconforming dependencies before changes are merged. How license policy works You can define a...
{ "source": "github-docs/code-security/concepts/supply-chain-security/open-source-license-compliance.md", "title": "About open source license compliance" }
About supply chain security at GitHub When developing a software project, you likely use other software to build and run your application, such as open-source libraries, frameworks or other tools. These resources are collectively referred to as your “dependencies”, because your project depends on them to function prope...
{ "source": "github-docs/code-security/concepts/supply-chain-security/supply-chain-security.md", "title": "Supply chain security" }
About disclosing vulnerabilities in the industry The initial report of a vulnerability is made privately, and the full details are only published once the maintainer has acknowledged the issue, and ideally made remediations or a patch available, sometimes with a delay to allow more time for the patches to be installed....
{ "source": "github-docs/code-security/concepts/vulnerability-reporting-and-management/coordinated-disclosure.md", "title": "Coordinated disclosure of security vulnerabilities" }
About the Security advisories are published as JSON files in the Open Source Vulnerability (OSV) format. For more information about the OSV format, see Open Source Vulnerability format. Types of security advisories Each advisory in the relates to a specific security problem in a software component. These problems co...
{ "source": "github-docs/code-security/concepts/vulnerability-reporting-and-management/github-advisory-database.md", "title": "GitHub Advisory database" }
About global security advisories There are two types of advisories: global security advisories and repository security advisories. Global advisories live in the and are grouped into three categories: [!NOTE] doesn't generate for unreviewed and malware advisories. Every repository advisory is reviewed by the cura...
{ "source": "github-docs/code-security/concepts/vulnerability-reporting-and-management/global-security-advisories.md", "title": "Global security advisories" }
About innersource advisories The provides a centralized source of alert information for security vulnerabilities. When an advisory about a vulnerable open source component is published, uses 's dependency graph to find repositories that are using that component, then sends alerts and pull requests to notify the repos...
{ "source": "github-docs/code-security/concepts/vulnerability-reporting-and-management/innersource-advisories.md", "title": "Innersource advisories" }
About repository security advisories For more information, see AUTOTITLE. With repository security advisories, you can: 1. Create a draft security advisory, and use the draft to privately discuss the impact of the vulnerability on your project. 1. Privately collaborate to fix the vulnerability in a temporary private f...
{ "source": "github-docs/code-security/concepts/vulnerability-reporting-and-management/repository-security-advisories.md", "title": "Repository security advisories" }
Risks of unaddressed vulnerabilities Your organization has exposure to vulnerabilities in both the code you write and maintain, and in the open source or third-party dependencies your code uses. Assessing your exposure to vulnerabilities is crucial if you want to prevent: Unplanned downtime and operational disruption....
{ "source": "github-docs/code-security/concepts/vulnerability-reporting-and-management/vulnerability-exposure.md", "title": "Exposure to vulnerabilities in your code and in dependencies" }
About 's security features 's security features help keep your code and secrets secure in repositories and across organizations. Some features are available for all plans. Additional features are available to organizations and enterprises on and that purchase a product: In addition, a number of and features ca...
{ "source": "github-docs/code-security/getting-started/github-security-features.md", "title": "GitHub security features" }
Introduction This guide shows you how to configure security features for a repository. Your security needs are unique to your repository, so you may not need to enable every feature for your repository. For more information, see AUTOTITLE. Managing access to your repository The first step to securing a repository is t...
{ "source": "github-docs/code-security/getting-started/quickstart-for-securing-your-repository.md", "title": "Quickstart for securing your repository" }
We recommend that you start using with default setup. After you've initially configured default setup, you can evaluate to see how it's working for you and customize it to better meet your needs. For more information, see AUTOTITLE. Prerequisites Your repository is eligible for default setup for if: Configuring de...
{ "source": "github-docs/code-security/how-tos/find-and-fix-code-vulnerabilities/configure-code-scanning/configure-code-scanning.md", "title": "Configuring default setup for code scanning" }
If you do not need a highly customizable configuration, consider using default setup for . For more information, see AUTOTITLE. Prerequisites Your repository is eligible for advanced setup if it meets these requirements. It uses -supported languages or you plan to generate code scanning results with a third-party to...
{ "source": "github-docs/code-security/how-tos/find-and-fix-code-vulnerabilities/configure-code-scanning/configuring-advanced-setup-for-code-scanning.md", "title": "Configuring advanced setup for code scanning" }
If you use a third-party analysis tool or CI/CD system to scan code for vulnerabilities, you can generate SARIF file and upload it to . The best upload method depends on how you generate the SARIF file. For example, if you use: to run the action, there is no further action required. The action uploads the SARIF fil...
{ "source": "github-docs/code-security/how-tos/find-and-fix-code-vulnerabilities/integrate-with-existing-tools/upload-sarif-file.md", "title": "Uploading a SARIF file to GitHub" }
As an alternative to running within using , you can analyze code in an external continuous integration or continuous delivery/deployment (CI/CD) system, then upload the results to . Setting up your analysis tool You will first need to download your analysis tool of choice and set it up with your CI system. If you ar...
{ "source": "github-docs/code-security/how-tos/find-and-fix-code-vulnerabilities/integrate-with-existing-tools/use-with-existing-ci-system.md", "title": "Using code scanning with your existing CI system" }
Compare build modes Build mode characteristic None Autobuild Manual ----------------------------------------------------------- Used by default setup and for organization-level enablement Yes () Yes, where none is not supported No Analysis succeeds without user configuration Yes Variable No Completeness...
{ "source": "github-docs/code-security/how-tos/find-and-fix-code-vulnerabilities/manage-your-configuration/codeql-for-compiled-languages.md", "title": "CodeQL code scanning for compiled languages" }
Provisioning enterprise-level for default setup 1. Add a to your enterprise. For more information, see AUTOTITLE. To add the code-scanning label to your , name the runner code-scanning. An enterprise can only have one named code-scanning, and that runner will handle all jobs for all organizations and repositori...
{ "source": "github-docs/code-security/how-tos/find-and-fix-code-vulnerabilities/manage-your-configuration/configure-larger-runners.md", "title": "Configuring larger runners for default setup" }
After running an initial analysis of your code with default setup, you can make changes to your configuration to better meet your needs. You can customize your configuration in the user interface, or using repository properties to add custom queries or apply a custom configuration file. See AUTOTITLE and AUTOTITLE. Cu...
{ "source": "github-docs/code-security/how-tos/find-and-fix-code-vulnerabilities/manage-your-configuration/edit-default-setup.md", "title": "Editing your configuration of default setup" }
Creating a merge protection ruleset for a repository 1. Click New ruleset. 1. To create a ruleset targeting branches, click New branch ruleset. For more information about managing rulesets in a repository, see AUTOTITLE. Creating a merge protection ruleset for all repositories in an organization 1. Click New ruleset. ...
{ "source": "github-docs/code-security/how-tos/find-and-fix-code-vulnerabilities/manage-your-configuration/set-merge-protection.md", "title": "Set code scanning merge protection" }
The shows information about all of your code scanning tools and is a good starting point for debugging problems. For more information about what the tool is and the information it provides, see AUTOTITLE. Viewing the for a repository The alerts page for each repository includes a tools banner with a summary of the ...
{ "source": "github-docs/code-security/how-tos/find-and-fix-code-vulnerabilities/manage-your-configuration/use-the-tools-status-page-for-code-scanning.md", "title": "Use the tool status page for code scanning" }
Some users prefer working with query sources directly in order to work on or contribute to open source shared queries. 1. Download the tar archive 2. Create a new directory Create a new directory where you can place the CLI and any queries and libraries you want to use. For example, $HOME/codeql-home. The CLI’s bu...
{ "source": "github-docs/code-security/how-tos/find-and-fix-code-vulnerabilities/scan-from-the-command-line/check-out-source-code.md", "title": "Checking out the CodeQL CLI source code" }
The repository contains the queries and libraries required for analysis of all supported languages. Clone a copy of this repository into codeql-home. By default, the root of the cloned repository will be called codeql. Rename this folder codeql-repo to avoid conflicting with the that you will extract in step 1. If y...
{ "source": "github-docs/code-security/how-tos/find-and-fix-code-vulnerabilities/scan-from-the-command-line/check-out-source-code.md", "title": "Checking out the CodeQL CLI source code" }
The following command syntax is suggested when creating a database bundle for troubleshooting purposes. This sample database bundle command requires version or higher. codeql database bundle --output=codeql-debug-artifacts.zip --include-diagnostics --include-logs --include-results -- <dir> For this command, <dir mus...
{ "source": "github-docs/code-security/how-tos/find-and-fix-code-vulnerabilities/scan-from-the-command-line/create-database-bundles.md", "title": "Creating CodeQL CLI database bundles" }
stores databases for over 200,000 repositories on , which you can download using the REST API. The list of repositories is constantly growing and evolving to make sure that it includes the most interesting codebases for security research. Searching for databases You can check if a repository has any databases availa...
{ "source": "github-docs/code-security/how-tos/find-and-fix-code-vulnerabilities/scan-from-the-command-line/download-databases.md", "title": "Downloading CodeQL databases from GitHub" }
About incremental analysis Full scans on every pull request can be slow, especially in large codebases. If you run the in your own CI/CD system, incremental analysis gives you two ways to speed things up: Diff-informed analysis reports only alerts in lines you added or changed, so queries run faster and results are ...
{ "source": "github-docs/code-security/how-tos/find-and-fix-code-vulnerabilities/scan-from-the-command-line/incremental-analysis.md", "title": "Using incremental analysis with the CodeQL CLI" }
Working with packs on By default, the expects to download packs from and publish packs to the on . However, you can also work with packs in a on by creating a qlconfig.yml file to tell the CLI which to use for each pack. Create a ~/.codeql/qlconfig.yml file on Linux/MacOS or %HOMEPATH%\.codeql\qlconfig.yml on ...
{ "source": "github-docs/code-security/how-tos/find-and-fix-code-vulnerabilities/scan-from-the-command-line/publish-and-use-packs.md", "title": "Publishing and using CodeQL packs" }
Setting up the To run commands, you need to set up the so that it can access the tools, queries, and libraries required to create and analyze databases. The supports a range of use cases and directory structures. This article walks through a simple setup that works for most users and environments. If you plan to us...
{ "source": "github-docs/code-security/how-tos/find-and-fix-code-vulnerabilities/scan-from-the-command-line/set-up-codeql-cli.md", "title": "Setting up the CodeQL CLI" }
Using a configuration file 1. Create and save a config file under your home (Linux and macOS) or user profile (Windows) directory in the .config/codeql/ subdirectory. For example, $HOME/.config/codeql/config. 1. In the config file, specify the options you want to apply to your commands. The syntax for specifying opti...
{ "source": "github-docs/code-security/how-tos/find-and-fix-code-vulnerabilities/scan-from-the-command-line/specify-command-options.md", "title": "Specifying command options in a CodeQL configuration file" }
Testing custom queries provides a simple test framework for automated regression testing of queries. Test your queries to ensure that they behave as expected. During a query test, compares the results the user expects the query to produce with those actually produced. If the expected and actual results differ, the qu...
{ "source": "github-docs/code-security/how-tos/find-and-fix-code-vulnerabilities/scan-from-the-command-line/test-custom-queries.md", "title": "Testing custom queries" }
Prerequisites The query help (.qhelp) files must have accompanying query (.ql) files with identical base names. The query help files should follow the standard structure and style for query help documentation. For more information, see the Query help style guide in the repository. Previewing your query help files 1...
{ "source": "github-docs/code-security/how-tos/find-and-fix-code-vulnerabilities/scan-from-the-command-line/test-query-help-files.md", "title": "Testing query help files" }
This article is specifically about writing queries to use with the AUTOTITLE command to produce interpreted results. For conceptual information about custom queries, see AUTOTITLE. Writing a valid query Before running a custom analysis you need to write a valid query, and save it in a file with a .ql extension. There ...
{ "source": "github-docs/code-security/how-tos/find-and-fix-code-vulnerabilities/scan-from-the-command-line/write-custom-queries.md", "title": "Writing custom queries for the CodeQL CLI" }
1. In , open the "Output" window. 1. Use the dropdown to select the log view you need. For example, " Extension Log". !Screenshot of the "Output" window in VS Code (as highlighted in dark orange). The dropdown is also highlighted, with "CodeQL Extension Log" selected.
{ "source": "github-docs/code-security/how-tos/find-and-fix-code-vulnerabilities/scan-from-vs-code/accessing-logs.md", "title": "Accessing logs for {% data variables.product.prodname_codeql %} in {% data variables.product.prodname_vscode %}" }
You can write custom queries to find specific issues relevant to your own project. This is optional, and the github/codeql repository contains a large number of example queries you can use instead. Creating a custom query You create a new query file from a template for a given language, which imports the standard lib...
{ "source": "github-docs/code-security/how-tos/find-and-fix-code-vulnerabilities/scan-from-vs-code/create-custom-query.md", "title": "Creating a custom query" }
About settings in the for extension You can change numerous settings for the for extension, including: Which version of the the extension uses. How the extension displays previous queries. How the extension runs queries. Editing settings for the extension 1. Open the "Extensions" view and right-click , then c...
{ "source": "github-docs/code-security/how-tos/find-and-fix-code-vulnerabilities/scan-from-vs-code/customize-settings.md", "title": "Customizing settings" }
Prerequisites To view the abstract syntax tree (AST) of a source file, you need to have an appropriate query (usually printAST.ql) in your workspace. If you do not have an appropriate query, you can update your copy of the github/codeql repository from the main branch. [!NOTE] Updating your repository may discard you...
{ "source": "github-docs/code-security/how-tos/find-and-fix-code-vulnerabilities/scan-from-vs-code/explore-code-structure.md", "title": "Exploring the structure of your source code" }
Prerequisites Before you can effectively use path queries, you should understand the basics of data flow analysis. See About data flow analysis in the documentation. Running path queries in locally 1. Open a path query in . A path query is a query with the property @kind path-problem. 1. Right-click in the window w...
{ "source": "github-docs/code-security/how-tos/find-and-fix-code-vulnerabilities/scan-from-vs-code/explore-data-flow.md", "title": "Exploring data flow with path queries" }
Prerequisites The extension requires a minimum of 1.82.0. Older versions are not supported. Installing the extension You can install the for extension using one of several different methods: Using the Marketplace in a browser. Searching in the "Extensions" view in . Using a VSIX file. Using the Marketplace 1...
{ "source": "github-docs/code-security/how-tos/find-and-fix-code-vulnerabilities/scan-from-vs-code/install-codeql-for-vs-code.md", "title": "Installing CodeQL for Visual Studio Code" }
The extension automatically installs a compatible version of the . This instance of the is not accessible from the terminal. If you already have the installed and added to your PATH, the extension will use that version. Installing version updates The extension checks for updates to the automatically and prompts yo...
{ "source": "github-docs/code-security/how-tos/find-and-fix-code-vulnerabilities/scan-from-vs-code/manage-codeql-cli.md", "title": "Managing the CodeQL CLI in the VS Code extension" }
About databases To analyze a project, you need to select a database for that project. You can select a database locally (from a ZIP archive or an unarchived folder), from a public URL, or from a project's URL on . Alternatively, you can create a database using the , see AUTOTITLE. Downloading a database from store...
{ "source": "github-docs/code-security/how-tos/find-and-fix-code-vulnerabilities/scan-from-vs-code/manage-codeql-databases.md", "title": "Managing CodeQL databases" }
Downloading query packs 1. In , open the and run : Download Packs. 1. You can download all the core query packs, or enter the full name of a specific pack to download. You can download query packs created by other users. Installing dependencies for query packs 1. In , open the and run : Install Pack Dependencies. ...
{ "source": "github-docs/code-security/how-tos/find-and-fix-code-vulnerabilities/scan-from-vs-code/managing-codeql-packs.md", "title": "Managing CodeQL query packs and library packs" }
With multi-repository variant analysis (MRVA), you can run queries on a list of up to 1,000 repositories on from . Prerequisites You need to enable using on , using either default setup or advanced setup, before adding your repository to a list for analysis. For information about enabling using , see AUTOTITLE. ...
{ "source": "github-docs/code-security/how-tos/find-and-fix-code-vulnerabilities/scan-from-vs-code/run-queries-at-scale.md", "title": "Running CodeQL queries at scale with multi-repository variant analysis" }
About running queries The github/codeql repository contains a large number of example queries. You can access any existing queries in your workspace through the "Queries" view. Prerequisites To analyze a codebase, you run queries against a database extracted from the code, so you'll need to select a database to work...
{ "source": "github-docs/code-security/how-tos/find-and-fix-code-vulnerabilities/scan-from-vs-code/running-codeql-queries.md", "title": "Running CodeQL queries" }
Setting up a workspace There are several different ways to give the extension access to the standard libraries and queries from the github/codeql repository: Use the starter workspace, which contains a series of directories named in the format codeql-custom-queries-LANGUAGE. These are ready for you to start developi...
{ "source": "github-docs/code-security/how-tos/find-and-fix-code-vulnerabilities/scan-from-vs-code/set-up-codeql-workspace.md", "title": "Setting up a CodeQL workspace" }
About testing queries in To ensure that your queries produce the expected results, you can run tests that compare the expected query results with the actual results. The extension automatically registers itself with the "Testing" view. This view displays all tests found in your current workspace and provides a UI fo...
{ "source": "github-docs/code-security/how-tos/find-and-fix-code-vulnerabilities/scan-from-vs-code/testing-codeql-queries-in-vs-code.md", "title": "Testing CodeQL queries in Visual Studio Code" }
About the model editor With model packs, you can expand your analysis to recognize custom libraries and frameworks used by your codebase that are not supported by default. With the model editor, you can create your own model packs. The model editor guides you through modeling the calls to external dependencies in ...
{ "source": "github-docs/code-security/how-tos/find-and-fix-code-vulnerabilities/scan-from-vs-code/use-the-model-editor.md", "title": "Using the CodeQL model editor" }
Disabling for your repository 1. In the sidebar, under , click to display the "" page. 1. Under analysis, toggle from On to Off. This stops all future scans, and the billing they generate, for that repository. Disabling for an organization Disabling at the organization level turns off across your organization in...
{ "source": "github-docs/code-security/how-tos/maintain-quality-code/disable-code-quality.md", "title": "Disabling {% data variables.product.prodname_code_quality %}" }
You can enable for a single repository, or for every repository in an organization at once. Enabling at the organization level gives all your teams a consistent quality baseline with a single change, while enabling per repository lets you target specific projects or roll out gradually. Prerequisites An enterprise ow...
{ "source": "github-docs/code-security/how-tos/maintain-quality-code/enable-code-quality.md", "title": "Enabling {% data variables.product.prodname_code_quality %}" }
Prerequisites If your organization belongs to an enterprise, an enterprise owner must enable for your organization. See AUTOTITLE. Your organization must have repositories with enabled. See AUTOTITLE. Viewing code quality insights for your organization 1. On , navigate to the main page of your organization. For ex...
{ "source": "github-docs/code-security/how-tos/maintain-quality-code/explore-code-quality.md", "title": "Exploring GitHub Code Quality results in your organization" }
[!TIP] If you're new to , see AUTOTITLE for a guided walkthrough of reviewing and improving your repository's quality scores. How works on your default branch scans your default branch and reports findings on "" pages on the tab of your repository. It runs two types of analysis. 1. : uses to perform a determinis...
{ "source": "github-docs/code-security/how-tos/maintain-quality-code/fix-backlog-findings.md", "title": "Fixing code quality findings in your repository backlog" }
[!TIP] If you're new to , see AUTOTITLE for a guided walkthrough of reviewing and improving your repository's quality scores. How analyzes recently merged files runs an AI-powered scan on recently changed files after code is merged to your default branch. This scan uses a large language model to report up to findi...
{ "source": "github-docs/code-security/how-tos/maintain-quality-code/fix-findings-in-recent-merges.md", "title": "Fixing code quality findings in recently merged files" }
[!TIP] If you're new to , see AUTOTITLE for a guided walkthrough of how works on pull requests. How works on pull requests When you open a pull request, runs two types of analysis and posts findings as comments on the pull request. 1. findings: uses to perform a rule-based scan of your changes. These findings a...
{ "source": "github-docs/code-security/how-tos/maintain-quality-code/fix-findings-on-a-pr.md", "title": "Fixing code quality findings on a pull request" }
Prerequisites is enabled, see AUTOTITLE. Viewing the full backlog of code quality results Alternatively, if you want to view AI-powered findings for the most recently changed files, see AUTOTITLE. Exploring the backlog for your repository The "" dashboard shows all the results found by analysis on the default bran...
{ "source": "github-docs/code-security/how-tos/maintain-quality-code/interpret-results.md", "title": "Interpreting the code quality results for your repository" }
[!NOTE] This feature is in and subject to change. Prerequisites is enabled on the repository. Code coverage data is uploaded to for the pull request branch. See AUTOTITLE. Creating a coverage threshold rule 1. Create a new branch ruleset or click an existing one to edit it. 1. Under "Branch rules", select Restr...
{ "source": "github-docs/code-security/how-tos/maintain-quality-code/restrict-code-coverage.md", "title": "Setting code coverage thresholds for pull requests" }
Turning on everywhere at once means every team starts seeing findings on their pull requests on the same day, which can be surprising and disruptive. In this tutorial, you'll learn how to roll it out in phases: introduce findings to a small group first, calibrate your thresholds, and then expand. You'll prove the val...
{ "source": "github-docs/code-security/how-tos/maintain-quality-code/roll-out-at-scale.md", "title": "Rolling out {% data variables.product.prodname_code_quality %} at scale" }
You can block pull requests that don't meet your code quality standards by adding thresholds to a ruleset. If a pull request doesn't meet a threshold, it can't be merged. You can set thresholds for: findings, by the lowest severity of results you require to be resolved. Code coverage, by the minimum percentage of c...
{ "source": "github-docs/code-security/how-tos/maintain-quality-code/set-pr-thresholds.md", "title": "Setting code quality thresholds for pull requests" }
You can set up code coverage for your repository in two ways: Automatic setup: Use the AI-powered agent to generate a workflow automatically. Choose this option if: You want to get started quickly without writing YAML configuration. Your project uses common test frameworks and build patterns. You're comfortab...
{ "source": "github-docs/code-security/how-tos/maintain-quality-code/set-up-code-coverage.md", "title": "Setting up code coverage for your repository" }
Understanding why your pull request is blocked Repository administrators and organization owners can set quality gates using . When you open a pull request, checks automatically run to evaluate your changes against these standards. There are two types of blocks: Code quality findings: your changes introduce issues tha...
{ "source": "github-docs/code-security/how-tos/maintain-quality-code/unblock-your-pr.md", "title": "Resolving a block on your pull request" }
Knowing what costs, and which levers you can pull, lets you justify the spend before you roll it out, and keep it predictable afterward. This article covers where charges come from, where to watch your usage, and how to bring costs down. How you're charged for usage adds up from three types of cost across your orga...
{ "source": "github-docs/code-security/how-tos/maintain-quality-code/view-and-manage-cost.md", "title": "Viewing and managing {% data variables.product.prodname_code_quality %} costs" }
Prerequisites Code coverage is configured for your repository. See AUTOTITLE. Reading the coverage summary comment After code coverage is configured for your repository, the posts a coverage summary comment on each pull request. The comment includes: Branch-vs-default-branch comparison: The aggregate coverage perce...
{ "source": "github-docs/code-security/how-tos/maintain-quality-code/view-coverage-on-prs.md", "title": "Viewing code coverage on pull requests" }