mediumCVSS 5.3Vulnerability

GHSA-4xgf-cpjx-pc3j

### Summary `NestedSecretsSettingsSource` reads secret values from files in a configured `secrets_dir`. When `secrets_nested_subdir=True`, a directory entry inside `secrets_dir` that is a symbolic link pointing **outside** `secrets_dir` is followed, so files outside the configured directory are read into settings values. The same code path bypasses the documented `secrets_dir_max_size` protection. An attacker or lower-privileged component able to influence entries in the configured secrets directory (for example, a writable or shared secrets mount) can turn this into an unintended local file read into settings and can defeat the advertised loading-size cap. This report does not claim network reachability by itself. ### Details `NestedSecretsSettingsSource` performed two passes over `secrets_dir` using two different, inconsistent directory-traversal implementations: * The size check in `validate_secrets_path()` used `Path.glob('**/*')`, which does **not** descend into a symbolically-linked directory. * The loader in `load_secrets()` used `glob.iglob(f'{path}/**/*', recursive=True)` followed by `read_text()`, which **does** follow symlinked directories and reads through the link target. Because the two passes disagreed on symlinks, a symlinked directory inside `secrets_dir` whose target lives elsewhere was invisible to the size accounting (counted as 0 bytes) while still being fully read by the loader. This produces two distinct problems: 1. **Out-of-tree read (CWE-22 / CWE-59).** A symlinked directory (or file) inside `secrets_dir` that resolves outside it is followed, and the external file's contents are loaded into the corresponding settings field. 2. **`secrets_dir_max_size` bypass (CWE-400).** The size check never sees the out-of-tree content, so the documented size cap is neither respected nor able to reject the oversized external file. A related amplification exists for cyclic in-tree symlinks, which `glob.iglob(recursive=True)` re-traverses, inflating th

Properties

ghsa_id
GHSA-4xgf-cpjx-pc3j
severity
medium
summary
pydantic-settings: NestedSecretsSettingsSource follows symlinks outside secrets_dir, enabling local file read and bypassing secrets_dir_max_size
cvss_score
5.3
cve_id
GHSA-4xgf-cpjx-pc3j
cvss_vector
CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:L
is_ghsa_only
true
ghsa_published
2026-06-19T22:10:42Z
source_url
https://github.com/advisories/GHSA-4xgf-cpjx-pc3j
ghsa_updated
2026-06-20T00:50:57Z

Related Entities (6)

VULNERABLE_TO (1)

[Software]pip/pydantic-settings

AFFECTS (1)

[Software]pip/pydantic-settings

HAS_WEAKNESS (3)

[Weakness]Uncontrolled Resource Consumption
[Weakness]Improper Link Resolution Before File Access ('Link Following')
[Weakness]Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')

REPORTED_BY (1)

[Source]GitHub Advisory Database

Explore deeper with Ninja Signal's threat intelligence graph

GHSA-4xgf-cpjx-pc3j (CVSS 5.3) — Ninja Signal Threat Intelligence | Ninja Signal