-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
Escape $request_uri for external auth #2811
Escape $request_uri for external auth #2811
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2811 +/- ##
==========================================
+ Coverage 47.33% 47.34% +0.01%
==========================================
Files 75 75
Lines 5413 5413
==========================================
+ Hits 2562 2563 +1
+ Misses 2527 2525 -2
- Partials 324 325 +1
Continue to review full report at Codecov.
|
Thanks @takonomura, would you mind adding an e2e test for this? |
636ca10
to
0f125d1
Compare
test/e2e/framework/httpbin.go
Outdated
return f.NewHttpbinDeploymentWithReplicas(1) | ||
} | ||
|
||
// NewHttpbinDeploymentWithReplicas creates a new deployment of the echoserver image in a particular namespace. Number of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like a lot of repetitive code just for using a different image.
510315a
to
ed84fc7
Compare
ed84fc7
to
3ce0ad9
Compare
I added e2e tests and the CI passed. |
/lgtm Thanks @takonomura! |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: antoineco, takonomura The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
The current sample configuration for kubernetes ingress demonstrates using the `auth-signin` annotation to redirect a user to oauth2_proxy's signin page. It constructs the link to do so by directly concatenating `$request_uri` as the `rd` parameter, so the sign-in page knows where to send the user after signin is complete. However, this does not work correctly if the original request URI contains multiple query parameters separated by an ampersand, as that ampersand is interpereted as separating query parameters of the `/oauth2/start` URI. For example: If the user requests a URL: https://example.com/foo?q1=v1&q2=v2 they may be redirected to the signin url https://example.com/oauth2/start?rd=https://example.com/foo?q1=v1&q2=v2 and after completing signin, oauth2_proxy will redirect them to https://example.com/foo?q1=v1 nginx-ingress added an $escaped_request_uri variable about a year ago, to help resolve this kind of issue (kubernetes/ingress-nginx#2811)
What this PR does / why we need it:
Escape
$request_uri
to correct external auth redirectWhich issue this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close that issue when PR gets merged): fixes #Special notes for your reviewer:
How to reproduce issue:
https://foo.bar.com/?a=b&c=d
(without signed in)https://foo.bar.com/?a=b
(c=d
is out)