sso_*: prevent copying of session between upstreams#299
Merged
Jusshersmith merged 1 commit intomasterfrom Jul 28, 2020
Merged
Conversation
Codecov Report
@@ Coverage Diff @@
## master #299 +/- ##
==========================================
+ Coverage 61.94% 61.98% +0.03%
==========================================
Files 57 57
Lines 4638 4645 +7
==========================================
+ Hits 2873 2879 +6
- Misses 1553 1554 +1
Partials 212 212
Continue to review full report at Codecov.
|
460276a to
a94ea18
Compare
Integralist
approved these changes
Jul 24, 2020
| // that is being requested, so we trigger the start of the oauth flow. | ||
| // This exists primarily to implement some form of grace period while this additional session | ||
| // check is being introduced. | ||
| p.OAuthStart(rw, req, tags) |
There was a problem hiding this comment.
Question: will this invalidate the current validated session for 'foo' upstream?
Contributor
Author
There was a problem hiding this comment.
It doesn't invalidate the session on the original upstream - and because it restarts the oauth flow for the new request/upstream the UX should be pretty seamless when this is triggered.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
We only revalidate group membership when the session is refreshed or revalidated, which means that if a user were to successfully authorize with upstream 'foo', then they can effectively skip group membership validation on a different upstream by making the request with a slightly altered version of the saved cookie from the 'foo' upstream (providing the session is still valid and hasn't expired).
Solution
Add a new
AuthorizedUpstreamvalue to the session which is used to compare the upstream the session has been validated against, to the requested upstream.The
AuthorizedUpstreamvalue is checked against the request host on each request. For the time being, when caught this check will re-trigger the start of the oauth flow, primarily to help introduce this additional check in a graceful manner.Example log line when triggered:
upstream-1.foo.iobeing the original upstream the session was used against, andupstream-2.foo.iobeing the newlyrequested upstream.
Notes