Conversation
With env_nested_delimiter='_', CORS_ALLOW_ORIGINS was exploded into cors.allow.origins and silently dropped, so restricted origins stayed '*'. Limit nested splitting to one level and skip JSON decoding for the comma-separated list fields. Requires pydantic-settings>=2.8.0. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #216 +/- ##
==========================================
- Coverage 89.76% 89.74% -0.02%
==========================================
Files 30 30
Lines 1348 1346 -2
Branches 180 179 -1
==========================================
- Hits 1210 1208 -2
Misses 97 97
Partials 41 41
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Accepts the JSON-list env form (CORS_ALLOW_ORIGINS='["..."]') in addition to comma-separated, matching other list settings. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The documented
CORS_ALLOW_ORIGINS,CORS_ALLOW_METHODS, etc. environment variables were silently ignored: withenv_nested_delimiter="_", pydantic-settings explodedCORS_ALLOW_ORIGINSintocors.allow.origins, which was dropped. Only theCORS={...}JSON form worked, so restricted origins silently stayed*. This happens with every pydantic-settings version I tried (2.10.1 through 2.14.1), not only the latest.Changes:
env_nested_max_split=1soCORS_ALLOW_ORIGINSmaps tocors.allow_origins.ITEMS_FILTER_CLS/ARGS/KWARGSare unaffected.NoDecodeso the documented comma-separated form works, the same wayroot_path_skip_prefixesalready does.pydantic-settings>=2.8.0; 2.7.0 doesn't supportenv_nested_max_split, which I confirmed by testing it.Tests cover the
CORS_*form, theCORS={...}JSON form, andITEMS_FILTER_*still parsing.test_cors_env_varsfails onmain.🤖 Generated with Claude Code