{"items":[{"id":"NVI-00015031","kind":"vulnerability","title":"`datamodel-code-generator` vulnerable to code injection via unescaped carriage return in GraphQL Union description","revision":1,"unknowns":["Customer inventory, deployment, reachability and exploitation have not been inspected."],"lifecycle":"active","identifiers":["GHSA-j884-q54q-mmx3","CVE-2026-54621"],"plain_summary":"GitHub lists this reviewed advisory for datamodel-code-generator. Published version ranges and source prerequisites are shown below; this is not an inspection of a visitor’s application.","review_status":"source_listed","control_topics":[],"public_actions":[{"summary":"Identify the exact component and deployed version, examine the linked publisher’s conditions, and retain evidence of any mitigation.","source_ids":["sr-0c2c5f0e6eabbc752c2d51f0b6723ddb"],"action_type":"investigate","limitations":"Confirm current vendor support, compatibility and deployment evidence. This report has not tested a fix in your system.","current_supported_target":null}],"schema_version":"1.1.0","source_metrics":[{"kind":"CVSS","as_of":"2026-07-28T21:35:51.000Z","value":"7.8 high","meaning":"GitHub source severity; exploitability and local consequence require separate evidence.","source_id":"sr-0c2c5f0e6eabbc752c2d51f0b6723ddb"}],"why_it_matters":"Published affected context helps an owner decide what evidence to gather. This report has not examined your application.","related_sources":[{"id":"sr-0c2c5f0e6eabbc752c2d51f0b6723ddb","url":"https://github.com/advisories/GHSA-j884-q54q-mmx3","basis":"vendor_advisory","notes":"GitHub Advisory Database; CC-BY-4.0. Each advisory links its original attribution. Null normalizes fields.","title":"GHSA-j884-q54q-mmx3","publisher":"GitHub Advisory Database","observed_at":"2026-11-03T09:59:04.660Z"}],"affected_context":[{"certainty":"source_listed","source_ids":["sr-0c2c5f0e6eabbc752c2d51f0b6723ddb"],"technology":"datamodel-code-generator","known_exclusions":[],"conditions_summary":"### Summary\n\n`datamodel-code-generator` is vulnerable to code injection when generating Python models from an attacker-controlled GraphQL schema. A description on a Union type, written in the regular-string form (`\"...\"`) with a literal `\\r` escape, is rendered into a Python `#` comment by a Jinja2 filter that handles only `\\n`. Python's tokenizer treats a bare CR as a physical-line terminator, so the comment ends at the `\\r` and the text after it is parsed as module-level Python. The injected code executes at `import` time of the generated `.py`, in the context of any consumer that imports the model. No special CLI flags are required.\n\nThis affects versions `>=0.25.0, <0.60.1` and is fixed in `0.60.1`.\n\n### Details\n\nThe vulnerable output was generated by the GraphQL Union templates:\n\n- `src/datamodel_code_generator/model/template/UnionTypeStatement.jinja2`\n- `src/datamodel_code_generator/model/template/UnionTypeAliasAnnotation.jinja2`\n- `src/datamodel_code_generator/model/template/UnionTypeAliasType.jinja2`\n\nBefore `0.60.1`, Union descriptions were rendered as Python comments using logic equivalent to `# {{ description | replace('\\n', '\\n# ') }}`.\n\nThe Jinja2 `replace` filter hand","public_affected_ranges":[">= 0.25.0, < 0.60.1"]}],"null_published_at":"2026-11-03T10:03:26.537Z","source_updated_at":"2026-07-28T21:35:51.000Z","source_disclosed_at":"2026-07-28T21:35:49.000Z","is_synthetic_fixture":false,"null_last_reviewed_at":null,"public_change_summary":"First indexed by Null; source disclosure date is shown separately.","null_first_observed_at":"2026-11-03T09:59:04.660Z"}],"next_cursor":null,"snapshot_revision":"42594"}