datamodel-code-generator is vulnerable to Path Traversal
75
High Risk
When generating models from an XML Schema, datamodel-code-generator resolves the schemaLocation attribute on xs:include, xs:import, xs:redefine, and xs:override against the source directory and reads the target with only an existence check. An attacker who controls the input XSD can use ../ traversal or an absolute path to read files outside the input base directory, and schema-shaped contents are folded into the generated code. Unlike the JSON Schema $ref path there is no remote-reference gate, so disabling remote references does not block it. The fix rejects schemaLocation targets 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 XML Schema (--input-file-type xmlschema).
datamodel-code-generator is vulnerable to Path Traversal in versions 0.59.0 - 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