Introduction
This guide shows you how to configure security features for a repository. You must be a repository administrator or organization owner to configure security settings 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 "GitHub security features."
Some security features are only available for public repositories, and for private repositories owned by organizations with an Advanced Security license. For more information, see "About GitHub Advanced Security."
Managing access to your repository
The first step to securing a repository is to set up who can see and modify your code. For more information, see "Managing repository settings."
From the main page of your repository, click Settings, then scroll down to the "Danger Zone."
- To change who can view your repository, click Change visibility. For more information, see "Setting repository visibility."
- To change who can access your repository and adjust permissions, click Manage access. For more information, see"Managing teams and people with access to your repository."
Setting a security policy
- From the main page of your repository, click Security.
- Click Security policy.
- Click Start setup.
- Add information about supported versions of your project and how to report vulnerabilities.
For more information, see "Adding a security policy to your repository."
Managing the dependency graph
The dependency graph is automatically generated for all public repositories and you can choose to enable it for private repositories.
- From the main page of your repository, click Settings.
- Click Security & analysis.
- Next to Dependency graph, click Enable or Disable.
For more information, see "Exploring the dependencies of a repository."
Managing Dependabot alerts
By default, GitHub detects vulnerabilities in public repositories and generates Dependabot alerts. Dependabot alerts can also be enabled for private repositories.
- Click your profile photo, then click Settings.
- Click Security & analysis.
- Click Enable all next to Dependabot alerts.
For more information, see "About alerts for vulnerable dependencies" and "Managing security and analysis settings for your user account."
Managing dependency review
Dependency review lets you visualize dependency changes in pull requests before they are merged into your repository. Dependency review is available in all public repositories and in repositories owned by organizations with an Advanced Security license that have the dependency graph enabled. For more information, see "About dependency review."
Managing Dependabot security updates
For any repository that uses Dependabot alerts, you can enable Dependabot security updates to raise pull requests with security updates when vulnerabilities are detected.
- From the main page of your repository, click Settings.
- Click Security & analysis.
- Next to Dependabot security updates, click Enable.
For more information, see "About Dependabot security updates" and "Configuring Dependabot security updates."
Managing Dependabot version updates
You can enable Dependabot to automatically raise pull requests to keep your dependencies up-to-date. For more information, see "About Dependabot version updates."
To enable Dependabot version updates, you must create a dependabot.yml configuration file. For more information, see "Enabling and disabling version updates."
Configuring code scanning
Code scanning is available for all public repositories, and for private repositories owned by organizations with an Advanced Security license.
You can set up code scanning to automatically identify vulnerabilities and errors in the code stored in your repository by using a CodeQL analysis workflow or third-party tool. For more information, see "Setting up code scanning for a repository."
Configuring secret scanning
Secret scanning is available for all public repositories, and for private repositories owned by organizations with an Advanced Security license.
Secret scanning may be enabled for your repository by default depending upon your organization's settings.
- From the main page of your repository, click Settings.
- Click Security & analysis.
- If GitHub Advanced Security is not already enabled, click Enable.
- Next to Secret scanning, click Enable.
Next steps
You can view and manage alerts from security features to address dependencies and vulnerabilities in your code. For more information, see "Viewing and updating vulnerable dependencies in your repository," "Managing pull requests for dependency updates," "Managing code scanning for your repository," and "Managing alerts from secret scanning."
If you have a security vulnerability, you can create a security advisory to privately discuss and fix the vulnerability. For more information, see "About GitHub Security Advisories" and "Creating a security advisory."