Проверка кода
API code scanning позволяет получать и обновлять оповещения code scanning из репозитория.
Сведения об API проверки кода
API code scanning позволяет получать и обновлять оповещения code scanning из репозитория. Для создания автоматических отчетов для оповещений code scanning о результатах проверки кода в организации или отправки результатов анализа, созданных с помощью автономных средств code scanning, можно использовать конечные точки. Дополнительные сведения см. в разделе Поиск уязвимостей системы безопасности и ошибок в коде.
Пользовательский тип носителя для code scanning
Для REST API code scanning поддерживается только один пользовательский тип носителя.
application/sarif+json
Этот тип носителя можно использовать с запросами GET, отправляемыми в конечную точку /analyses/{analysis_id}. Дополнительные сведения об этой операции см. в разделе Получение анализа code scanning для репозитория. При использовании этого типа мультимедиа с данной операцией ответ включает подмножество фактических данных, отправленных для указанного анализа, а не сводку анализа, возвращаемою при использовании типа мультимедиа по умолчанию. Ответ также содержит дополнительные данные, например свойства github/alertNumber и github/alertUrl. Для данных применяется формат SARIF версии 2.1.0.
Дополнительные сведения см. в разделе Типы носителей.
List code scanning alerts for an enterprise
Lists code scanning alerts for the default branch for all eligible repositories in an enterprise. Eligible repositories are repositories that are owned by organizations that you own or for which you are a security manager. For more information, see "Managing security managers in your organization."
To use this endpoint, you must be a member of the enterprise,
and you must use an access token with the repo scope or security_events scope.
Parameters
| Headers |
|---|
| Name, Type, Description |
acceptstringSetting to |
| Path parameters |
| Name, Type, Description |
enterprisestringRequiredThe slug version of the enterprise name. You can also substitute this value with the enterprise id. |
| Query parameters |
| Name, Type, Description |
tool_namestringThe name of a code scanning tool. Only results by this tool will be listed. You can specify the tool by using either |
tool_guidstringnullThe GUID of a code scanning tool. Only results by this tool will be listed. Note that some code scanning tools may not include a GUID in their analysis data. You can specify the tool by using either |
beforestringA cursor, as given in the Link header. If specified, the query only searches for results before this cursor. |
afterstringA cursor, as given in the Link header. If specified, the query only searches for results after this cursor. |
pageintegerPage number of the results to fetch. Default: |
per_pageintegerThe number of results per page (max 100). Default: |
directionstringThe direction to sort the results by. Default: Can be one of: |
statestringIf specified, only code scanning alerts with this state will be returned. Can be one of: |
sortstringThe property by which to sort the results. Default: Can be one of: |
HTTP response status codes
| Status code | Description |
|---|---|
200 | OK |
404 | Resource not found |
503 | Service unavailable |