{"id":"CVE-2026-55403","aliases":["CVE-2026-55403","GHSA-r5vv-ff45-prp2","PYSEC-2026-3563"],"related":[],"kind":"vulnerability","state":"published","title":"datamodel-code-generator: Authorization / request headers leaked to cross-origin redirect target when fetching remote schemas","summary":"datamodel-code-generator generates Python data models from schema definitions. Prior to 0.63.0, src/datamodel_code_generator/http.py get_body reuses Authorization, Cookie, and Proxy-Authorization headers when following cross-origin redirects while fetching remote schemas, allowing credentials scoped to one schema host to be leaked to another redirect target. This issue is fixed in version 0.63.0.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"datamodel-code-generator generates Python data models from schema definitions. Prior to 0.63.0, src/datamodel_code_generator/http.py get_body reuses Authorization, Cookie, and Proxy-Authorization headers when following cross-origin redirects while fetching remote schemas, allowing credentials scoped to one schema host to be leaked to another redirect target. This issue is fixed in version 0.63.0.","source":"cvelist"},{"lang":"en","text":"### Summary\n\nWhen `datamodel-code-generator` fetches a remote schema and follows an HTTP redirect, it re-sends the original request headers, including any `Authorization` header, to the redirect target even when the redirect changes origin (host/port/scheme). Credentials that an operator scoped to a trusted schema host are therefore forwarded to an attacker-controlled or otherwise different host, leaking them.\n\n### Details\n\nIn `src/datamodel_code_generator/http.py`, `get_body()` follows redirects manually and re-issues each hop with the same `headers` argument, with no check that the origin is unchanged:\n\n```python\nfor redirect_count in range(MAX_HTTP_REDIRECTS + 1):\n    _validate_url_for_fetch(current_url, allow_private_network=allow_private_network)\n    response = httpx.get(current_url, headers=headers, follow_redirects=False, ...)  # same headers every hop\n    if (redirect_url := _get_redirect_url(httpx, current_url, response)) is None:\n        break\n    current_url = redirect_url\n```\n\nBrowsers and HTTP clients such as `requests`/`httpx` strip `Authorization` when a redirect crosses origin; here it is preserved unconditionally. Headers are operator-supplied via `--http-headers` (and credentials can also arrive through `--url` userinfo), so a redirect from the trusted host to any other host discloses them.\n\n### PoC\n\nSelf-contained reproducer: https://gist.github.com/thegr1ffyn/ade3035d7f2be95e16f11698259cdbc2  \nHost A (the trusted schema host) 302-redirects to host B (a different origin) which records received headers; the request carries an auth token scoped to A. \n\n(The PoC uses loopback servers; `allow_private_network=True` is only to avoid the separate SSRF guard blocking loopback and has no bearing on the leak.)\n\n### Impact\n\nExposure of sensitive information to an unauthorized actor (CWE-200). Affects operators who pass authentication headers/credentials to fetch a remote schema (`--http-headers`, `--url` with userinfo) when the configured host issues a redirect to a different origin — e.g. a compromised or open-redirect-prone schema host, or a redirect chain influenced by an attacker-supplied `$ref`. The leaked credential can then be replayed against the trusted host. This is a credential-scoping weakness secondary to, and in the same component as, the project's other SSRF hardening.\n\n### Suggested remediation\n\nWhen a redirect changes the origin (scheme/host/port), drop `Authorization` and other sensitive headers before following it, matching the behavior of mainstream HTTP clients.\n\n### Maintainer status\n\nConfirmed by maintainer review and regression tests. The private fix PR was merged and released in `0.63.0`: https://github.com/koxudaxi/datamodel-code-generator-ghsa-r5vv-ff45-prp2/pull/1\n\nFix summary: strip `Authorization`, `Cookie`, and `Proxy-Authorization` headers when a redirect crosses origin; preserve headers for same-origin redirects.\n\nRelease status: fixed in `0.63.0`; `0.62.0` and earlier are affected.\n\nValidation: `uv run --group test --extra http pytest tests/test_http.py` passed locally for the redirect regression coverage; `uv run --group fix ruff check src/datamodel_code_generator/http.py tests/test_http.py` passed.\n\nSubmitted by: Hamza Haroon (thegr1ffyn)","format":"markdown","source":"ghsa"},{"lang":"es","text":"datamodel-code-generator genera modelos de datos Python a partir de definiciones de esquema. Antes de 0.63.0, src/datamodel_code_generator/http.py get_body reutiliza los encabezados de autorización, cookie y Proxy-Authorization al seguir redirecciones de origen cruzado mientras se recuperan esquemas remotos, permitiendo que las credenciales con ámbito a un host de esquema se filtren a otro objetivo de redirección. Este problema está solucionado en la versión 0.63.0.","source":"nvd"}],"published":"2026-07-28T21:31:49.172Z","modified":"2026-10-23T23:10:00.157Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:N/A:N","score":3.7,"rating":"LOW"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:N/A:N","score":3.7,"rating":"LOW"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:N/A:N","score":3.7,"rating":"LOW"},{"scorer":"PyPA Advisory Database","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:N/A:N","score":3.7,"rating":"LOW"}],"cwes":["CWE-200","CWE-601"],"affected":[{"ranges":[{"version":"< 0.63.0","status":"affected"}],"vendor":"koxudaxi","product":"datamodel-code-generator","source":"cvelist"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","fixed":"0.63.0"}],"ecosystem":"PyPI","package":"datamodel-code-generator","purl":"pkg:pypi/datamodel-code-generator","source":"ghsa"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","fixed":"0.63.0"}],"ecosystem":"PyPI","package":"datamodel-code-generator","purl":"pkg:pypi/datamodel-code-generator","source":"pysec"}],"references":[{"url":"https://github.com/koxudaxi/datamodel-code-generator/security/advisories/GHSA-r5vv-ff45-prp2","tags":["exploit","web","x-refsource-confirm"],"sources":["cvelist","ghsa","nvd","pysec"]},{"url":"https://github.com/koxudaxi/datamodel-code-generator/commit/a585c037c8307b7aae815de193b7fe1c4c44994b","tags":["web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd","pysec"]},{"url":"https://github.com/koxudaxi/datamodel-code-generator/releases/tag/0.63.0","tags":["web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd","pysec"]},{"url":"https://github.com/koxudaxi/datamodel-code-generator","tags":["package"],"sources":["ghsa","pysec"]},{"url":"https://pypi.org/project/datamodel-code-generator","tags":["package"],"sources":["pysec"]},{"url":"https://github.com/advisories/GHSA-r5vv-ff45-prp2","tags":["advisory"],"sources":["pysec"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-55403","tags":["advisory"],"sources":["pysec"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"poc","automatable":"no","technicalImpact":"partial","date":"2026-07-29T12:45:40.786Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-55403","url":"https://www.cve.org/CVERecord?id=CVE-2026-55403","licence":"CVE Terms of Use","modified":"2026-07-29T12:46:11.346Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-r5vv-ff45-prp2","url":"https://github.com/advisories/GHSA-r5vv-ff45-prp2","licence":"CC-BY-4.0","modified":"2026-09-10T03:51:11.866Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-55403","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-55403","licence":"Public domain","modified":"2026-10-23T23:10:00.157Z"},{"source":"pysec","name":"PyPA Advisory Database","id":"PYSEC-2026-3563","url":"https://osv.dev/vulnerability/PYSEC-2026-3563","licence":"CC-BY-4.0","modified":"2026-08-04T14:30:26.224Z"}],"updatedAt":"2026-11-25T22:59:30.391Z","epss":{"score":0.00266,"percentile":0.19762,"date":"2026-12-01T12:00:22.000Z"}}