The new Base64Attribute validator does not fail strictly, invalid Base64 strings

Issue #250 resolved
Sven Döring created an issue

With #214 the Base64 validation changed. It got faster, memory-optimizied and - in a way - even buggier.

The string "Base64" is strictly no valid Base64 string because the padding is missing. But Javas Base64 decoder does not care. Guavas Base64 decoder does not care. Apaches Base64 decoder does not care. …

Unfortunately Jacksons ObjectMapper does care and fails to deserialize that String into an byte array:

Unexpected end of base64-encoded String: base64 variant 'MIME-NO-LINEFEEDS' expects padding (one or more '=' characters) at the end

For the Base64Attribute this string is valid since v2.7.1. Prior that version the string was invalid.

The expected behaviour should be that the validation fails as before.

Comments (1)

  1. Log in to comment