Skip to main content

Adding a security policy to your repository

You can give instructions for how to report a security vulnerability in your project by adding a security policy to your repository.

About security policies

To give people instructions for reporting security vulnerabilities in your project, you can add a SECURITY.md file to your repository's root, docs, or .github folder. When someone creates an issue in your repository, they will see a link to your project's security policy.

You can create a default security policy for your organization or personal account. For more information, see "Creating a default community health file."

Tip: To help people find your security policy, you can link to your SECURITY.md file from other places in your repository, such as your README file. For more information, see "About READMEs."

After someone reports a security vulnerability in your project, you can use GitHub Security Advisories to disclose, fix, and publish information about the vulnerability. For more information about the process of reporting and disclosing vulnerabilities in GitHub, see "About coordinated disclosure of security vulnerabilities." For more information about repository security advisories, see "About repository security advisories."

还可加入 GitHub Security Lab,以浏览与安全相关的主题,并为安全工具和项目做出贡献。

Adding a security policy to your repository

  1. On GitHub.com, navigate to the main page of the repository.

  2. 在存储库名称下,单击“ 安全性”。 “安全”选项卡

  3. In the left sidebar, click Security policy. Security policy tab

  4. Click Start setup. Start setup button

  5. In the new SECURITY.md file, add information about supported versions of your project and how to report a vulnerability.

  6. 在页面底部,输入一条简短、有意义的提交消息,描述您对文件所作的更改。 您可以在提交消息中将提交归于多个作者。 有关详细信息,请参阅“创建具有多个共同作者的提交”。 更改的提交消息

  7. If you have more than one email address associated with your account on GitHub.com, click the email address drop-down menu and select the email address to use as the Git author email address. Only verified email addresses appear in this drop-down menu. If you enabled email address privacy, then <username>@users.noreply.github.com is the default commit author email address. For more information, see "Setting your commit email address." Choose commit email addresses

  8. 在提交消息字段下面,确定是要将提交添加到当前分支还是新分支。 如果当前分支是默认分支,则应选择为提交创建新分支,然后创建拉取请求。 有关详细信息,请参阅“创建新的拉取请求”。 提交分支选项

  9. 单击“提议文件更改”。 提议文件更改按钮

Further reading