Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[7.x](backport #27311) Fix: Allow non-padded base64 data to be decoded by decode_base64_field #27554

Merged
merged 1 commit into from
Aug 24, 2021

Conversation

mergify[bot]
Copy link
Contributor

@mergify mergify bot commented Aug 23, 2021

This is an automatic backport of pull request #27311 done by Mergify.


Mergify commands and options

More conditions and actions can be found in the documentation.

You can also trigger Mergify actions by commenting on this pull request:

  • @Mergifyio refresh will re-evaluate the rules
  • @Mergifyio rebase will rebase this PR on its base branch
  • @Mergifyio update will merge the base branch into this PR
  • @Mergifyio backport <destination> will backport this PR on <destination> branch

Additionally, on Mergify dashboard you can:

  • look at your merge queues
  • generate the Mergify configuration with the config editor.

Finally, you can contact us on https://mergify.io/

…7311)

## 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)
@mergify mergify bot added the backport label Aug 23, 2021
@botelastic botelastic bot added the needs_team Indicates that the issue/PR needs a Team:* label label Aug 23, 2021
@botelastic
Copy link

botelastic bot commented Aug 23, 2021

This pull request doesn't have a Team:<team> label.

@elasticmachine
Copy link
Collaborator

💚 Build Succeeded

the below badges are clickable and redirect to their specific view in the CI or DOCS
Pipeline View Test View Changes Artifacts preview preview

Expand to view the summary

Build stats

  • Start Time: 2021-08-23T15:47:04.017+0000

  • Duration: 182 min 58 sec

  • Commit: b2e810f

Test stats 🧪

Test Results
Failed 0
Passed 52988
Skipped 5267
Total 58255

Trends 🧪

Image of Build Times

Image of Tests

💚 Flaky test report

Tests succeeded.

Expand to view the summary

Test stats 🧪

Test Results
Failed 0
Passed 52988
Skipped 5267
Total 58255

@kvch kvch merged commit c03c14c into 7.x Aug 24, 2021
@mergify mergify bot deleted the mergify/bp/7.x/pr-27311 branch August 24, 2021 12:44
@mergify
Copy link
Contributor Author

mergify bot commented Nov 23, 2021

This pull request is now in conflicts. Could you fix it? 🙏
To fixup this pull request, you can check out it locally. See documentation: https://help.github.com/articles/checking-out-pull-requests-locally/

git fetch upstream
git checkout -b mergify/bp/7.x/pr-27311 upstream/mergify/bp/7.x/pr-27311
git merge upstream/7.x
git push upstream mergify/bp/7.x/pr-27311

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport needs_team Indicates that the issue/PR needs a Team:* label
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants