{"id":"CVE-2026-54621","summary":"`datamodel-code-generator` vulnerable to code injection via unescaped carriage return in GraphQL Union description","details":"datamodel-code-generator generates Python data models from schema definitions. Prior to 0.60.1, GraphQL Union description values in src/datamodel_code_generator/model/template/UnionTypeStatement.jinja2 and src/datamodel_code_generator/model/template/UnionTypeStatement.py312.jinja2 are rendered into Python comments without neutralizing carriage returns in Python # comments, allowing attacker-controlled GraphQL schema content to inject Python code into generated models that runs when imported. This issue is fixed in version 0.60.1.","aliases":["GHSA-j884-q54q-mmx3","PYSEC-2026-3561"],"modified":"2026-10-28T02:30:25.000923183Z","published":"2026-07-28T21:35:27.863Z","database_specific":{"osv_generated_from":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/54xxx/CVE-2026-54621.json","cna_assigner":"GitHub_M","cwe_ids":["CWE-1336","CWE-94"]},"references":[{"type":"WEB","url":"https://github.com/koxudaxi/datamodel-code-generator/releases/tag/0.60.1"},{"type":"ADVISORY","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/54xxx/CVE-2026-54621.json"},{"type":"ADVISORY","url":"https://github.com/koxudaxi/datamodel-code-generator/security/advisories/GHSA-j884-q54q-mmx3"},{"type":"ADVISORY","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-54621"},{"type":"FIX","url":"https://github.com/koxudaxi/datamodel-code-generator/commit/aec47bc414779f4a9992b3919c8f7663afd6c988"}],"affected":[{"ranges":[{"type":"GIT","repo":"https://github.com/datamodel-code-generator/datamodel-code-generator","events":[{"introduced":"a46fe94e36806eb4c24cf4e6327afbd5aff3b2f4"},{"fixed":"a321547e8b94d352394b6f98c919866fc149473c"},{"fixed":"aec47bc414779f4a9992b3919c8f7663afd6c988"}],"database_specific":{"extracted_events":[{"strategy":"StringRangeExpression","range":[{"introduced":"0.25.0"},{"fixed":"0.60.1"}],"source":"AFFECTED_FIELD"},{"source":"REFERENCES_COMMIT","range":[{"fixed":"aec47bc414779f4a9992b3919c8f7663afd6c988"}]},{"original_tag":"0.60.1","range":[{"fixed":"a321547e8b94d352394b6f98c919866fc149473c"}],"source":"REFERENCES_TAG"}]}}],"versions":["0.60.0","0.59.1","0.59.0","0.58.0","0.57.0","0.56.1","0.56.0","0.55.0","0.54.1","0.54.0","0.53.0","0.52.2","0.52.1","0.52.0","0.51.0","0.50.0","0.49.0","0.48.0","0.47.0","0.46.0","0.45.0","0.44.0","0.43.1","0.43.0","0.42.2","0.42.1","0.42.0","0.41.0","0.40.0","0.39.0","0.38.0","0.37.0","0.36.0","0.35.0","0.34.0","0.33.0","0.32.0","0.31.2","0.31.1","0.31.0","0.30.2","0.30.1","0.30.0","0.29.0","0.28.5","0.28.4","0.28.3","0.28.2","0.28.1","0.28.0","0.27.3","0.27.2","0.27.1","0.27.0","0.26.5","0.26.4","0.26.3","0.26.2","0.26.1","0.26.0","0.25.9","0.25.8","0.25.7","0.25.6","0.25.5","0.25.4","0.25.3","0.25.2","0.25.1","0.25.0"],"database_specific":{"source":"https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2026-54621.json"}}],"schema_version":"1.9.2","severity":[{"type":"CVSS_V3","score":"CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H"}]}