pypi pydantic-settings 2.16.3
v2.16.3

2 hours ago

Highlights

This patch release fixes a security issue in the default secrets source, a regression from 2.14.2 that dropped nested secrets on Kubernetes, and a CliApp.serialize round-trip bug with CliUnknownArgs.

Security

  • SecretsSettingsSource no longer follows symlinks that resolve outside secrets_dir (#1138, fixes #1137). A secret file that is a symbolic link to a file outside secrets_dir was read into the matching field, so anyone who could place a link in secrets_dir could make the application load any file it can read. This is the plain-source counterpart of GHSA-4xgf-cpjx-pc3j, whose fix in 2.14.2 covered only NestedSecretsSettingsSource. Links that stay inside secrets_dir, such as the Kubernetes secret volume layout (passwd linking to ..data/passwd), still work.

Behavior changes

  • A secret file that resolves outside secrets_dir is now skipped with a warning instead of being read (#1138). If you deliberately point secret files at targets elsewhere on disk, move or copy the targets into secrets_dir, or point secrets_dir at the directory that holds them.
  • NestedSecretsSettingsSource skips hidden entries (names starting with .) again, as it did before 2.14.2, and stops with a SettingsError after 10,000 entries (#1070).

Bug fixes

Secrets

  • With secrets_nested_subdir=True, a directory reached through a second symlink is loaded again (#1070, fixes #1061). Since 2.14.2, only the name that sorted first was walked, so the standard Kubernetes secret volume layout (db linking to ..data/db) silently lost its nested secrets.
  • A symlink loop inside secrets_dir is skipped instead of aborting the load with RuntimeError on Python 3.11 and 3.12 (#1070, #1138).

CLI

  • CliApp.serialize keeps each level's CliUnknownArgs before that level's subcommand token (#1050, fixes #1048). They were emitted after the last subcommand, so parsing the output again moved a parent's unknown args onto the subcommand.
All changes

What's Changed

  • Fix CliApp.serialize moving a parent unknown args into the subcommand by @XXXXXQ-0206 in #1050
  • Load nested secrets reached through a second directory link by @digit50 in #1070
  • Prevent SecretsSettingsSource from following symlinks outside secrets_dir by @twotnguyen in #1138

New Contributors

Full Changelog: v2.16.2...v2.16.3

Don't miss a new pydantic-settings release

NewReleases is sending notifications on new releases.