fix: Python 3.10-compatible add_note pollution test; drop em dashes from 3.2.1 notes - #642
Merged
Conversation
Signed-off-by: Fernando Macedo <fgmacedo@gmail.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #642 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 52 52
Lines 5572 5572
Branches 879 879
=========================================
Hits 5572 5572
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:
|
BaseException.add_note only exists on Python 3.11+ (PEP 678), so asserting callable(TransitionNotAllowed.add_note) raised AttributeError on 3.10. Assert on the injection site (the class __dict__) instead, which is version-agnostic and directly checks the blocked exploit did not set add_note = 1. Signed-off-by: Fernando Macedo <fgmacedo@gmail.com>
|
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.



Two small post-3.2.1 housekeeping changes.
TransitionNotAllowedclass-pollution regression added in the 3.2.1 security work assertedcallable(TransitionNotAllowed.add_note), butBaseException.add_noteonly exists on Python 3.11+ (PEP 678), so it raisedAttributeErroron 3.10 (the build matrix caught it; 3.11-3.14 were green). The assertion now checks the injection site (the class__dict__), which is version-agnostic and directly verifies the blocked exploit did not setadd_note = 1. Verified passing on Python 3.10. The library itself was always fine on 3.10; only the test assertion was version-specific.docs/io/security.mdbackground section, and onespec_parser.pycomment. Pre-existing em dashes elsewhere are left untouched.Docs, tests and comments only, no behavior change.