Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

sso_*: prevent copying of session between upstreams#299

Merged

Conversation

Jusshersmith
Copy link
Contributor

@JusshersmithJusshersmith commentedJul 20, 2020
edited
Loading

Problem

Weonly revalidate group membershipwhen 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 adifferent 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 newAuthorizedUpstream value to the session which is used to compare the upstream the session has been validated against, to the requested upstream.
TheAuthorizedUpstream value 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:

{"authorized_upstream":"upstream-1.foo.io","level":"warning","msg":"session authorized against different upstream; restarting authentication","proxy_host":"upstream-2.foo.io","remote_address":"x.x.x.x","service":"sso-proxy","time":"2020-01-02 13:26:31.502","user":"foo.bar@email.com"}

upstream-1.foo.io being the original upstream the session was used against, andupstream-2.foo.io being the newly
requested upstream.

Notes

@codecov
Copy link

codecovbot commentedJul 20, 2020
edited
Loading

Codecov Report

Merging#299 intomaster willincrease coverage by0.03%.
The diff coverage is85.71%.

Impacted file tree graph

@@            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
Impacted FilesCoverage Δ
internal/pkg/sessions/session_state.go85.00% <ø> (ø)
internal/proxy/oauthproxy.go55.05% <85.71%> (+0.51%)⬆️

Continue to review full report at Codecov.

Legend -Click here to learn more
Δ = absolute <relative> (impact),ø = not affected,? = missing data
Powered byCodecov. Last update0060ecd...a94ea18. Read thecomment docs.

@JusshersmithJusshersmith self-assigned thisJul 20, 2020
@JusshersmithJusshersmithforce-pushed thejusshersmith-track-authorised-upstreams branch from460276a toa94ea18CompareJuly 20, 2020 15:41
// 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)

Choose a reason for hiding this comment

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

Question: will this invalidate the current validated session for 'foo' upstream?

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

It doesn't invalidate the session on the original upstream - and because it restarts the oauth flow for thenew request/upstream the UX should be pretty seamless when this is triggered.

@JusshersmithJusshersmith merged commit56c9209 intomasterJul 28, 2020
@JusshersmithJusshersmith deleted the jusshersmith-track-authorised-upstreams branchJuly 28, 2020 15:27
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@IntegralistIntegralistIntegralist approved these changes

Assignees

@JusshersmithJusshersmith

Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

2 participants
@Jusshersmith@Integralist

[8]ページ先頭

©2009-2025 Movatter.jp