CVE-2026-55403 Overview
CVE-2026-55403 affects datamodel-code-generator, a Python library that generates data models from schema definitions. The vulnerability resides in the get_body function within src/datamodel_code_generator/http.py. When the library fetches remote schemas and follows cross-origin redirects, it reuses Authorization, Cookie, and Proxy-Authorization headers on the redirect target. Credentials scoped to the original schema host leak to arbitrary hosts controlled by the redirect. The maintainers fixed the issue in version 0.63.0. The weakness maps to [CWE-200: Exposure of Sensitive Information to an Unauthorized Actor].
Critical Impact
Sensitive HTTP credentials intended for a trusted schema host can be forwarded to attacker-controlled redirect targets, enabling credential theft against systems that consume remote schemas.
Affected Products
- datamodel-code-generator versions prior to 0.63.0
- Python build pipelines and code-generation workflows that fetch remote OpenAPI, JSON Schema, or GraphQL schemas
- CI/CD systems invoking datamodel-code-generator against authenticated schema endpoints
Discovery Timeline
- 2026-07-28 - CVE-2026-55403 published to NVD
- 2026-07-29 - Last updated in NVD database
Technical Details for CVE-2026-55403
Vulnerability Analysis
The datamodel-code-generator project retrieves remote schemas over HTTP to produce Python data models. The get_body function in src/datamodel_code_generator/http.py handles these fetches and follows HTTP redirects. When a caller supplies credentials for the initial host through Authorization, Cookie, or Proxy-Authorization headers, the client retains those headers across redirects. If the redirect points to a different origin, the sensitive headers travel to the new host. An operator or attacker who controls a schema URL, or who can influence a redirect chain, receives credentials that were only intended for the original host.
Root Cause
The root cause is missing origin scoping for authentication headers during redirect handling. HTTP clients should strip credentials when redirecting across origins. The prior implementation did not enforce this policy. The fix in commit a585c037c8307b7aae815de193b7fe1c4c44994b introduces stricter header handling, including use of MappingProxyType for immutable header propagation, and removes sensitive headers on cross-origin redirects.
Attack Vector
An attacker who controls or influences a schema URL processed by datamodel-code-generator publishes a redirect (HTTP 301, 302, 307, or 308) pointing to an attacker-controlled host. When the target build system fetches the schema with credentials, the library replays those credentials to the attacker endpoint. Exploitation requires the victim to fetch a specific URL and supply credentials, which raises attack complexity.
# Patch excerpt from src/datamodel_code_generator/http.py
import ssl
from collections.abc import Iterable, Sequence
from ipaddress import IPv4Address, IPv6Address, ip_address
+from types import MappingProxyType
from typing import TYPE_CHECKING, Protocol, cast, overload
from urllib.parse import urlparse
# Source: https://github.com/koxudaxi/datamodel-code-generator/commit/a585c037c8307b7aae815de193b7fe1c4c44994b
Detection Methods for CVE-2026-55403
Indicators of Compromise
- Outbound HTTP requests from build agents to unexpected hosts carrying Authorization, Cookie, or Proxy-Authorization headers
- Redirect responses (3xx) returned by schema URLs used in CI jobs
- Use of datamodel-code-generator versions earlier than 0.63.0 in requirements.txt, pyproject.toml, or lockfiles
Detection Strategies
- Inspect dependency manifests across repositories for datamodel-code-generator<0.63.0 and flag matching projects.
- Correlate CI/CD egress logs with schema fetch destinations to identify redirect chains that cross origins.
- Monitor secrets management systems for tokens that appear in outbound traffic to hosts outside the approved schema domain list.
Monitoring Recommendations
- Route CI outbound traffic through an HTTP proxy that logs full request URLs, response codes, and destination hosts.
- Alert on 3xx responses from schema endpoints that redirect to domains outside an allowlist.
- Track token issuance and reuse patterns for service accounts that authenticate to schema hosts.
How to Mitigate CVE-2026-55403
Immediate Actions Required
- Upgrade datamodel-code-generator to version 0.63.0 or later in all environments.
- Rotate any Authorization tokens, session cookies, or proxy credentials that were passed to the library against redirecting hosts.
- Audit CI/CD job history for schema fetches that returned HTTP redirect responses.
Patch Information
The fix is available in version 0.63.0. See the GitHub Release v0.63.0, the security advisory GHSA-r5vv-ff45-prp2, and the remediation commit.
Workarounds
- Restrict schema fetches to trusted hosts using an egress allowlist that blocks redirect targets outside the approved domain set.
- Disable HTTP redirects for schema fetches in build tooling until the upgrade is complete.
- Fetch remote schemas out-of-band, verify their final URL, and pass local file paths to datamodel-code-generator instead of remote URLs.
# Upgrade to the patched release
pip install --upgrade 'datamodel-code-generator>=0.63.0'
# Verify the installed version
python -c "import datamodel_code_generator; print(datamodel_code_generator.__version__)"
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

