Repository navigation
Reject non-ASCII digits in card_number, uuid and cron - #508
Open
Shaisolaris wants to merge 1 commit into
Open
Shaisolaris wants to merge 1 commit into
Shaisolaris wants to merge 1 commit into
Conversation
int() and str.isdecimal() accept digits of other scripts, so values such as the Arabic-Indic form of 4242424242424242 passed card_number, and uuid and cron accepted them too. Require ASCII input before those checks.
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.
card_number,uuidandcronaccepted digits of other scripts, becauseint()andstr.isdecimal()accept them:Found by running each validator on its documented valid example with the ASCII digits replaced by Arabic-Indic digits.
ipv4,ipv6,mac_address,ibanand the hash validators already reject them.Each of the three now requires ASCII input before the existing checks (
str.isascii(); incrona small_is_numberhelper replacesisdecimal()).domain,hostnameandurlare left alone, since their labels may be internationalized.Tests: 9 new cases in
test_card.py,test_uuid.pyandtest_cron.py. They fail onmasterand pass with the change.pytest testswith thecrypto-eth-addressesextra installed: 1122 passed (1113 passed and 9 failed onmasterwith the new tests).ruff checkandruff formatare clean.