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

decode_base64_field doesn't allow to decode unpadded base64 strings #27021

Closed
michaelarnauts opened this issue Jul 22, 2021 · 1 comment · Fixed by #27311
Closed

decode_base64_field doesn't allow to decode unpadded base64 strings #27021

michaelarnauts opened this issue Jul 22, 2021 · 1 comment · Fixed by #27311
Labels
Team:Elastic-Agent Label for the Agent team

Comments

@michaelarnauts
Copy link
Contributor

It seems that decode_base64_field is using base64.StdEncoding.DecodeString to decode the string, but that function only supports unpadded strings. There also is a base64.RawStdEncoding.DecodeString function, but this one only supports unpadded strings.

#25817 tried to solve this by appending =-signs until the string was fully padded, but another solution could be to strip all the =-signs, and using base64.RawStdEncoding.DecodeString.

The use-case for this is to decode a JWT Authorisation header to extract the user_id field, like has been documented here. This example is using a script processor to add the padding however, and this isn't available in all *beat projects.

Version: packetbeat-7.13.4 (but actually all the latest libbeat-projects)
Operating System: Ubuntu 20.04

@botelastic botelastic bot added the needs_team Indicates that the issue/PR needs a Team:* label label Jul 22, 2021
@ChrsMark ChrsMark added the Team:Elastic-Agent Label for the Agent team label Jul 26, 2021
@elasticmachine
Copy link
Collaborator

Pinging @elastic/agent (Team:Agent)

@botelastic botelastic bot removed the needs_team Indicates that the issue/PR needs a Team:* label label Jul 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Team:Elastic-Agent Label for the Agent team
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants