SAST Engine Pack Version 9.7.6 - Python FastAPI Support Enhancements
Python FastAPI Support
SAST Engine Pack Version 9.7.6 adds full FastAPI coverage to the Python query set. Five new helper queries provide the foundation, and they are plugged into existing vulnerability queries so that FastAPI applications are now detected on par with Django and Flask.
New Helper Queries
Find_FastAPI_RoutedMethods
Identifies all functions decorated with FastAPI route decorators (@app.get, @app.post, @app.put, @app.patch, @app.delete, @app.options, @app.head, @app.trace). Works for both FastAPI() and APIRouter() instances. This is the anchor for all other FastAPI helpers — route-scoped input and output detection depends on it.
Find_FastAPI_Inputs
Marks FastAPI route function parameters as taint sources. Covers:
Typed route/query/body parameters declared in routed function signatures
request.json,request.form,request.body,request.url,request.cookies,request.query_params,request.path_params,request.headersfrom injectedRequestobjects
False positive reduction built in: parameters typed as int, float, decimal, or bool are excluded from sources (safe by type). Query parameters with numeric constraint validators (ge, gt, le, lt) or a safe regex pattern are also excluded when used with Annotated[...].
Find_FastAPI_Outputs
Marks return values of routed functions as taint sinks. Excludes direct Response object returns (tracked separately) to avoid noise on response wrappers that do not render user data directly.
Find_FastAPI_XSS_Outputs
Specialized XSS sink detection for FastAPI HTML-rendering patterns:
Functions with
response_class=HTMLResponseusing.format()on their return valueHTMLResponse(content=...)direct instantiationResponse(media_type="text/html")/"application/xml"/"application/html"Jinja2
| safefilter output — data piped throughsafein a template is now a tracked XSS sink
Find_FastAPI_Overly_Permissive_CORS
Detects CORSMiddleware configured with allow_origins=["*"] (or any wildcard string) on a FastAPI application instance via app.add_middleware(CORSMiddleware, ...).
Query Coverage Matrix
Queries now active for FastAPI applications. Helper queries (General) carry no severity of their own — they feed the vulnerability queries below.
Helper Queries (New)
Query | Purpose |
|---|---|
| Identifies all |
| Taint sources: route/query/body parameters and |
| Taint sinks: return values from routed functions (excludes bare |
| XSS-specific sinks: |
| Detects |
Vulnerability Queries — Now Active for FastAPI
Query | Severity | CWE | Description |
|---|---|---|---|
| Critical | CWE-89 | User-controlled data from FastAPI route params flows into raw SQL execution |
| Critical | CWE-89 | Stored FastAPI input flows into SQL execution in a later request |
| Critical | CWE-94 | FastAPI route params flow into |
| Critical | CWE-94 | Stored FastAPI input flows into dynamic code execution |
| Critical | CWE-77 | FastAPI route params flow into |
| Critical | CWE-77 | Stored FastAPI input flows into OS command execution |
| Critical | CWE-79 | Stored input flows into an |
| High | CWE-79 | FastAPI route params flow directly into |
| High | CWE-22 | FastAPI route params flow into file system operations without canonicalization |
| High | CWE-918 | FastAPI route params flow into outbound HTTP requests |
| High | CWE-90 | FastAPI route params flow into LDAP queries |
| High | CWE-90 | Stored FastAPI input flows into LDAP queries |
| High | CWE-502 | FastAPI route params flow into |
| High | CWE-611 | FastAPI route params flow into XML parsers without XXE protection |
| High | CWE-829 | FastAPI route params used to include local files |
| High | CWE-99 | FastAPI route params flow into database connection string construction |
| Medium | CWE-601 | FastAPI route params flow into redirect responses |
| Medium | CWE-113 | FastAPI route params flow into HTTP response headers |
| Medium | CWE-99 | FastAPI route params used to reference system resources |
| Medium | CWE-472 | FastAPI route params alter application behavior through unsafe direct use |
| Medium | CWE-643 | FastAPI route params flow into XPath query construction |
| Medium | CWE-359 | Sensitive personal data from FastAPI inputs flows into logs or external outputs |
| Medium | CWE-134 | FastAPI route params used in uncontrolled |
| Medium | CWE-88 | FastAPI route params injected as arguments into OS commands |
| Medium | CWE-88 | Stored FastAPI input injected as OS command arguments |
| Medium | CWE-1004 |
|
| Medium | CWE-614 |
|
| Low | CWE-346 |
|
| Low | CWE-117 | FastAPI route params flow into log statements without sanitization |
| Low | CWE-501 | FastAPI route params stored in session without validation |
Impact on Existing Vulnerability Queries
The new helpers are wired into the shared query infrastructure, so existing vulnerability queries automatically gain FastAPI coverage:
Existing Query | What Changed |
|---|---|
All taint-flow queries (SQL Injection, Command Injection, Path Traversal, SSRF, Code Injection, XXE, etc.) |
|
Reflected XSS, Stored XSS |
|
Overly Permissive CORS |
|
HttpOnly Cookie Flag Not Set | Query now checks |
Secure Cookie Flag Not Set | Same as above for the |