datamodel-code-generator is vulnerable to Code Injection
78
CVE Score
High
Code Injection
JSON Schema documents can include an x-python-type extension whose value is forwarded verbatim into generated Python field type annotations with only a trivial dot-based rewrite that is easy to bypass. Attacker-controlled schema input can embed statements after a crafted annotation that execute at class-definition time when the generated module is imported. Default settings reach this path without special CLI flags. The fix parses candidate values with ast.parse and accepts only expressions shaped like valid Python type annotations.
Upgrade the datamodel-code-generator library to the patch version.
You are affected if you are using a version that falls within the vulnerable range.
0.51.0 - 0.60.1
Fixed in 0.60.2datamodel-code-generator is vulnerable to Code Injection in versions 0.51.0 - 0.60.1.
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.