Intel

AIKIDO-2026-267138

fastapi-code-generator is vulnerable to Code Injection

CVE-2026-63471Published 6 days ago
November 5, 2026

93

CVE Score

Critical

Code Injection

Are you affected? Scan for Free

TL;DR

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.

How do I fix this?

Upgrade the fastapi-code-generator package to 0.8.1 or later.

Who does this affect?

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.

Versions

0.0.1 - 0.8.0

Fixed in 0.8.1

Background info

fastapi-code-generator is vulnerable to Code Injection in versions 0.0.1 - 0.8.0.

Get secure today,
quickly and for free.

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.

Trusted by 150k+ orgs
  • Revolut
  • n8n
  • Lovable
  • Deel
  • Prove
  • Omnea