About GitHub's security features
GitHub provides many features to make your code more secure. You can use GitHub's built-in features to understand the actions your workflows depend on, ensure you are notified about vulnerabilities in the actions you consume, or automate the process of keeping the actions in your workflows up to date. If you publish and maintain actions, you can use GitHub to communicate with your community about vulnerabilities and how to fix them. For more information about security features that GitHub offers, see Функции безопасности GitHub.
This article will explain how you can use some of GitHub's security features to increase the security of your use of GitHub Actions.
Understanding dependencies in your workflows
You can use the dependency graph to explore the actions that the workflows in your repository use. The dependency graph is a summary of the manifest and lock files stored in a repository. It also recognizes files in ./github/workflows/
as manifests, which means that any actions or workflows referenced using the syntax jobs[*].steps[*].uses
or jobs.<job_id>.uses
will be parsed as dependencies.
The dependency graph shows the following information about actions used in workflows:
- The account or organization that owns the action.
- The workflow file that references the action.
- The version or SHA the action is pinned to.
In the dependency graph, dependencies are automatically sorted by vulnerability severity. If any of the actions you use have security advisories, they will display at the top of the list. You can navigate to the advisory from the dependency graph and access instructions for resolving the vulnerability.
The dependency graph is enabled for public repositories, and you can choose to enable it on private repositories. For more information about using the dependency graph, see Изучение зависимостей репозитория.
Being aware of security vulnerabilities in actions you use
For actions available on the marketplace, GitHub reviews related security advisories and then adds those advisories to the GitHub Advisory Database. You can search the database for actions that you use to find information about existing vulnerabilities and instructions for how to fix them. To streamline your search, use the GitHub Actions filter in the GitHub Advisory Database.
You can set up your repositories so that you:
- Receive alerts when actions used in your workflows receive a vulnerability report. For more information, see Monitoring the actions in your workflows.
- Are warned about existing advisories when you add or update an action in a workflow. For more information, see Screening actions for vulnerabilities in new or updated workflows.
Monitoring the actions in your workflows
You can use Dependabot to monitor the actions in your workflows and enable Dependabot alerts to notify you when an action you use has a reported vulnerability. Dependabot performs a scan of the default branch of the repositories where it is enabled to detect insecure dependencies. Dependabot generates Dependabot alerts when a new advisory is added to the GitHub Advisory Database or when an action you use is updated.
Примечание.
Dependabot only creates alerts for vulnerable actions that use semantic versioning and will not create alerts for actions pinned to SHA values.
You can enable Dependabot alerts for your personal account, for a repository, or for an organization. For more information, see Настройка оповещений Dependabot.
Вы можете просмотреть все открытые и закрытые Dependabot alerts и соответствующие Dependabot security updates на вкладке Dependabot alerts в репозитории. For more information, see Просмотр и обновление оповещений Dependabot.
Screening actions for vulnerabilities in new or updated workflows
When you open pull requests to update your workflows, it is good practice to use dependency review to understand the security impact of changes you've made to the actions you use. Проверка зависимостей помогает разобраться в изменениях зависимостей и понять их влияние на безопасность в каждом запросе на вытягивание. Она обеспечивает легко понятную визуализацию изменений зависимостей с широкими возможностями на вкладке "Измененные файлы" запроса на вытягивание. Функция проверки зависимостей позволяет получить следующую информацию:
- Какие зависимости были добавлены, удалены или обновлены вместе с датами выпуска
- Сколько проектов использует эти компоненты
- Данные уязвимости для этих зависимостей
If any of the changes you made to your workflows are flagged as vulnerable, you can avoid adding them to your project or update them to a secure version.
For more information about dependency review, see Сведения о проверке зависимостей.
"Действие проверки зависимостей" ссылается на конкретное действие, которое может сообщать о различиях в запросе на вытягивание в контексте GitHub Actions. См. раздел dependency-review-action
. Вы можете использовать переменные данных Действие проверки зависимостей в репозитории для принудительного применения проверок зависимостей в запросах на вытягивание. Это действие проверяет наличие уязвимых версий зависимостей, представленных изменениями версии пакета в запросах на вытягивание, и предупреждает о связанных с ними уязвимостях системы безопасности. Это позволяет лучше отслеживать изменения в запросе на вытягивание и предотвращать добавление уязвимостей в репозиторий. For more information, see Сведения о проверке зависимостей.
Keeping the actions in your workflows secure and up to date
Вы можете использовать Dependabot для обеспечения актуальности ссылок на действия и повторно используемые рабочие процессы, используемые в репозитории. Действия часто обновляются с помощью исправлений ошибок и новых функций, чтобы сделать автоматизированные процессы более быстрыми, безопасными и более надежными. Dependabot берет на себя усилия по поддержанию зависимостей, так как это делается автоматически. Дополнительные сведения см. в разделе [AUTOTITLE и Поддержка актуальности действий с помощью Dependabot](/code-security/dependabot/dependabot-security-updates/about-dependabot-security-updates).
The following features can automatically update the actions in your workflows.
- Dependabot version updates open pull requests to update actions to the latest version when a new version is released.
- Dependabot security updates open pull requests to update actions with reported vulnerabilities to the minimum patched version.
Примечание.
- Dependabot поддерживает только обновления GitHub Actions с помощью синтаксиса репозитория GitHub репозитория.
actions/checkout@v4
Dependabot игнорирует действия или повторно используемые рабочие процессы, на которые ссылается локально (например,./.github/actions/foo.yml
). - Docker Hub и GitHub Packages Container registry URL-адреса в настоящее время не поддерживаются. Например, ссылки на действия контейнера Docker с использованием
docker://
синтаксиса не поддерживаются. - Dependabot поддерживает общедоступные и частные репозитории для GitHub Actions. Параметры конфигурации частного реестра см. в разделе "
git
" в Справочник по параметрам зависимостей.
For information on how to configure Dependabot version updates, see Настройка обновлений версий Dependabot.
For information on how to configure Dependabot security updates, see Настройка обновлений для системы безопасности Dependabot.
Protecting actions you've created
GitHub enables collaboration between people who publish and maintain actions and vulnerability reporters in order to promote secure coding. Рекомендации по безопасности репозитория позволяют поддерживать общедоступные репозитории для частного обсуждения и устранения уязвимости безопасности в проекте. После совместной работы над исправлением разработчики репозиториев могут публиковать рекомендации по безопасности, чтобы сообщить об уязвимости системы безопасности сообществу проекта. Публикуя рекомендации по безопасности, разработчики репозитория упрощают для сообщества обновление зависимостей пакетов и ознакомление с последствиями уязвимостей системы безопасности.
If you are someone who maintains an action that is used in other projects, you can use the following GitHub features to enhance the security of the actions you've published.
- Use the dependants view in the Dependency graph to see which projects depend on your code. If you receive a vulnerability report, this will give you an idea of who you need to communicate with about the vulnerability and how to fix it. For more information, see Изучение зависимостей репозитория.
- Use repository security advisories to create a security advisory, privately collaborate to fix the vulnerability in a temporary private fork, and publish a security advisory to alert your community of the vulnerability once a patch is released. For more information, see Настройка отчетов о частных уязвимостях для репозитория and Создание рекомендаций по безопасности репозитория.