Конечные точки REST API для защиты от принудительной проверки секретов
Используйте REST API для управления защитой от принудительной отправки секретов.
List enterprise pattern configurations
Lists the secret scanning pattern configurations for an enterprise.
Personal access tokens (classic) need the admin:enterprise scope to use this endpoint.
Подробные маркеры доступа для "List enterprise pattern configurations
Эта конечная точка не работает с маркерами доступа пользователей приложения GitHub, маркерами доступа к установке приложения GitHub или точными личными маркерами доступа.
Параметры для "List enterprise pattern configurations"
| Имя., Тип, Description | 
|---|
| acceptstringSetting to  | 
| Имя., Тип, Description | 
|---|
| enterprisestring Обязательное полеThe slug version of the enterprise name. | 
Коды состояния http-ответа для "List enterprise pattern configurations"
| Код состояния | Описание | 
|---|---|
| 200 | OK | 
| 403 | Forbidden | 
| 404 | Resource not found | 
Примеры кода для "List enterprise pattern configurations"
Если вы обращаетесь к GitHub в GHE.com, замените api.github.com выделенный поддомен api.SUBDOMAIN.ghe.comпредприятия.
Пример запроса
curl -L \
  -H "Accept: application/vnd.github+json" \
  -H "Authorization: Bearer <YOUR-TOKEN>" \
  -H "X-GitHub-Api-Version: 2022-11-28" \
  https://api.github.com/enterprises/ENTERPRISE/secret-scanning/pattern-configurationsResponse
Status: 200{
  "pattern_config_version": "0ujsswThIGTUYm2K8FjOOfXtY1K",
  "provider_pattern_overrides": [
    {
      "token_type": "GITHUB_PERSONAL_ACCESS_TOKEN",
      "slug": "github_personal_access_token_legacy_v2",
      "display_name": "GitHub Personal Access Token (Legacy v2)",
      "alert_total": 15,
      "alert_total_percentage": 36,
      "false_positives": 2,
      "false_positive_rate": 13,
      "bypass_rate": 13,
      "default_setting": "enabled",
      "setting": "enabled",
      "enterprise_setting": "enabled"
    }
  ],
  "custom_pattern_overrides": [
    {
      "token_type": "cp_2",
      "custom_pattern_version": "0ujsswThIGTUYm2K8FjOOfXtY1K",
      "slug": "custom-api-key",
      "display_name": "Custom API Key",
      "alert_total": 15,
      "alert_total_percentage": 36,
      "false_positives": 3,
      "false_positive_rate": 20,
      "bypass_rate": 20,
      "default_setting": "disabled",
      "setting": "enabled"
    }
  ]
}Update enterprise pattern configurations
Updates the secret scanning pattern configurations for an enterprise.
Personal access tokens (classic) need the admin:enterprise scope to use this endpoint.
Подробные маркеры доступа для "Update enterprise pattern configurations
Эта конечная точка не работает с маркерами доступа пользователей приложения GitHub, маркерами доступа к установке приложения GitHub или точными личными маркерами доступа.
Параметры для "Update enterprise pattern configurations"
| Имя., Тип, Description | 
|---|
| acceptstringSetting to  | 
| Имя., Тип, Description | 
|---|
| enterprisestring Обязательное полеThe slug version of the enterprise name. | 
| Имя., Тип, Description | ||||
|---|---|---|---|---|
| pattern_config_versionstring or nullThe version of the entity. This is used to confirm you're updating the current version of the entity and mitigate unintentionally overriding someone else's update. | ||||
| provider_pattern_settingsarray of objectsPattern settings for provider patterns. | ||||
| Properties of  | 
| Имя., Тип, Description | 
|---|
| token_typestringThe ID of the pattern to configure. | 
| push_protection_settingstringPush protection setting to set for the pattern. Возможные значения:  | 
custom_pattern_settings array of objects Pattern settings for custom patterns.
Properties of custom_pattern_settings
| Имя., Тип, Description | 
|---|
| token_typestringThe ID of the pattern to configure. | 
| custom_pattern_versionstring or nullThe version of the entity. This is used to confirm you're updating the current version of the entity and mitigate unintentionally overriding someone else's update. | 
| push_protection_settingstringPush protection setting to set for the pattern. Возможные значения:  | 
Коды состояния http-ответа для "Update enterprise pattern configurations"
| Код состояния | Описание | 
|---|---|
| 200 | OK | 
| 400 | Bad Request | 
| 403 | Forbidden | 
| 404 | Resource not found | 
| 409 | Conflict | 
| 422 | Validation failed, or the endpoint has been spammed. | 
Примеры кода для "Update enterprise pattern configurations"
Если вы обращаетесь к GitHub в GHE.com, замените api.github.com выделенный поддомен api.SUBDOMAIN.ghe.comпредприятия.
Пример запроса
curl -L \
  -X PATCH \
  -H "Accept: application/vnd.github+json" \
  -H "Authorization: Bearer <YOUR-TOKEN>" \
  -H "X-GitHub-Api-Version: 2022-11-28" \
  https://api.github.com/enterprises/ENTERPRISE/secret-scanning/pattern-configurations \
  -d '{"pattern_config_version":"0ujsswThIGTUYm2K8FjOOfXtY1K","provider_pattern_settings":[{"token_type":"GITHUB_PERSONAL_ACCESS_TOKEN","push_protection_setting":"enabled"}],"custom_pattern_settings":[{"token_type":"cp_2","custom_pattern_version":"0ujsswThIGTUYm2K8FjOOfXtY1K","push_protection_setting":"enabled"}]}'Response
Status: 200{
  "pattern_config_version": "0ujsswThIGTUYm2K8FjOOfXtY1K"
}List organization pattern configurations
Lists the secret scanning pattern configurations for an organization.
Personal access tokens (classic) need the read:org scope to use this endpoint.
Подробные маркеры доступа для "List organization pattern configurations
Эта конечная точка работает со следующими точными типами маркеров:
- Маркеры доступа пользователей приложения GitHub
- Маркеры доступа к установке приложений GitHub
- Точные личные маркеры доступа
Маркер с точной детализацией должен иметь следующий набор разрешений.:
- "Administration" organization permissions (read)
Параметры для "List organization pattern configurations"
| Имя., Тип, Description | 
|---|
| acceptstringSetting to  | 
| Имя., Тип, Description | 
|---|
| orgstring Обязательное полеThe organization name. The name is not case sensitive. | 
Коды состояния http-ответа для "List organization pattern configurations"
| Код состояния | Описание | 
|---|---|
| 200 | OK | 
| 403 | Forbidden | 
| 404 | Resource not found | 
Примеры кода для "List organization pattern configurations"
Если вы обращаетесь к GitHub в GHE.com, замените api.github.com выделенный поддомен api.SUBDOMAIN.ghe.comпредприятия.
Пример запроса
curl -L \
  -H "Accept: application/vnd.github+json" \
  -H "Authorization: Bearer <YOUR-TOKEN>" \
  -H "X-GitHub-Api-Version: 2022-11-28" \
  https://api.github.com/orgs/ORG/secret-scanning/pattern-configurationsResponse
Status: 200{
  "pattern_config_version": "0ujsswThIGTUYm2K8FjOOfXtY1K",
  "provider_pattern_overrides": [
    {
      "token_type": "GITHUB_PERSONAL_ACCESS_TOKEN",
      "slug": "github_personal_access_token_legacy_v2",
      "display_name": "GitHub Personal Access Token (Legacy v2)",
      "alert_total": 15,
      "alert_total_percentage": 36,
      "false_positives": 2,
      "false_positive_rate": 13,
      "bypass_rate": 13,
      "default_setting": "enabled",
      "setting": "enabled",
      "enterprise_setting": "enabled"
    }
  ],
  "custom_pattern_overrides": [
    {
      "token_type": "cp_2",
      "custom_pattern_version": "0ujsswThIGTUYm2K8FjOOfXtY1K",
      "slug": "custom-api-key",
      "display_name": "Custom API Key",
      "alert_total": 15,
      "alert_total_percentage": 36,
      "false_positives": 3,
      "false_positive_rate": 20,
      "bypass_rate": 20,
      "default_setting": "disabled",
      "setting": "enabled"
    }
  ]
}Update organization pattern configurations
Updates the secret scanning pattern configurations for an organization.
Personal access tokens (classic) need the write:org scope to use this endpoint.
Подробные маркеры доступа для "Update organization pattern configurations
Эта конечная точка работает со следующими точными типами маркеров:
- Маркеры доступа пользователей приложения GitHub
- Маркеры доступа к установке приложений GitHub
- Точные личные маркеры доступа
Маркер с точной детализацией должен иметь следующий набор разрешений.:
- "Administration" organization permissions (write)
Параметры для "Update organization pattern configurations"
| Имя., Тип, Description | 
|---|
| acceptstringSetting to  | 
| Имя., Тип, Description | 
|---|
| orgstring Обязательное полеThe organization name. The name is not case sensitive. | 
| Имя., Тип, Description | ||||
|---|---|---|---|---|
| pattern_config_versionstring or nullThe version of the entity. This is used to confirm you're updating the current version of the entity and mitigate unintentionally overriding someone else's update. | ||||
| provider_pattern_settingsarray of objectsPattern settings for provider patterns. | ||||
| Properties of  | 
| Имя., Тип, Description | 
|---|
| token_typestringThe ID of the pattern to configure. | 
| push_protection_settingstringPush protection setting to set for the pattern. Возможные значения:  | 
custom_pattern_settings array of objects Pattern settings for custom patterns.
Properties of custom_pattern_settings
| Имя., Тип, Description | 
|---|
| token_typestringThe ID of the pattern to configure. | 
| custom_pattern_versionstring or nullThe version of the entity. This is used to confirm you're updating the current version of the entity and mitigate unintentionally overriding someone else's update. | 
| push_protection_settingstringPush protection setting to set for the pattern. Возможные значения:  | 
Коды состояния http-ответа для "Update organization pattern configurations"
| Код состояния | Описание | 
|---|---|
| 200 | OK | 
| 400 | Bad Request | 
| 403 | Forbidden | 
| 404 | Resource not found | 
| 409 | Conflict | 
| 422 | Validation failed, or the endpoint has been spammed. | 
Примеры кода для "Update organization pattern configurations"
Если вы обращаетесь к GitHub в GHE.com, замените api.github.com выделенный поддомен api.SUBDOMAIN.ghe.comпредприятия.
Пример запроса
curl -L \
  -X PATCH \
  -H "Accept: application/vnd.github+json" \
  -H "Authorization: Bearer <YOUR-TOKEN>" \
  -H "X-GitHub-Api-Version: 2022-11-28" \
  https://api.github.com/orgs/ORG/secret-scanning/pattern-configurations \
  -d '{"pattern_config_version":"0ujsswThIGTUYm2K8FjOOfXtY1K","provider_pattern_settings":[{"token_type":"GITHUB_PERSONAL_ACCESS_TOKEN","push_protection_setting":"enabled"}],"custom_pattern_settings":[{"token_type":"cp_2","custom_pattern_version":"0ujsswThIGTUYm2K8FjOOfXtY1K","push_protection_setting":"enabled"}]}'Response
Status: 200{
  "pattern_config_version": "0ujsswThIGTUYm2K8FjOOfXtY1K"
}