-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Support for a whitelist of --redirect-domains
#399
Comments
Actually, I'm not sure I understand why the redirect locations needs to be limited... is that a security concern as well? Thanks! |
@colemickens Thanks for this PR; i'll hopefully get to look through it soon. There is a security aspect to restricting redirect domains. This is to protect against an attacker crafting a URL with a malicious redirect parameter that will send you through the oauth2_proxy auth flow as you would expect, but then redirect to a malicious site after authentication. A user should only end on an authorized URL after authentication. This eliminates many avenues of phishing and other social engineering. |
also discussed in #378 |
Not a PR yet, just curious if it would be desired/accepted before I write it. I've confirmed that just removing those filtering lines mentioned unblocks my scenario, but I don't want to continue to use that if it's insecure and would prefer to just use upstream instead of my fork anyway. @jehiah I'm not sure I understand your comments about the redirect, though. Regardless of the scrubbing done today, the "redirect" that is handed to GitHub is always the oauth2_proxy callback endpoint (by nature, GitHub will only allow redirect to that URL anyway). The thing being scrubbed here is the "second" redirect that oauth2_proxy handles inside the callback function (by decomposing state into the |
The concern is not the authorization code (or token), it's social engineering aka "phishing". For example: Attacker sends user a email or something with a link "access the secure benefits application form on not as much detail there, but the original issue and PR for this: #228 #359 |
Okay, thank you, that makes more sense. In that case, it seems like manually white listing some redirect host suffixes would be acceptable. I'll add this sometime soon unless someone jumps in and says it's a bad idea. Thanks all. |
Allows redirection to URLs on other domains. Specify one or several domains (including port number). You can also specify "*" if you want to allow all redirect domains. Fixes bitly#399
Per my comments here, I'd like to add support for
--redirect-domains
to take a comma-delimited list of whitelisted redirect domains.Example scenario:
httpd
fronting a static directoryhttpd
fronting a different static directoryCurrently, I can't seem to get things to work properly in terms of handling the redirect after the callback succeeds.
It seems like it's due to the filtering that happens here:
oauth2_proxy/oauthproxy.go
Line 419 in 6d6cb7e
The same logic seems duplicated here:
oauth2_proxy/oauthproxy.go
Line 551 in 6d6cb7e
I propose a PR such that:
there is a new
--redirect-domains
flag that takes a list of domains. example: (--redirect-domains=mickens.io,mickens.us
).the redirect filter is extended to allow any URLs that have a Host that ends with a value in the
--redirect-domain
list.Does this sound reasonable?
The text was updated successfully, but these errors were encountered: