Skip to content

OIDC + Python3 + Incorrect padding during base64decode #525

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

Closed
nabadger opened this issue Apr 30, 2018 · 19 comments
Closed

OIDC + Python3 + Incorrect padding during base64decode #525

nabadger opened this issue Apr 30, 2018 · 19 comments

Comments

@nabadger
Copy link

Using 3.6.5

  File "/usr/lib/python3.6/site-packages/kubernetes-6.0.0_snapshot-py3.6.egg/kubernetes/config/kube_config.py", line 474, in load_kube_config
  File "/usr/lib/python3.6/site-packages/kubernetes-6.0.0_snapshot-py3.6.egg/kubernetes/config/kube_config.py", line 355, in load_and_set
  File "/usr/lib/python3.6/site-packages/kubernetes-6.0.0_snapshot-py3.6.egg/kubernetes/config/kube_config.py", line 185, in _load_authentication
  File "/usr/lib/python3.6/site-packages/kubernetes-6.0.0_snapshot-py3.6.egg/kubernetes/config/kube_config.py", line 237, in _load_oid_token
  File "/usr/lib/python3.6/base64.py", line 87, in b64decode
    return binascii.a2b_base64(s)
binascii.Error: Incorrect padding

When attempting to decode the token, I run into this issue in _load_oid_token

  if PY3:
    jwt_attributes = json.loads(
      base64.b64decode(parts[1]).decode('utf-8')
    )

The non py3 block appends "==" to the token part before decoding it. If i use that, it works fine.

@bcatubig
Copy link

Ran into this issue today as well on 3.6.4

@richerve
Copy link

richerve commented Aug 8, 2018

Same on 3.5.5 and 3.6.6.

This is the reference to the PR to fix this: kubernetes-client/python-base#70

@markuszoeller
Copy link

Same on Python 3.4

@zybjcdl
Copy link

zybjcdl commented Aug 22, 2018

@bpicolo Could you please help to fix the issue? We need to run python 3.6.5 with this client.

@cparedes
Copy link

Ran into the same issue with Python 3.7 with the latest version of this client (8.0.0 at this time of writing)

@AlexShemeshWix
Copy link

Same on 3.7.2 and 3.6.0

@rocktavious
Copy link

Same on python 3.7.2 + kubernetes 9.0.0

@joshbranham
Copy link

Anyone know why no fix for this has been merged?

@nabadger
Copy link
Author

@yliaog - would you (or any owner) be able to provide a comment on this? Just wondering what your thoughts are on this issue as it's been around for a while and probably affecting quite a large user base.

@yliaog
Copy link
Contributor

yliaog commented Apr 1, 2019

it looks @micw523 is reviewing the fix PR kubernetes-client/python-base#70, @micw523 do you have any further comment on the PR? we'd like to get it merged soon. Thanks.

@yliaog
Copy link
Contributor

yliaog commented Apr 1, 2019

/cc

@micw523
Copy link
Contributor

micw523 commented Apr 1, 2019

Hi @yliaog, kubernetes-client/python-base#70 seems to have been abandoned and the fork does not exist any more. kubernetes-client/python-base#79 is active and seems like the author just pushed some new commits.

However, due to the new version of minikube, we need to have #797 merged first to unblock the PRs. We can’t have the CI to pass unless we get that one through.

@yliaog
Copy link
Contributor

yliaog commented Apr 1, 2019

Thanks @micw523 i've lgtm'ed #797

and minor correction, the PR actively worked on is in python-base repo:
kubernetes-client/python-base#79

@switchboardOp
Copy link

switchboardOp commented Apr 15, 2019

#797 has merged and it looks like kubernetes-client/python-base#79 passed CI...
Just waiting on approval there?

@TechnoTaff
Copy link

Can I bump this? My existing code is Python 3.6 and I can't port it back to 2.x due to other libraries. The PR works for me, can we get it pushed into PyPi plz? Thank you.

@AlexShemeshWix
Copy link

Any updates?

@roycaihw
Copy link
Member

/cc @roycaihw

@r0fls
Copy link

r0fls commented Jun 19, 2019

Is there any workaround? 🤔

@roycaihw
Copy link
Member

fixed in kubernetes-client/python-base#79

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests