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

Issue 978: Fix Custom cookie name breaks redis for session #1949

Conversation

miguelborges99
Copy link
Contributor

@miguelborges99 miguelborges99 commented Dec 25, 2022

…://github.com//issues/978)

Allow cookie names with dots in redis sessions

Description

Ticket decoding was failing when cookie name had dots in it and using redis. To avoid such issues, ticket ID is encoded with base64. The ticket is now encoded using the format: {encoding version}.{ticketID base64}.{ticketSecret base 64}. This will allow to decode properly for different enconding versions.

Motivation and Context

Some users configure cookie name with dots and oauth2-proxy fails.
See issue 978.

How Has This Been Tested?

Needs to be tested.

Checklist:

  • My change requires a change to the documentation or CHANGELOG.
  • I have updated the documentation/CHANGELOG accordingly.
  • I have created a feature (non-master) branch for my PR.

@miguelborges99 miguelborges99 requested a review from a team as a code owner December 25, 2022 20:39
Copy link
Member

@JoelSpeed JoelSpeed left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please make sure we have tests for decoding both the new and old style tickets to prove we won't break anyone going forward

pkg/sessions/persistence/ticket.go Outdated Show resolved Hide resolved
pkg/sessions/persistence/ticket.go Outdated Show resolved Hide resolved
Copy link
Member

@tuunit tuunit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@miguelborges99 I would like to request that you split the test you adapted into two and explicitly test the old and new method and name the tests accordingly. Everything else LGTM.

pkg/sessions/persistence/ticket.go Outdated Show resolved Hide resolved
pkg/sessions/persistence/ticket.go Outdated Show resolved Hide resolved
pkg/sessions/persistence/ticket.go Outdated Show resolved Hide resolved
pkg/sessions/persistence/ticket.go Outdated Show resolved Hide resolved
Copy link
Member

@tuunit tuunit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @miguelborges99 please rebase your branch with the current master. Furthermore please wrap the errors as mentioned in the comments, to have a better error tracing.

CHANGELOG.md Outdated Show resolved Hide resolved
pkg/sessions/persistence/ticket_test.go Show resolved Hide resolved
CHANGELOG.md Outdated Show resolved Hide resolved
@tuunit
Copy link
Member

tuunit commented Sep 18, 2023

Hi @miguelborges99, do you think we can get the tests done until friday? This way we would be able to merge it and release it as part of the 7.5.1 patch release on friday.

@tuunit
Copy link
Member

tuunit commented Sep 19, 2023

Hi @miguelborges99, do you think we can get the tests done until friday? This way we would be able to merge it and release it as part of the 7.5.1 patch release on friday.

@miguelborges99 will you be able to work on the comments mentioned in the review? Otherwise you could give me collaborator access on your fork and I'll be able to finalize the PR for you :)

@tuunit tuunit added this to the v7.5.1 milestone Sep 19, 2023
@JoelSpeed
Copy link
Member

JoelSpeed commented Sep 22, 2023

@miguelborges99 If you can fix up the changelog and wrap the errors I highlighted, then I think we can get this merged

@miguelborges99
Copy link
Contributor Author

@miguelborges99 If you can fix up the changelog and wrap the errors I highlighted, then I think we can get this merged

Sorry, I can only see this probably in the weekend.

@tuunit tuunit removed this from the v7.5.1 milestone Sep 26, 2023
@tuunit tuunit added this to the v7.6.0 milestone Sep 26, 2023
@miguelborges99
Copy link
Contributor Author

miguelborges99 commented Nov 12, 2023

@tuunit : Sorry for the delay. The request for changes were done.

@tuunit
Copy link
Member

tuunit commented Nov 18, 2023

@tuunit : Sorry for the delay. The request for changes were done.

No worries, its on your free time therefore I'm thankful you keep the PRs up to date :)

CHANGELOG.md Outdated Show resolved Hide resolved
@JoelSpeed JoelSpeed merged commit 1e61b65 into oauth2-proxy:master Nov 18, 2023
6 checks passed
@miguelborges99 miguelborges99 deleted the custom_cookie_name_breaks_redis_for_session branch November 18, 2023 15:59
tuunit pushed a commit to tuunit/oauth2-proxy that referenced this pull request Nov 20, 2023
…oxy#1949)

* Issue 978: Fix Custom cookie name breaks redis for session (see oauth2-proxy#978)

* Issue 978: Fix Custom cookie name breaks redis for session (see oauth2-proxy#978)

* Update CHANGELOG.md

* Issue 978: Fix Custom cookie name breaks redis for session

* Issue 978: Fix Custom cookie name breaks redis for session

* Issue 978: Fix Custom cookie name breaks redis for session

* Issue 978: Fix Custom cookie name breaks redis for session

* Issue 978: Fix Custom cookie name breaks redis for session

* Issue 978: Fix Custom cookie name breaks redis for session

* Update CHANGELOG.md

---------

Co-authored-by: Nuno Borges <Nuno.Borges@ctw.bmwgroup.com>
Co-authored-by: Joel Speed <Joel.speed@hotmail.co.uk>
tuunit pushed a commit to tuunit/oauth2-proxy that referenced this pull request Nov 20, 2023
…oxy#1949)

* Issue 978: Fix Custom cookie name breaks redis for session (see oauth2-proxy#978)

* Issue 978: Fix Custom cookie name breaks redis for session (see oauth2-proxy#978)

* Update CHANGELOG.md

* Issue 978: Fix Custom cookie name breaks redis for session

* Issue 978: Fix Custom cookie name breaks redis for session

* Issue 978: Fix Custom cookie name breaks redis for session

* Issue 978: Fix Custom cookie name breaks redis for session

* Issue 978: Fix Custom cookie name breaks redis for session

* Issue 978: Fix Custom cookie name breaks redis for session

* Update CHANGELOG.md

---------

Co-authored-by: Nuno Borges <Nuno.Borges@ctw.bmwgroup.com>
Co-authored-by: Joel Speed <Joel.speed@hotmail.co.uk>
tuunit pushed a commit to tuunit/oauth2-proxy that referenced this pull request Dec 17, 2023
…oxy#1949)

* Issue 978: Fix Custom cookie name breaks redis for session (see oauth2-proxy#978)

* Issue 978: Fix Custom cookie name breaks redis for session (see oauth2-proxy#978)

* Update CHANGELOG.md

* Issue 978: Fix Custom cookie name breaks redis for session

* Issue 978: Fix Custom cookie name breaks redis for session

* Issue 978: Fix Custom cookie name breaks redis for session

* Issue 978: Fix Custom cookie name breaks redis for session

* Issue 978: Fix Custom cookie name breaks redis for session

* Issue 978: Fix Custom cookie name breaks redis for session

* Update CHANGELOG.md

---------

Co-authored-by: Nuno Borges <Nuno.Borges@ctw.bmwgroup.com>
Co-authored-by: Joel Speed <Joel.speed@hotmail.co.uk>
tuunit pushed a commit to tuunit/oauth2-proxy that referenced this pull request Dec 18, 2023
…oxy#1949)

* Issue 978: Fix Custom cookie name breaks redis for session (see oauth2-proxy#978)

* Issue 978: Fix Custom cookie name breaks redis for session (see oauth2-proxy#978)

* Update CHANGELOG.md

* Issue 978: Fix Custom cookie name breaks redis for session

* Issue 978: Fix Custom cookie name breaks redis for session

* Issue 978: Fix Custom cookie name breaks redis for session

* Issue 978: Fix Custom cookie name breaks redis for session

* Issue 978: Fix Custom cookie name breaks redis for session

* Issue 978: Fix Custom cookie name breaks redis for session

* Update CHANGELOG.md

---------

Co-authored-by: Nuno Borges <Nuno.Borges@ctw.bmwgroup.com>
Co-authored-by: Joel Speed <Joel.speed@hotmail.co.uk>
JoelSpeed added a commit that referenced this pull request Dec 18, 2023
* Add GitHub groups (orgs/teams) support

* align code of getTeams with getOrgs to support Github Enterprise Server instances with different domain

* add documentation

* add missing import after rebase

* add nightly build and push (#2297)

* add nightly build and push

* add date based nightly build tags

* only keep single multiarch image build and push

* add changelog

* add images to internal docs static files

* add docu for nightly builds

* remove unnecessary spaces

* update nightly repository

* Issue 978: Fix Custom cookie name breaks redis for session (#1949)

* Issue 978: Fix Custom cookie name breaks redis for session (see #978)

* Issue 978: Fix Custom cookie name breaks redis for session (see #978)

* Update CHANGELOG.md

* Issue 978: Fix Custom cookie name breaks redis for session

* Issue 978: Fix Custom cookie name breaks redis for session

* Issue 978: Fix Custom cookie name breaks redis for session

* Issue 978: Fix Custom cookie name breaks redis for session

* Issue 978: Fix Custom cookie name breaks redis for session

* Issue 978: Fix Custom cookie name breaks redis for session

* Update CHANGELOG.md

---------

Co-authored-by: Nuno Borges <Nuno.Borges@ctw.bmwgroup.com>
Co-authored-by: Joel Speed <Joel.speed@hotmail.co.uk>

* Support http.AllowQuerySemicolons (#2248)

* Support http.AllowQuerySemicolons

* Docs

* Make it clear we are overriding the handler

* Update documentation for allow-query-semicolons

* Fix changelog format

* Fix formatting

---------

Co-authored-by: MickMake <github@mickmake.com>

* Add GitHub groups (orgs/teams) support

* align code of getTeams with getOrgs to support Github Enterprise Server instances with different domain

* add documentation

* fix changelog & documentation

* fix missing import

---------

Co-authored-by: Tobias Mayer <github@tobiasm.de>
Co-authored-by: Nuno Miguel Micaelo Borges <miguelborges99@gmail.com>
Co-authored-by: Nuno Borges <Nuno.Borges@ctw.bmwgroup.com>
Co-authored-by: Joel Speed <Joel.speed@hotmail.co.uk>
Co-authored-by: Tim White <tim.white@su.org.au>
Co-authored-by: MickMake <github@mickmake.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants