{"openapi":"3.0.3","info":{"title":"Regex ReDoS Vulnerability Scanner & Pattern Explainer API","version":"1.0.0","description":"Statically audits regular expressions for catastrophic backtracking (ReDoS) vulnerabilities—nested quantifiers, overlapping alternation loops, polynomial wildcard chains, and quantified backreferences—estimates worst-case time complexity, generates plain-English explanations, and safely evaluates sample strings."},"servers":[{"url":"https://api.tinplate.dev","description":"Production Edge Gateway"}],"components":{"schemas":{"RegexSafetyResponseData":{"type":"object","properties":{"valid_syntax":{"type":"boolean"},"safe":{"type":"boolean"},"verdict":{"type":"string","enum":["safe","warn","vulnerable","invalid"]},"worst_case_complexity":{"type":"string","enum":["O(n)_linear","O(n^2)_polynomial","O(2^n)_exponential","invalid"]},"risk_score":{"type":"integer","minimum":0,"maximum":100},"normalized_pattern":{"type":"string"},"normalized_flags":{"type":"string"},"evil_input_hint":{"type":"string","nullable":true},"safe_rewrite_hint":{"type":"string","nullable":true},"explanation":{"type":"array","items":{"type":"string"}},"findings":{"type":"array","items":{"type":"object","properties":{"category":{"type":"string","enum":["syntax_error","nested_quantifier_exponential","overlapping_alternation_loop","polynomial_adjacent_quantifiers","quantified_backreference","unanchored_wildcard_scan"]},"severity":{"type":"string","enum":["low","medium","high","critical"]},"description":{"type":"string"},"fragment":{"type":"string"},"remediation":{"type":"string"}},"required":["category","severity","description","fragment","remediation"]}},"test_results":{"type":"array","items":{"type":"object","properties":{"input":{"type":"string"},"matched":{"type":"boolean"},"match_text":{"type":"string","nullable":true},"index":{"type":"integer","nullable":true},"captures":{"type":"array","items":{"type":"string","nullable":true}}},"required":["input","matched","match_text","index","captures"]}}},"required":["valid_syntax","safe","verdict","worst_case_complexity","risk_score","normalized_pattern","normalized_flags","evil_input_hint","safe_rewrite_hint","explanation","findings","test_results"]},"RegexSafetyRequest":{"type":"object","properties":{"pattern":{"type":"string","minLength":1,"maxLength":8192,"description":"Regular expression pattern string (without surrounding /.../ slashes, or in /pattern/flags literal format).","example":"^([a-zA-Z0-9_]+)+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$"},"flags":{"type":"string","maxLength":16,"default":"","description":"Optional ECMAScript RegExp flags (e.g. 'i', 'g', 'm', 's', 'u', 'v').","example":"i"},"test_strings":{"type":"array","items":{"type":"string","maxLength":512},"maxItems":20,"description":"Optional sample strings (max 512 chars each) to test against the pattern when safe to execute.","example":["alice@example.com","invalid-email@"]}},"required":["pattern"]},"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/regex-safety":{"post":{"tags":["36_REGEX_SAFETY"],"summary":"Audit a regular expression for ReDoS catastrophic backtracking and explain its structure","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RegexSafetyRequest"}}}},"responses":{"200":{"description":"ReDoS complexity verdict, risk score, evil input hint, rewrite suggestion, plain-English explanation, and sample match results","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/RegexSafetyResponseData"},"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"}}}}}}}}}