update add openapi api

This commit is contained in:
xiongxiao
2026-01-16 13:03:57 +08:00
parent a8f2cb14a7
commit 7787337f13
32 changed files with 39023 additions and 43 deletions

View File

@@ -0,0 +1,286 @@
{
"swagger": "2.0",
"info": {
"title": "CNB OPENAPI",
"contact": {
"name": "Open API Support",
"url": "https://docs.cnb.cool/",
"email": "cnb@tencent.com"
},
"version": "1.0"
},
"paths": {
"/{repo}/-/security/overview": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/vnd.cnb.api+json"
],
"tags": [
"Security"
],
"summary": "查询仓库安全模块概览数据。Query the security overview data of a repository",
"operationId": "GetRepoSecurityOverview",
"parameters": [
{
"type": "string",
"description": "仓库名称",
"name": "repo",
"in": "path",
"required": true
},
{
"type": "string",
"description": "类型多个类型用逗号分隔code_sensitive,code_vulnerability,code_issue为空默认查询所有类型",
"name": "types",
"in": "query"
},
{
"type": "string",
"description": "查询类型下开启或忽略的各风险类型概览数量,可选值open,ignore,all默认all",
"name": "tab",
"in": "query"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/dto.RepoSecurityOverview"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/die.WebError"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/die.WebError"
}
}
},
"description": "访问令牌调用此接口需包含以下权限。Required permissions for access token. \nrepo-security:r"
}
}
},
"definitions": {
"dto.RepoSecurityOverview": {
"type": "object",
"properties": {
"code_issue": {
"$ref": "#/definitions/dto.CodeIssueSummary"
},
"code_sensitive": {
"$ref": "#/definitions/dto.CodeSensitiveSummary"
},
"code_vulnerability": {
"$ref": "#/definitions/dto.CodeVulOverview"
},
"risk_cnt": {
"$ref": "#/definitions/dto.RepoSecurityRiskCnt"
}
}
},
"die.WebError": {
"type": "object",
"properties": {
"errcode": {
"type": "integer"
},
"errmsg": {
"type": "string"
},
"errparam": {
"type": "object",
"additionalProperties": {}
}
}
},
"dto.CodeIssueSummary": {
"type": "object",
"properties": {
"critical_count": {
"description": "严重风险问题数量",
"type": "integer"
},
"critical_ignore_count": {
"description": "严重风险问题忽略数量",
"type": "integer"
},
"enable": {
"description": "是否开启源码信息扫描",
"type": "boolean"
},
"high_count": {
"description": "高风险问题数量",
"type": "integer"
},
"high_ignore_count": {
"description": "高风险问题忽略数量",
"type": "integer"
},
"ignored": {
"description": "忽略的问题数量",
"type": "integer"
},
"low_count": {
"description": "低风险问题数量",
"type": "integer"
},
"low_ignore_count": {
"description": "低风险问题忽略数量",
"type": "integer"
},
"medium_count": {
"description": "中风险问题数量",
"type": "integer"
},
"medium_ignore_count": {
"description": "中风险问题忽略数量",
"type": "integer"
},
"open": {
"description": "开启中问题数量",
"type": "integer"
}
}
},
"dto.CodeSensitiveSummary": {
"type": "object",
"properties": {
"enable": {
"description": "是否开启代码敏感信息扫描",
"type": "boolean"
},
"high_count": {
"description": "高风险问题数量",
"type": "integer"
},
"high_ignore_count": {
"description": "高风险问题忽略数量",
"type": "integer"
},
"ignored": {
"description": "忽略问题数量",
"type": "integer"
},
"low_count": {
"description": "低风险问题数量",
"type": "integer"
},
"low_ignore_count": {
"description": "低风险问题忽略数量",
"type": "integer"
},
"medium_count": {
"description": "中风险问题数量",
"type": "integer"
},
"medium_ignore_count": {
"description": "中风险问题忽略数量",
"type": "integer"
},
"open": {
"description": "开启中问题数量",
"type": "integer"
}
}
},
"dto.CodeVulOverview": {
"type": "object",
"properties": {
"critical_vul_ignore_cnt": {
"description": "忽略的严重风险漏洞的数量",
"type": "integer"
},
"critical_vul_open_cnt": {
"description": "打开的严重风险级别漏洞的数量",
"type": "integer"
},
"enable": {
"description": "是否开启代码漏洞扫描",
"type": "boolean"
},
"high_vul_ignore_cnt": {
"description": "忽略的高风险级别漏洞的数量",
"type": "integer"
},
"high_vul_open_cnt": {
"description": "打开的高风险级别漏洞的数量",
"type": "integer"
},
"ignored": {
"description": "忽略问题数量",
"type": "integer"
},
"low_vul_ignore_cnt": {
"description": "忽略的低风险级别漏洞的数量",
"type": "integer"
},
"low_vul_open_cnt": {
"description": "打开的低风险级别漏洞的数量",
"type": "integer"
},
"medium_vul_ignore_cnt": {
"description": "忽略的中风险级别漏洞的数量",
"type": "integer"
},
"medium_vul_open_cnt": {
"description": "打开的中风险级别漏洞的数量",
"type": "integer"
},
"open": {
"description": "开启中问题数量",
"type": "integer"
}
}
},
"dto.RepoSecurityRiskCnt": {
"type": "object",
"properties": {
"code_issue_enable": {
"description": "是否开启源码扫描",
"type": "boolean"
},
"code_issue_risk_cnt": {
"description": "源码扫描风险数量 (严重+高风险)",
"type": "integer"
},
"code_sensitive_enable": {
"description": "是否开启代码敏感信息扫描",
"type": "boolean"
},
"code_sensitive_risk_cnt": {
"description": "敏感信息风险数量(高风险)",
"type": "integer"
},
"code_vulnerability_enable": {
"description": "是否开启代码漏洞扫描",
"type": "boolean"
},
"code_vulnerability_risk_cnt": {
"description": "代码漏洞风险数量(严重+高风险)",
"type": "integer"
},
"enable": {
"description": "是否开启安全模块",
"type": "boolean"
},
"total": {
"description": "总计数",
"type": "integer"
}
}
}
}
}