top of page
perceptive_background_267k.jpg

datamodel-code-generator generates Pydantic v2 models, dataclasses, TypedDict, and msgspec.Struct from OpenAPI, JSON Schema, GraphQL, Avro, Protobuf, and raw JS…

Published:

28 July 2026 at 00:00:00

Alert date:

29 July 2026 at 01:04:30

Source:

nvd.nist.gov

Click to open the original link from this advisory

Supply Chain & Dependencies, Web Technologies

CVE-2026-54656 affects datamodel-code-generator versions 0.52.1 through 0.60.2, a tool that generates Pydantic v2 models and other data structures from various schema formats. The vulnerability exists in src/datamodel_code_generator/model/pydantic_v2/base_model.py where the _process_validators function interpolates user-supplied validators from the --extra-template-data argument into @field_validator decorators without safe validation. This allows an attacker to inject arbitrary Python code into generated model files. The malicious code executes when the generated Pydantic v2 model is imported into a Python application. This is a code injection vulnerability in a developer toolchain component, posing a supply chain risk. The issue has been fixed in version 0.60.2 of datamodel-code-generator. Developers using affected versions should upgrade immediately to mitigate the risk.

Technical details

Mitigation steps:

Affected products:

datamodel-code-generator 0.52.1 - 0.60.1

Related links:

Related CVE's:

Related threat actors:

IOC's:

This article was created with the assistance of AI technology by Perceptive.

© 2025 by Perceptive Security. All rights reserved.

email: info@perceptivesecurity.com

Disclaimer: Deze website toont informatie afkomstig van externe bronnen. Perceptive aanvaardt geen verantwoordelijkheid voor de inhoud, juistheid of volledigheid van deze informatie.

bottom of page