跳至主要内容

保护你的仓库

Copilot Chat 可以帮助您保护仓库和代码。

配置关键安全功能

示例情景

假设您最近为一个新 Web 应用创建了仓库,您想要对其进行安全保护,但不知道从何入手。

Copilot Chat 可以引导您配置最关键的安全功能,以确保您的仓库保持安全。

示例提示

Copilot 提示
Provide step-by-step instructions on how to enable the following essential security features in my GitHub repository:

* Secret scanning
* Push protection
* Dependabot alerts
* Dependabot security updates
* Branch protection rules, including enforced code reviews before merging

Explain why each feature is important and how it helps secure my repository.

示例回复

Copilot Chat 提供每个安全功能的信息,并解释如何启用它们。

Why it's important:

Secret scanning automatically detects accidentally committed secrets (API keys, credentials, etc.) in your repository.

How it helps:

Leaked secrets can allow attackers to access systems, steal data, or cause other harm. Early detection prevents misuse.

How to Enable:

1. Go to your repository on GitHub.
1. Click on Settings.
1. In the left sidebar, click Code security.
1. Scroll to Secret scanning.
1. Ensure "Secret scanning" and "Push protection" are both enabled.
1. If not, click Enable.

通过安全策略鼓励安全贡献和最佳实践

示例情景

假设您想公开分享您的项目,并制定一份明确的安全策略,以指导用户如何安全地报告在您的仓库中发现的漏洞。

Copilot Chat 可以为您的仓库编写安全策略。

示例提示

Copilot 提示
Write a GitHub security policy (SECURITY.md) for my repository. The policy should include:

* A clear description of how users can report security vulnerabilities.
* A response timeline for security issues.
* Guidelines for responsible disclosure.
* Supported versions of the software.

Format it as a well-structured Markdown document.

示例输出

Copilot Chat 会生成一个 SECURITY.md 文件,您可以将其提交到仓库中。

# Security Policy

Thank you for helping to keep this project and its users secure! This document outlines the security policy and responsible disclosure guidelines for this repository.

## Reporting a Vulnerability

If you discover a security vulnerability, please report it by emailing **security@yourdomain.com** or by using the GitHub [security advisories](https://github.com/octocat/octocat-repo/security/advisories) feature.
**Do not** report security vulnerabilities via public GitHub issues or pull requests.

When reporting a vulnerability, please include as much information as possible to help us understand and reproduce the issue:
- A clear description of the vulnerability.
- Steps to reproduce the issue.
- Any relevant logs, screenshots, or proof-of-concept code.
- Your assessment of the potential impact.

## Response Timeline

We take security issues seriously and will respond according to the following guidelines:
- **Acknowledgment:** We will acknowledge receipt of your report within **3 business days**.
- **Investigation:** We will investigate and assess the report as quickly as possible, usually within **7 business days**.
- **Resolution:** Once a fix is identified, we will work to release a security update promptly. We will coordinate with you as needed, especially if you are the reporter.
- **Disclosure:** We will notify the community of the vulnerability and fix via a GitHub security advisory, and credit the reporter as appropriate.

## Responsible Disclosure Guidelines

To protect users of this project, we ask that you:
- Avoid public disclosure of the vulnerability until it has been investigated and patched.
- Allow us a reasonable amount of time to resolve the issue before any public disclosure.
- Provide relevant details privately (see "Reporting a Vulnerability" above).
- Act in good faith and avoid exploiting the vulnerability beyond what is necessary for your report.

We are committed to working with security researchers and the community to ensure a safe and secure software ecosystem.

延伸阅读

© . This site is unofficial and not affiliated with GitHub, Inc.