fastapi-code-generator is vulnerable to Code Injection
93
CVE Score
Critical
Code Injection
Before the fix, fastapi-code-generator wrote the OpenAPI path, parsed in parse_info in fastapi_code_generator/parser.py, into the generated @app.get('...') route decorator without escaping quotes, so anyone who supplied the OpenAPI document could break out of the single-quoted literal and inject Python code that ran with the importing process's privileges as soon as the generated app was imported or served. It matters when developers or CI generate FastAPI apps from third-party or otherwise untrusted specs. The fix escapes the path (and other emitted strings) as Python string literals before rendering them into the decorator.
Upgrade the fastapi-code-generator package to 0.8.1 or later.
You are affected if you are using a version that falls within the vulnerable range and run fastapi-codegen on an OpenAPI document supplied by an untrusted party and import or serve the generated app.
0.0.1 - 0.8.0
Fixed in 0.8.1fastapi-code-generator is vulnerable to Code Injection in versions 0.0.1 - 0.8.0.
Secure your code, cloud, and runtime in one central system. Connect a repo to discover what the reasoning agents find in your codebase.
No credit card required | Scan results in 32 seconds.
I consent to receiving marketing communications based on Aikido’s Privacy Policy.
SOC 2Compliant
ISO 27001Compliant
ISO 42001Compliant© All Intel data is openly available and commercially licensed.