Skip to content
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

lua-resty-openidc requires issuer to be == to the discovery URL domain #219

Closed
gdestuynder opened this issue Oct 31, 2018 · 4 comments
Closed

Comments

@gdestuynder
Copy link
Contributor

gdestuynder commented Oct 31, 2018

I believe that is incorrect (https://openid.net/specs/openid-connect-core-1_0.html#IssuerIdentifier) ("correct me if im wrong! :)")

For ex you could have an issuer of example.com and a discovery URL of https://example2.com/.well-known/openid-configuration

Auth0.com does this with custom auth domains, so I suspect anyone using that feature of auth0 with this library will eventually get this issue.

Error looks like:

openidc.lua:495: openidc_discover(): issuer field in Discovery data does not match URL, client: 13.37.13.37, server: social-ldap-pwless.testrp.security.allizom.org, request: "GET / HTTP/1.1", host: "social-ldap-pwless.testrp.security.allizom.org"

The lib check is at:

if string.sub(url, 1, string.len(json['issuer'])) == json['issuer'] then
openidc_cache_set("discovery", url, cjson.encode(json), exptime or 24 * 60 * 60)
else
err = "issuer field in Discovery data does not match URL"

@bodewig do you know more about this? I'm happy to send a PR that removes the check otherwise

@zandbelt
Copy link
Contributor

zandbelt commented Nov 1, 2018

The check is according to https://openid.net/specs/openid-connect-discovery-1_0.html#Impersonation but since lua-resty-openidc doesn't actually discover the metadata document but uses a fixed URI, I guess it is OK to relax this check.

@bodewig
Copy link
Collaborator

bodewig commented Nov 1, 2018

I agree. Most likely we'll need yet another option unless we want to remove the check completely.

@zandbelt
Copy link
Contributor

zandbelt commented Nov 1, 2018

Since we explicitly point the code to a Discovery document that is served from a TLS protected endpoint, there's no mapping between an identifier and the document that can be tampered with and I'm OK to comment out the check.

@bodewig bodewig closed this as completed in 85aeeb9 Nov 3, 2018
@bodewig
Copy link
Collaborator

bodewig commented Nov 3, 2018

OK, I've removed the check.

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

No branches or pull requests

3 participants