Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow non-padded base64 data to be decoded by decode_base64_field (#2…
…7311) (#27554) ## What does this PR do? This change allows the decoding of any raw base64 input strings that were previously encoded without standard padding character (`=`). By stripping the padding, we can use `base64.RawStdEncoding.DecodeString` to decode the base64 string. This is easier than appending the padding characters. Another attempt to fix this has been made in #25817, but that PR has been closed. ## Why is it important? When attempting to decode the payload (middle) section of a JWT token, it was discovered that the decode was failing, because padding characters are not included in a JWT token string. Padding is not required in base64, so it makes sense to allow to decode both unpadded and padded strings. Currently, there is a workaround for some beats by appending the `=`-signs in a javascript processor, but that isn't available in all beats and is an ugly workaround anyway. See https://medium.com/@guyromb/decode-jwt-traefik-access-logs-using-filebeat-95d935eb7c4f Co-authored-by: Adrian Serrano <adrisr83@gmail.com> (cherry picked from commit 9c4f7f9) Co-authored-by: Michaël Arnauts <michael.arnauts@gmail.com>
- Loading branch information