github-community-projects / github-community-projects/safe-settings
Add support for org and repo level secret scanning and push protection
- Dominant language
- JavaScript
- Stars
- 921
- Forks
- 226
- Avg merge
- 18h 3m
- Merged PRs (30d)
- 14
Description
## Prerequisites:
Is the functionality available in the GitHub UI? If so, please provide a link to information about the feature.
- [Org Level Secret Scanning Push Protection](https://docs.github.com/en/enterprise-cloud@latest/code-security/secret-scanning/push-protection-for-repositories-and-organizations#enabling-secret-scanning-as-a-push-protection)
- [Repo Level Secret Scanning Push Protection](https://docs.github.com/en/enterprise-cloud@latest/code-security/secret-scanning/push-protection-for-repositories-and-organizations#enabling-secret-scanning-as-a-push-protection-for-a-repository)
Is the functionality available through the GitHub API? If the functionality is available, please provide links to the
API documentation (https://developer.github.com/v3/) as well as the Octokit documentation (https://octokit.github.io/).
- Under [security_and_analysis](https://docs.github.com/en/enterprise-cloud@latest/rest/repos/repos?apiVersion=2022-11-28#update-a-repository)
>Specify which security and analysis features to enable or disable for the repository.
>To use this parameter, you must have admin permissions for the repository or be an owner or security manager for the organization that owns the repository. For more information, see "Managing security managers in your organization."
>For example, to enable GitHub Advanced Security, use this data in the body of the PATCH request: `{ "security_and_analysis": {"advanced_security": { "status": "enabled" } } }`.
>You can check which security and analysis features are currently enabled by using a GET `/repos/{owner}/{repo}` request.
## New Feature
Github supports secrets scanning and [blocking push commits](https://docs.github.com/en/enterprise-cloud@latest/code-security/secret-scanning/push-protection-for-repositories-and-organizations#about-push-protection-for-repositories-and-organizations). It's possible to enable this org wide at `https://github.com/organizations/$ORG/settings/security_analysis` with the following flags
- `secret_scanning_new_repos: enabled`
- `secret_scanning_push_protection_new_repos: enabled`
adding these to safe-settings would prevent drift from repo admins disabling it in individual repos.
Contributor guide
Assessment
This issue has not been assessed yet.