-
Notifications
You must be signed in to change notification settings - Fork 44
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
Logging and misc improvements #133
base: master
Are you sure you want to change the base?
Conversation
Thanks for the contribution! I'll look a little more closely when I have a moment and provide some feedback. |
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.
Thanks for the contribution! That's a lot of logging ;)
} | ||
|
||
if ( | ||
pluginStrategy == PLUGIN_STRATEGY_OIDC && |
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.
This check needs to remain.
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.
Can you elaborate on this? We use OAuth2 and need it to validate nbf
and iss
.
} | ||
|
||
if ( | ||
pluginStrategy == PLUGIN_STRATEGY_OIDC && |
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.
This check needs to remain.
} | ||
|
||
if ( | ||
pluginStrategy == PLUGIN_STRATEGY_OIDC && |
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.
This check needs to remain.
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.
I don't understand this, is id_token assertions not available in OAuth2?
} | ||
|
||
if ( | ||
pluginStrategy == PLUGIN_STRATEGY_OIDC && |
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.
This check needs to remain.
plugin.config.assertions.access_token | ||
) { | ||
let accessToken; | ||
accessToken = jwt.decode(tokenSet.access_token); |
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.
Was this the line that was blowing up previously? Or was it something else?
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.
Yes, I believe the decode function doesn't handle undefined inputs
@@ -188,7 +188,7 @@ function get_parent_request_uri(req) { | |||
originalRequestURI = originalRequestURI.replace(/^(.+?)\/*?$/, "$1"); // remove all trailing slashes | |||
originalRequestURI += req.headers["x-forwarded-uri"]; | |||
} else { | |||
originalRequestURI += req.headers["x-forwarded-uri"]; | |||
originalRequestURI += req.headers["x-forwarded-uri"] || ''; |
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.
I'll think about this change. It should be handled differently but not sure how exactly :( it probably needs to throw an error if missing as the data is critical to function properly.
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.
Ok, throwing a hard error is much better than it being undefined as you'll be able to identify the problem quickly.
Hi, we've been playing around with this for a couple of days now and made some improvements you may want. They're mainly concerning logging to allow us to figure out what was happening on our end.
We found that if scope was only "openid offline_access" then of course no access_token is issued. While not a big problem
access_token = null
causedaccess_token_assertions
to throw an error. I added a check and a log entry in order to handle it gracefully, then did the same for id_token in case someone don't have openid in the scope.Lastly, like we discussed in #131 we got a domain
mydomain.comundefined
becausex-forwarded-uri
was assumed to have a value. So we added a fallback value as it's better to have no path than mess up the domain.