Эта версия GitHub Enterprise Server была прекращена 2024-03-26. Исправления выпускаться не будут даже при критических проблемах безопасности. Для повышения производительности, повышения безопасности и новых функций выполните обновление до последней версии GitHub Enterprise Server. Чтобы получить справку по обновлению, обратитесь в службу поддержки GitHub Enterprise.
Конечные точки REST API для обеспечения безопасности и анализа корпоративного кода
Используйте REST API для управления функциями безопасности и анализа кода для вашего предприятия.
Get code security and analysis features for an enterprise
Gets code security and analysis settings for the specified enterprise.
The authenticated user must be an administrator of the enterprise in order to use this endpoint.
OAuth app tokens and personal access tokens (classic) need the admin:enterprise
scope to use this endpoint.
Параметры для "Get code security and analysis features for an enterprise"
Имя., Тип, Description |
---|
accept string Setting to |
Имя., Тип, Description |
---|
enterprise string Обязательное полеThe slug version of the enterprise name. You can also substitute this value with the enterprise id. |
Коды состояния http-ответа для "Get code security and analysis features for an enterprise"
Код состояния | Описание |
---|---|
200 | OK |
404 | Resource not found |
Примеры кода для "Get code security and analysis features for an enterprise"
Пример запроса
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
http(s)://HOSTNAME/api/v3/enterprises/ENTERPRISE/code_security_and_analysis
Response
Status: 200
{
"advanced_security_enabled_for_new_repositories": true,
"dependabot_alerts_enabled_for_new_repositories": true,
"secret_scanning_enabled_for_new_repositories": true,
"secret_scanning_push_protection_enabled_for_new_repositories": true,
"secret_scanning_push_protection_custom_link": "https://github.com/test-org/test-repo/blob/main/README.md"
}
Update code security and analysis features for an enterprise
Updates the settings for advanced security, secret scanning, and push protection for new repositories in an enterprise.
The authenticated user must be an administrator of the enterprise to use this endpoint.
OAuth app tokens and personal access tokens (classic) need the admin:enterprise
scope to use this endpoint.
Параметры для "Update code security and analysis features for an enterprise"
Имя., Тип, Description |
---|
accept string Setting to |
Имя., Тип, Description |
---|
enterprise string Обязательное полеThe slug version of the enterprise name. You can also substitute this value with the enterprise id. |
Имя., Тип, Description |
---|
dependabot_alerts_enabled_for_new_repositories boolean Whether Dependabot alerts are automatically enabled for new repositories. For more information, see "About Dependabot alerts." |
Коды состояния http-ответа для "Update code security and analysis features for an enterprise"
Код состояния | Описание |
---|---|
204 | Action started |
404 | Resource not found |
422 | The action could not be taken due to an in progress enablement, or a policy is preventing enablement |
Примеры кода для "Update code security and analysis features for an enterprise"
Пример запроса
curl -L \
-X PATCH \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
http(s)://HOSTNAME/api/v3/enterprises/ENTERPRISE/code_security_and_analysis \
-d '{"advanced_security_enabled_for_new_repositories":true,"dependabot_alerts_enabled_for_new_repositories":true,"secret_scanning_enabled_for_new_repositories":true,"secret_scanning_push_protection_enabled_for_new_repositories":true,"secret_scanning_push_protection_custom_link":"https://github.com/test-org/test-repo/blob/main/README.md"}'
Action started
Status: 204
Enable or disable a security feature
Enables or disables the specified security feature for all repositories in an enterprise.
The authenticated user must be an administrator of the enterprise to use this endpoint.
OAuth app tokens and personal access tokens (classic) need the admin:enterprise
scope to use this endpoint.
Параметры для "Enable or disable a security feature"
Имя., Тип, Description |
---|
accept string Setting to |
Имя., Тип, Description |
---|
enterprise string Обязательное полеThe slug version of the enterprise name. You can also substitute this value with the enterprise id. |
security_product string Обязательное полеThe security feature to enable or disable. Возможные значения: |
enablement string Обязательное полеThe action to take.
Возможные значения: |
Коды состояния http-ответа для "Enable or disable a security feature"
Код состояния | Описание |
---|---|
204 | Action started |
404 | Resource not found |
422 | The action could not be taken due to an in progress enablement, or a policy is preventing enablement |
Примеры кода для "Enable or disable a security feature"
Пример запроса
curl -L \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
http(s)://HOSTNAME/api/v3/enterprises/ENTERPRISE/SECURITY_PRODUCT/ENABLEMENT
Action started
Status: 204