996db5006ccb1c03e0da6cfeb3e4163fd9b1ca98
MacAddress.validate_mac_address parsed each octet with int(part, 16), which also accepts a leading +/- sign and surrounding whitespace. As a result strings like -a:-b:-c:-d:-e:-f, +a:+b:+c:+d:+e:+f and " a: b: c: d: e: f" were accepted, with the sign/whitespace variants silently normalized into a valid-looking MAC the caller never supplied. Require both characters of each octet to be hex digits before the int() conversion so malformed octets raise the mac_address_format error like other invalid input.
Description
My contributions to pydantic/pydantic-extra-types: 2 commits, 2 merged PRs
61 KiB
0 Stars
1 Watchers
0 Forks
Languages
Python
100%