datamodel-code-generator is vulnerable to Path Traversal
75
High Risk
datamodel-code-generator resolves JSON Schema $ref targets that point at the local filesystem without restricting them to the input base directory and without honoring the remote-reference control. An attacker who controls an input schema can use a file:// absolute URI or a ../-escaped relative reference to read arbitrary files the process can access, bypassing --no-allow-remote-refs. Values from schema-shaped nodes are reflected verbatim into the generated Python, and failed reads act as a filesystem existence and permission oracle. The fix applies the remote-reference gate to file:// refs and rejects local refs that resolve outside the input base path.
You are affected if you are using a version that falls within the vulnerable range and generate models from an untrusted JSON Schema or OpenAPI document.
datamodel-code-generator is vulnerable to Path Traversal in versions 0.0.1 - 0.61.0.
Upgrade the datamodel-code-generator library to the patch version.
Connect your repositories to instantly see whether vulnerable or malicious packages exist in your codebase.
Free. No credit card required.

I consent to receiving marketing communications based on Aikido’s Privacy Policy.
SOC 2Compliant
ISO 27001Compliant