What was broken MacAddress accepted octets with a sign or space
validate_mac_address converted each octet with int(..., 16), which accepts a plus or minus sign and whitespace. The address -a:-b:-c:-d:-e:-f passed unchanged, and +a:+b:+c:+d:+e:+f was silently turned into 0a:0b:0c:0d:0e:0f, an address nobody provided.
How we fixed it An octet is exactly two hex digits
Before conversion both characters of an octet must be in string.hexdigits. Otherwise validation raises the same mac_address_format error as for other malformed octets, and new test cases cover the colon and dot formats.
#424
What was broken No type for a SHA-256 digest
Pydantic has a Base64Str type, but a SHA-256 digest, such as a file checksum, had to be checked with a hand-written validator. The issue asking for such a type pointed to Base64Str as the model.
How we fixed it Sha256Str: 64 hex characters, lowercased
The new Sha256Str type strips whitespace, lowercases the letters and requires exactly 64 hexadecimal characters. The rule is a str_schema pattern, so it also shows up in the JSON schema, and tests reject a 0x prefix and non-ASCII digits among others.
#433