Repository navigation
Release 3.2.1: keep the signing key out of the malformed-JWK error - #165
Merged
Merged
Conversation
load_ucp_signing_key_from_env chained the JSONDecodeError onto the ValueError it raised, and that error holds the whole env value in .doc, so a malformed private JWK travelled with the exception into anything that records chained errors. The error now names the variable only and raises from None; a test asserts the value reaches neither the message nor the chain. Sweep: relock to current (fastapi 0.146, starlette 1.9, cdp-sdk 1.50, joserfc 1.7.7, pydantic-settings 2.16, ruff 0.17.1, ty 0.0.89), uv 0.13.1 in every workflow, and the gate and audit jobs on Python 3.15.
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.
Summary
Maintenance sweep for python-commerce, released as 3.2.1 because it carries one fix to shipped code (the Python mirror of node-commerce 3.1.2).
Fix: the signing key no longer travels with the malformed-JWK error.
load_ucp_signing_key_from_envraised its "is not valid JSON"ValueErrorfromtheJSONDecodeError, and that error keeps the whole input in.doc, which here is the private JWK. Anything that records chained exceptions (an error tracker, a traceback with locals) received the key. The error now names the variable only and raisesfrom None.Sweep:
uv sync --python 3.15, so the job uses that interpreter rather than whichever one uv finds first), and so does the pip-audit job. The test matrix still covers 3.11 through 3.15.Worked with Varun, as part of a three-session maintenance sweep.
Not done, on purpose: the
web3<8constraint stays. Its lift condition was re-tested: pympp 0.14.0 still requireseth-abi<6in both itstempoandstripeextras. Optional-extra floors are unchanged, since the published ranges already admit the new versions.Type of change
Public API
The malformed-JWK error's message is now
UCP_SIGNING_KEY_JWK_PRIVATE is not valid JSON.(or the configured variable name) without the decoder's position detail, and it no longer chains theJSONDecodeError. The exception type is unchanged.Test plan
A new test feeds a malformed value and asserts the message carries no part of it,
__cause__is None and the context is suppressed. It fails against the previousucp_jwks.pyand passes with the fix. Run locally on Python 3.15: ruff check, ruff format --check, ty (package and examples), vulture and pytest (1674 passed, 4 skipped), each exit 0. osv-scanner 2.7.0 over uv.lock reports no issues across 164 packages.Checklist