Skip to content

Conversation

jonas
Copy link
Contributor

@jonas jonas commented Jun 14, 2019

Description

Fix an unsupported protocol scheme error when validating tokens by
ensuring that the ValidateURL generates a non-empty string. The Azure
provider doesn't define any ValidateURL and therefore uses the default
value of url.Parse("") which is not nil.

Motivation and Context

The following log summary shows the issue:

2019/06/14 12:26:04 oauthproxy.go:799: 10.244.1.3:34112 ("10.244.1.1") refreshing 16h26m29s old session cookie for Session{email:jonas.fonseca@example.com user:jonas.fonseca token:true} (refresh after 1h0m0s)
2019/06/14 12:26:04 internal_util.go:60: GET ?access_token=eyJ0...
2019/06/14 12:26:04 internal_util.go:61: token validation request failed: Get ?access_token=eyJ0...: unsupported protocol scheme ""
2019/06/14 12:26:04 oauthproxy.go:822: 10.244.1.3:34112 ("10.244.1.1") removing session. error validating Session{email:jonas.fonseca@example.com user:jonas.fonseca token:true}

How Has This Been Tested?

No.

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.

@jonas jonas requested a review from a team June 14, 2019 15:54
@jonas jonas changed the title Only validate tokens if ValidateURL is resolves to a non-empty string Only validate tokens if ValidateURL resolves to a non-empty string Jun 14, 2019
@jonas jonas force-pushed the check-against-validate-url-string branch 2 times, most recently from 93f2d23 to af553bf Compare June 14, 2019 16:16
Fix an unsupported protocol scheme error when validating tokens by
ensuring that the ValidateURL generates a non-empty string. The Azure
provider doesn't define any ValidateURL and therefore uses the default
value of `url.Parse("")` which is not `nil`.

The following log summary shows the issue:

    2019/06/14 12:26:04 oauthproxy.go:799: 10.244.1.3:34112 ("10.244.1.1") refreshing 16h26m29s old session cookie for Session{email:jonas.fonseca@example.com user:jonas.fonseca token:true} (refresh after 1h0m0s)
    2019/06/14 12:26:04 internal_util.go:60: GET ?access_token=eyJ0...
    2019/06/14 12:26:04 internal_util.go:61: token validation request failed: Get ?access_token=eyJ0...: unsupported protocol scheme ""
    2019/06/14 12:26:04 oauthproxy.go:822: 10.244.1.3:34112 ("10.244.1.1") removing session. error validating Session{email:jonas.fonseca@example.com user:jonas.fonseca token:true}
@jonas jonas force-pushed the check-against-validate-url-string branch from af553bf to 7a8fb58 Compare June 14, 2019 16:52
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.

Just had a look through the code and this basically acts as a shortcut for a case we know will always fail. It skips us attempting to make a request so seems like a strict improvement and the test for the empty validateURL expects a false answer anyway, so I think this is good! Thanks for the fix!

@JoelSpeed JoelSpeed merged commit 77e1fff into oauth2-proxy:master Jun 15, 2019
@jonas
Copy link
Contributor Author

jonas commented Jun 15, 2019

Thanks @JoelSpeed for the quick turn-around. This project has been invaluable. I will look into also updating the documentation for the Azure provider. They recently changed the Azure portal and the required Azure Active Directory Graph API permissions has moved under "legacy APIs".

@jonas jonas deleted the check-against-validate-url-string branch June 15, 2019 15:05
T-vK pushed a commit to T-vK/oauth2-proxy that referenced this pull request Nov 20, 2024
…2-proxy

Upgrade to the latest version of OAuth2-Proxy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants