{"openapi":"3.0.3","info":{"title":"AI-Generated Code & CI Workflow Sandbox Auditor API","version":"1.0.0","description":"Statically audits LLM-generated Python, JavaScript/TypeScript, and GitHub Actions YAML snippets for RCE sinks (os.system, subprocess, pickle, child_process), cloud metadata SSRF, environment secret harvesting, and CI expression injection."},"servers":[{"url":"https://api.tinplate.dev","description":"Production Edge Gateway"}],"components":{"schemas":{"AgentCodeGuardResponseData":{"type":"object","properties":{"safe":{"type":"boolean","example":false},"verdict":{"type":"string","enum":["allow","review","block"],"example":"block"},"risk_score":{"type":"number","minimum":0,"maximum":100,"example":100},"detected_language":{"type":"string","enum":["python","javascript","typescript","github_actions_yaml"],"example":"python"},"clean_code":{"type":"string","description":"Code with surrounding markdown ``` fences stripped."},"categories_triggered":{"type":"array","items":{"type":"string"},"example":["insecure_deserialization","arbitrary_code_execution","network_ssrf_exfiltration"]},"findings":{"type":"array","items":{"type":"object","properties":{"rule_id":{"type":"string","example":"PY_INSECURE_PICKLE"},"category":{"type":"string","enum":["arbitrary_code_execution","insecure_deserialization","secret_env_harvesting","network_ssrf_exfiltration","filesystem_escape","prototype_pollution_xss","ci_workflow_injection"],"example":"insecure_deserialization"},"severity":{"type":"string","enum":["low","medium","high","critical"],"example":"critical"},"line":{"type":"integer","minimum":0,"exclusiveMinimum":true,"example":2},"snippet":{"type":"string","example":"payload = pickle.loads(user_bytes)"},"message":{"type":"string","example":"pickle.loads() executes arbitrary Python bytecode during deserialization."},"remediation":{"type":"string","example":"Use json.loads() or a strict Pydantic/TypedDict schema instead of pickle."}},"required":["rule_id","category","severity","line","snippet","message","remediation"]}}},"required":["safe","verdict","risk_score","detected_language","clean_code","categories_triggered","findings"]},"AgentCodeGuardRequest":{"type":"object","properties":{"code":{"type":"string","minLength":1,"maxLength":262144,"example":"import os, pickle\npayload = pickle.loads(user_bytes)\nos.system('curl -s http://169.254.169.254/latest/meta-data/')","description":"LLM-generated Python, JavaScript/TypeScript, or GitHub Actions YAML code (raw or inside markdown code fences)."},"language":{"type":"string","enum":["auto","python","javascript","typescript","github_actions_yaml"],"default":"auto","example":"auto","description":"Source language of the snippet (default 'auto')."},"allow_network":{"type":"boolean","default":false,"example":false,"description":"Whether outbound HTTP/socket network calls are permitted in this sandbox."},"allow_filesystem_write":{"type":"boolean","default":false,"example":false,"description":"Whether destructive or host-level filesystem writes are permitted."}},"required":["code"]},"ResponseMeta":{"type":"object","required":["request_id"],"properties":{"request_id":{"type":"string","format":"uuid"},"ms":{"type":"integer","minimum":0},"version":{"type":"string","example":"1.0.0"}}},"ErrorEnvelope":{"type":"object","required":["ok","error","meta"],"properties":{"ok":{"type":"boolean","enum":[false]},"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","example":"invalid_input"},"message":{"type":"string","example":"Request body failed validation"}}},"meta":{"$ref":"#/components/schemas/ResponseMeta"}}}},"parameters":{}},"paths":{"/v1/agent-code-guard":{"post":{"tags":["42_AGENT_CODE_GUARD"],"summary":"Statically audit AI-generated Python, JavaScript/TypeScript, and GitHub Actions YAML code for sandbox escapes, RCE sinks, SSRF, and secret harvesting before execution","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentCodeGuardRequest"}}}},"responses":{"200":{"description":"Static code security verdict, risk score, and line-level vulnerability findings","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/AgentCodeGuardResponseData"},"meta":{"$ref":"#/components/schemas/ResponseMeta"}},"required":["ok","data","meta"]}}}},"400":{"description":"Invalid input or malformed JSON request body","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"Missing or invalid authentication credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"413":{"description":"Request payload exceeds subscribed plan byte cap","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"Rate limit exceeded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}}}}}}