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.
Advisories
| Source | ID | Title |
|---|---|---|
Github GHSA |
GHSA-j884-q54q-mmx3 | `datamodel-code-generator` vulnerable to code injection via unescaped carriage return in GraphQL Union description |
Fixes
Solution
No solution given by the vendor.
Workaround
No workaround given by the vendor.
References
History
Tue, 28 Jul 2026 23:45:00 +0000
| Type | Values Removed | Values Added |
|---|---|---|
| First Time appeared |
Koxudaxi
Koxudaxi datamodel-code-generator |
|
| Vendors & Products |
Koxudaxi
Koxudaxi datamodel-code-generator |
Tue, 28 Jul 2026 22:00:00 +0000
| Type | Values Removed | Values Added |
|---|---|---|
| Description | 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. | |
| Title | `datamodel-code-generator` vulnerable to code injection via unescaped carriage return in GraphQL Union description | |
| Weaknesses | CWE-1336 CWE-94 |
|
| References |
| |
| Metrics |
cvssV3_1
|
Projects
Sign in to view the affected projects.
Status: PUBLISHED
Assigner: GitHub_M
Published:
Updated: 2026-07-28T21:35:27.863Z
Reserved: 2026-06-15T20:07:02.184Z
Link: CVE-2026-54621
No data.
No data.
No data.
OpenCVE Enrichment
Updated: 2026-07-28T23:30:03Z
Github GHSA