fastapi-code-generator is vulnerable to Code Injection
93
CVE Score
Critical
Code Injection
Before the fix, fastapi-code-generator wrote the OpenAPI operation summary into the generated route handler's docstring without escaping, so a summary containing triple double quotes closed the docstring and injected Python expression statements that run with the app's privileges whenever the generated endpoint is called. Whoever supplies the OpenAPI document that parse_info and the operation model read can plant this code; it runs in any app generated from that document and deployed. The fix escapes backslashes and triple double quotes in the summary at parse time, so the docstring can no longer be broken out of.
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 generate code from an OpenAPI document supplied by someone outside your development team and deploy the generated app.
0.0.18 - 0.8.0
Fixed in 0.8.1fastapi-code-generator is vulnerable to Code Injection in versions 0.0.18 - 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.