p PatchFirst

CVE-2026-54655

CVE-2026-54655 · `datamodel-code-generator` vulnerable to code execution on import via `x-python-type` JSON-Schema extension in datamodel-code-generator

This page contains facts from public vulnerability sources. Check the original advisory before updating.

datamodel-code-generator generates Python data models from schema definitions. From 0.51.0 until 0.60.2, x-python-type values parsed by src/datamodel_code_generator/parser/jsonschema.py in _get_python_type_override are inserted into generated field annotations without sufficient validation, allowing attacker-controlled JSON Schema content to execute Python code when the generated module is imported. This issue is fixed in version 0.60.2.

CVSS 7.8 · High · EPSS 0.2% · Fix available

Published
Updated

Stack: python

Affected products and versions

  • datamodel-code-generator

    Versions
    • >= 0.51.0, < 0.60.2: Affected

    No fix published

  • datamodel-code-generator PyPI

    Versions
    • 0.51.0
    • 0.52.0
    • 0.52.1
    • 0.52.2
    • 0.53.0
    • 0.54.0
    • 0.54.1
    • 0.55.0
    • 0.56.0
    • 0.56.1
    • 0.57.0
    • 0.58.0
    • 0.59.0
    • 0.59.1
    • 0.60.0
    • 0.60.1
    Affected ranges
    • ECOSYSTEM: ≥ 0.51.0, < 0.60.2

    Update to 0.60.2

Original sources

Check your server →