Skip to content

Docs: oauth2-proxy cookie secret command uses outdated syntax #50

@clementpsp

Description

@clementpsp

Describe the bug

Recommended oauth2-proxy cookie secret generation command does not follow python3 syntax: https://github.com/search?q=repo%3ASAP%2Fkubeapps%20urlsafe_b64encode&type=code

Ref: https://docs.python.org/3/whatsnew/3.0.html#print-is-a-function

To Reproduce
Steps to reproduce the behavior:

$ python3 -c 'import os,base64; print base64.urlsafe_b64encode(os.urandom(16))'
  File "<string>", line 1
    import os,base64; print base64.urlsafe_b64encode(os.urandom(16))
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?

Expected behavior

On python2, that command would have produced something like:

$ python -c 'import os,base64; print base64.urlsafe_b64encode(os.urandom(16))'
7jp5YGiuIPeq0Gg0lB4Uxg==

The python3 base64.urlsafe_b64encode also has a few changes, including:

return the encoded bytes.

To produce output equivalent with the python2 version, oauth2-proxy now recommends:

python -c 'import os,base64; print(base64.urlsafe_b64encode(os.urandom(32)).decode())'

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentation

    Type

    No type

    Projects

    Status

    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions