{"id":"CVE-2026-54656","summary":"`datamodel-code-generator` vulnerable to code execution on import via unescaped `validators` entries in --extra-template-data","details":"datamodel-code-generator generates Pydantic v2 models, dataclasses, TypedDict, and msgspec.Struct from OpenAPI, JSON Schema, GraphQL, Avro, Protobuf, and raw JSON, YAML, or CSV. From 0.52.1 until 0.60.2, datamodel-code-generator interpolates validators from --extra-template-data in src/datamodel_code_generator/model/pydantic_v2/base_model.py through _process_validators into @field_validator decorators without safe validation, allowing Python code execution when the generated Pydantic v2 model is imported. This issue is fixed in version 0.60.2.","aliases":["GHSA-8m8r-38jm-f355"],"modified":"2026-07-31T03:33:55.766841887Z","published":"2026-07-28T21:43:56.286Z","database_specific":{"osv_generated_from":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/54xxx/CVE-2026-54656.json","cna_assigner":"GitHub_M","cwe_ids":["CWE-94"]},"references":[{"type":"WEB","url":"https://github.com/koxudaxi/datamodel-code-generator/releases/tag/0.60.2"},{"type":"ADVISORY","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/54xxx/CVE-2026-54656.json"},{"type":"ADVISORY","url":"https://github.com/koxudaxi/datamodel-code-generator/security/advisories/GHSA-8m8r-38jm-f355"},{"type":"ADVISORY","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-54656"},{"type":"FIX","url":"https://github.com/koxudaxi/datamodel-code-generator/commit/a43d02906111a2fdcaf13ee5b62eb2da85376f19"}],"affected":[{"ranges":[{"type":"GIT","repo":"https://github.com/koxudaxi/datamodel-code-generator","events":[{"introduced":"361fb5aa6a63ae570132daee0c587e633f62da6b"},{"fixed":"a43d02906111a2fdcaf13ee5b62eb2da85376f19"},{"fixed":"e0ea4e45117acd41dcf6ae3a6639cc3f41b59045"}],"database_specific":{"extracted_events":[{"introduced":"0.52.1"},{"fixed":"0.60.2"}],"source":["AFFECTED_FIELD","REFERENCES"]}}],"versions":["0.60.1","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"],"database_specific":{"source":"https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2026-54656.json"}}],"schema_version":"1.7.5","severity":[{"type":"CVSS_V3","score":"CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H"}]}