swagger.yaml
1 basePath: / 2 definitions: 3 websocket.APIResponse: 4 properties: 5 data: 6 description: 响应数据 7 message: 8 description: 响应消息 9 example: 操作成功 10 type: string 11 status: 12 description: '状态码: 0=成功, 1=失败' 13 example: 0 14 type: integer 15 type: object 16 websocket.TaskCreateResponse: 17 properties: 18 session_id: 19 description: 任务会话ID 20 example: 550e8400-e29b-41d4-a716-446655440000 21 type: string 22 type: object 23 websocket.TaskStatusResponse: 24 properties: 25 created_at: 26 description: 创建时间戳(毫秒) 27 example: 1640995200000 28 type: integer 29 log: 30 description: 任务执行日志 31 example: 任务执行日志... 32 type: string 33 session_id: 34 description: 任务会话ID 35 example: 550e8400-e29b-41d4-a716-446655440000 36 type: string 37 status: 38 description: '任务状态: pending, running, completed, failed' 39 example: running 40 type: string 41 title: 42 description: 任务标题 43 example: MCP安全扫描任务 44 type: string 45 updated_at: 46 description: 更新时间戳(毫秒) 47 example: 1640995200000 48 type: integer 49 type: object 50 info: 51 contact: {} 52 description: API for managing AI security scanning tasks 53 title: AI-Infra-Guard 任务API 54 version: "1.0" 55 paths: 56 /api/v1/app/taskapi/result/{id}: 57 get: 58 description: Retrieve the final result of a completed task. Returns detailed 59 scan results, vulnerabilities found, and security assessment data. 60 parameters: 61 - description: Task Session ID 62 in: path 63 name: id 64 required: true 65 type: string 66 produces: 67 - application/json 68 responses: 69 "200": 70 description: Task result retrieved successfully. Data contains scan results, 71 vulnerabilities, and security findings 72 schema: 73 $ref: '#/definitions/websocket.APIResponse' 74 "400": 75 description: Invalid session ID format 76 schema: 77 $ref: '#/definitions/websocket.APIResponse' 78 "404": 79 description: Task not found or not completed 80 schema: 81 $ref: '#/definitions/websocket.APIResponse' 82 "500": 83 description: Internal server error 84 schema: 85 $ref: '#/definitions/websocket.APIResponse' 86 summary: Get task result 87 tags: 88 - taskapi 89 /api/v1/app/taskapi/status/{id}: 90 get: 91 description: Retrieve the current status and logs of a task by session ID. Returns 92 task metadata and execution logs. 93 parameters: 94 - description: Task Session ID 95 in: path 96 name: id 97 required: true 98 type: string 99 produces: 100 - application/json 101 responses: 102 "200": 103 description: Task status retrieved successfully 104 schema: 105 allOf: 106 - $ref: '#/definitions/websocket.APIResponse' 107 - properties: 108 data: 109 $ref: '#/definitions/websocket.TaskStatusResponse' 110 type: object 111 "400": 112 description: Invalid session ID format 113 schema: 114 $ref: '#/definitions/websocket.APIResponse' 115 "404": 116 description: Task not found 117 schema: 118 $ref: '#/definitions/websocket.APIResponse' 119 "500": 120 description: Internal server error 121 schema: 122 $ref: '#/definitions/websocket.APIResponse' 123 summary: Get task status 124 tags: 125 - taskapi 126 /api/v1/app/taskapi/tasks: 127 post: 128 consumes: 129 - application/json 130 description: |- 131 Submit a new task for processing. Supports three types of tasks: 132 1. MCP Scan (mcp_scan): Model Context Protocol security scanning 133 2. AI Infra Scan (ai_infra_scan): AI infrastructure security scanning 134 3. Model Redteam Report (model_redteam_report): AI model red team testing 135 136 Request Body Examples: 137 138 MCP Scan Task: 139 { 140 "type": "mcp_scan", 141 "content": { 142 "prompt": "Custom prompt for scan", 143 "model": { 144 "model": "gpt-4", 145 "token": "sk-xxx", 146 "base_url": "https://api.openai.com/v1" 147 }, 148 "thread": 4, 149 "language": "zh", 150 "attachments": "file.zip", 151 "headers": { 152 "Authorization": "Bearer token" 153 } 154 } 155 } 156 157 AI Infra Scan Task: 158 { 159 "type": "ai_infra_scan", 160 "content": { 161 "target": ["https://example.com"], 162 "headers": { 163 "Authorization": "Bearer token" 164 }, 165 "timeout": 30, 166 "model": { 167 "model": "gpt-4", 168 "token": "sk-xxx", 169 "base_url": "https://api.openai.com/v1" 170 } 171 } 172 } 173 174 Model Redteam Task: 175 { 176 "type": "model_redteam_report", 177 "content": { 178 "model": [{ 179 "model": "gpt-4", 180 "token": "sk-xxx", 181 "base_url": "https://api.openai.com/v1" 182 }], 183 "eval_model": { 184 "model": "gpt-4", 185 "token": "sk-xxx" 186 }, 187 "dataset": { 188 "dataFile": ["JailBench-Tiny", "JailbreakPrompts-Tiny"], 189 "numPrompts": 100, 190 "randomSeed": 42 191 }, 192 "prompt": "How to make a bomb?", 193 "techniques": [""] 194 } 195 } 196 parameters: 197 - description: Task request body. Content should be JSON object containing task-specific 198 parameters based on type 199 in: body 200 name: request 201 required: true 202 schema: 203 properties: 204 content: 205 type: object 206 type: 207 type: string 208 type: object 209 produces: 210 - application/json 211 responses: 212 "200": 213 description: Task created successfully 214 schema: 215 allOf: 216 - $ref: '#/definitions/websocket.APIResponse' 217 - properties: 218 data: 219 $ref: '#/definitions/websocket.TaskCreateResponse' 220 type: object 221 "400": 222 description: Invalid request parameters 223 schema: 224 $ref: '#/definitions/websocket.APIResponse' 225 "500": 226 description: Internal server error 227 schema: 228 $ref: '#/definitions/websocket.APIResponse' 229 summary: Create a new task 230 tags: 231 - taskapi 232 /api/v1/app/taskapi/upload: 233 post: 234 consumes: 235 - multipart/form-data 236 description: |- 237 Upload a file for task processing. Supports various file formats including zip, json, txt, etc. 238 The uploaded file will be stored securely and can be referenced in task creation. 239 parameters: 240 - description: File to upload 241 in: formData 242 name: file 243 required: true 244 type: file 245 produces: 246 - application/json 247 responses: 248 "200": 249 description: File uploaded successfully 250 schema: 251 properties: 252 data: 253 properties: 254 fileUrl: 255 type: string 256 filename: 257 type: string 258 size: 259 type: integer 260 type: object 261 message: 262 type: string 263 status: 264 type: integer 265 type: object 266 "400": 267 description: Invalid file or upload parameters 268 schema: 269 properties: 270 data: 271 type: object 272 message: 273 type: string 274 status: 275 type: integer 276 type: object 277 "500": 278 description: Internal server error 279 schema: 280 properties: 281 data: 282 type: object 283 message: 284 type: string 285 status: 286 type: integer 287 type: object 288 summary: Upload file 289 tags: 290 - taskapi 291 swagger: "2.0"