title | intro | permissions | redirect_from | versions | type | topics | shortTitle | |||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Quickstart for securing your repository |
You can use a number of {% data variables.product.prodname_dotcom %} features to help keep your repository secure. |
{% data reusables.permissions.security-repo-enable %} |
|
|
how_to |
|
Secure repository quickstart |
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 "AUTOTITLE."
{% data reusables.advanced-security.security-feature-availability %}
The first step to securing a repository is to establish who can see and modify your code. For more information, see "AUTOTITLE."
From the main page of your repository, click {% octicon "gear" aria-hidden="true" %} Settings, then scroll down to the "Danger Zone."
- To change who can view your repository, click Change visibility. For more information, see "AUTOTITLE."
- To change who can access your repository and adjust permissions, click Manage access. For more information, see"AUTOTITLE."
{% ifversion fpt or ghec %} {% data reusables.dependency-graph.feature-availability %} The dependency graph interprets manifest and lock files in a repository to identify dependencies.
- From the main page of your repository, click {% octicon "gear" aria-hidden="true" %} Settings.
- In the "Security" section of the sidebar, click {% octicon "codescan" aria-hidden="true" %} Code security.
- Next to Dependency graph, click Enable or Disable. {% endif %}
{% data reusables.dependabot.dependabot-alerts-dependency-graph-enterprise %}
For more information, see "AUTOTITLE."
{% data variables.product.prodname_dependabot_alerts %} are generated when {% data variables.product.prodname_dotcom %} identifies a dependency in the dependency graph with a vulnerability. {% ifversion fpt or ghec %}You can enable {% data variables.product.prodname_dependabot_alerts %} for any repository.{% endif %}
{% ifversion dependabot-auto-triage-rules %}
{% data reusables.dependabot.dependabot-alert-rules %}
{% endif %}
{% data reusables.dependabot.quickstart-link %}
{% ifversion fpt or ghec %}
- Click your profile photo, then click {% octicon "gear" aria-hidden="true" %} Settings.
- In the "Security" section of the sidebar, click {% octicon "shield" aria-hidden="true" %} Code security.
- Click Enable all next to {% data variables.product.prodname_dependabot_alerts %}. {% endif %}
{% ifversion dependabot-alerts-ghes-enablement %} {% data reusables.dependabot.dependabot-alerts-enterprise-server-repo-org-enablement %} {% else %} {% data reusables.dependabot.dependabot-alerts-dependency-graph-enterprise %} {% endif %}
For more information, see "AUTOTITLE{% ifversion fpt or ghec %}" and "AUTOTITLE{% endif %}."
Dependency review lets you visualize dependency changes in pull requests before they are merged into your repositories. For more information, see "AUTOTITLE."
Dependency review is a {% data variables.product.prodname_GH_advanced_security %} feature. {% ifversion fpt or ghec %}Dependency review is already enabled for all public repositories. {% ifversion fpt %}Organizations that use {% data variables.product.prodname_ghe_cloud %} with {% data variables.product.prodname_advanced_security %} can additionally enable dependency review for private and internal repositories. For more information, see the {% data variables.product.prodname_ghe_cloud %} documentation. {% endif %}{% endif %}{% ifversion ghec or ghes %}To enable dependency review for a {% ifversion ghec %}private or internal {% endif %}repository, ensure that the dependency graph is enabled and enable {% data variables.product.prodname_GH_advanced_security %}.
- From the main page of your repository, click {% octicon "gear" aria-hidden="true" %} Settings.
- In the "Security" section of the sidebar, click {% octicon "codescan" aria-hidden="true" %} Code security.
- {% ifversion ghec %}If dependency graph is not already enabled, click Enable.{% elsif ghes %}Check that dependency graph is configured for your enterprise.{% endif %}
- If {% data variables.product.prodname_GH_advanced_security %} is not already enabled, click Enable.
{% endif %}
For any repository that uses {% data variables.product.prodname_dependabot_alerts %}, you can enable {% data variables.product.prodname_dependabot_security_updates %} to raise pull requests with security updates when vulnerabilities are detected.
- From the main page of your repository, click {% octicon "gear" aria-hidden="true" %} Settings.
- In the "Security" section of the sidebar, click {% octicon "codescan" aria-hidden="true" %} Code security.
- Next to {% data variables.product.prodname_dependabot_security_updates %}, click Enable.
For more information, see "AUTOTITLE" and "AUTOTITLE."
You can enable {% data variables.product.prodname_dependabot %} to automatically raise pull requests to keep your dependencies up-to-date. For more information, see "AUTOTITLE."
{% ifversion dependabot-settings-update-37 %}
- From the main page of your repository, click {% octicon "gear" aria-hidden="true" %} Settings.
- In the "Security" section of the sidebar, click {% octicon "codescan" aria-hidden="true" %} Code security.
- Next to {% data variables.product.prodname_dependabot_version_updates %}, click Enable to create a basic
dependabot.yml
configuration file. - Specify the dependencies to update and any associated configuration options, then commit the file to the repository. For more information, see "AUTOTITLE."
{% else %}
To enable {% data variables.product.prodname_dependabot_version_updates %}, you must create a dependabot.yml
configuration file. For more information, see "AUTOTITLE."
{% endif %}
Note
{% data variables.product.prodname_code_scanning_caps %} is available {% ifversion fpt or ghec %}for all public repositories, and for private repositories owned by organizations that are part of an enterprise with a license for {% else %}for organization-owned repositories if your enterprise uses {% endif %}{% data variables.product.prodname_GH_advanced_security %}.
You can configure {% data variables.product.prodname_code_scanning %} to automatically identify vulnerabilities and errors in the code stored in your repository by using a {% data variables.code-scanning.codeql_workflow %} or third-party tool. Depending on the programming languages in your repository, you can configure {% data variables.product.prodname_code_scanning %} with {% data variables.product.prodname_codeql %} using default setup, in which {% data variables.product.prodname_dotcom %} automatically determines the languages to scan, query suites to run, and events that will trigger a new scan. For more information, see "AUTOTITLE."
- From the main page of your repository, click {% octicon "gear" aria-hidden="true" %} Settings.
- In the "Security" section of the sidebar, click {% octicon "codescan" aria-hidden="true" %} Code security.
- In the "{% data variables.product.prodname_code_scanning_caps %}" section, select Set up {% octicon "triangle-down" aria-hidden="true" %}, then click Default.
- In the pop-up window that appears, review the default configuration settings for your repository, then click Enable {% data variables.product.prodname_codeql %}.
Alternatively, you can use advanced setup, which generates a workflow file you can edit to customize your {% data variables.product.prodname_code_scanning %} with {% data variables.product.prodname_codeql %}. For more information, see "AUTOTITLE."
{% data reusables.gated-features.secret-scanning %}
- From the main page of your repository, click {% octicon "gear" aria-hidden="true" %} Settings.
- In the "Security" section of the sidebar, click {% octicon "codescan" aria-hidden="true" %} Code security. {% ifversion ghec or ghes %}
- If {% data variables.product.prodname_GH_advanced_security %} is not already enabled, click Enable.{% endif %}
- Next to {% data variables.product.prodname_secret_scanning_caps %}, click Enable.
If you are a repository maintainer, it's good practice to specify a security policy for your repository by creating a file named SECURITY.md
in the repository. This file instructs users about how to best contact you and collaborate with you when they want to report security vulnerabilities in your repository. You can view the security policy of a repository from the repository’s Security tab.
- From the main page of your repository, click {% octicon "shield" aria-hidden="true" %} Security.
- In the "Reporting" section of the sidebar, click {% octicon "law" aria-hidden="true" %} Policy.
- Click Start setup.
- Add information about supported versions of your project and how to report vulnerabilities.
For more information, see "AUTOTITLE."
You can view and manage alerts from security features to address dependencies and vulnerabilities in your code. For more information, see "AUTOTITLE," "AUTOTITLE," "AUTOTITLE," and "AUTOTITLE".
You can also use {% data variables.product.prodname_dotcom %}'s tools to audit responses to security alerts. For more information, see "AUTOTITLE".
{% ifversion fpt or ghec %}If you have a security vulnerability in a public repository, you can create a security advisory to privately discuss and fix the vulnerability. For more information, see "AUTOTITLE" and "AUTOTITLE." {% endif %}
{% data reusables.security-overview.security-information-about-actions %}