-
Notifications
You must be signed in to change notification settings - Fork 94
Error log verbosity enhanced #111
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
base: main
Are you sure you want to change the base?
Conversation
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.
You are accessing headers by index using the original casing, so the case matters here. See https://nginx.org/en/docs/njs/reference.html#r_headers_in
@@ -131,21 +131,21 @@ function validateIdTokenClaims(r, claims) { | |||
const missingClaims = requiredClaims.filter((claim) => !claims[claim]); | |||
|
|||
if (missingClaims.length > 0) { | |||
r.error(`OIDC ID Token validation error: missing claim(s) ${missingClaims.join(' ')}`); | |||
r.error(`OIDC ID Token validation error for " + r.headersIn['host'] + r.uri + ": missing claim(s) ${missingClaims.join(' ')}`); |
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.
Looks like a copy-paste error, and r.headersIn will be logged as a literal.
return false; | ||
} | ||
|
||
// Audience must include the configured client | ||
const aud = Array.isArray(claims.aud) ? claims.aud : claims.aud.split(','); | ||
if (!aud.includes(r.variables.oidc_client)) { | ||
r.error(`OIDC ID Token validation error: aud claim (${claims.aud}) ` + | ||
r.error(`OIDC ID Token validation error for " + r.headersIn['host'] + r.uri + ": aud claim (${claims.aud}) ` + |
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.
Same thing here, it will be logged as a literal.
@@ -160,12 +160,12 @@ function validateIdTokenClaims(r, claims) { | |||
: ''; | |||
|
|||
if (claims.nonce !== clientNonceHash) { | |||
r.error(`OIDC ID Token validation error: nonce from token (${claims.nonce}) ` + | |||
r.error(`OIDC ID Token validation error for " + r.headersIn['host'] + r.uri + ": nonce from token (${claims.nonce}) ` + |
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.
it will be logged as a literal
if (tokenset.error) { | ||
r.error("OIDC " + tokenset.error + " " + tokenset.error_description); | ||
r.error("OIDC for " + r.headersIn['host'] + r.uri + " " + tokenset.error + " " + tokenset.error_description); |
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.
looks like the word "error" is missing
@@ -373,7 +373,7 @@ async function handleFrontChannelLogout(r) { | |||
|
|||
const claims = await getTokenClaims(r, sessionJwt); | |||
if (claims.iss !== requestIss) { | |||
r.error("Issuer mismatch during logout. Received iss: " + | |||
r.error("Issuer mismatch during logout for " + r.headersIn['host'] + r.uri + " Received iss: " + |
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.
A separator is missing
`does not match client (${clientNonceHash})`); | ||
return false; | ||
} | ||
} else if (isNewSession(r)) { | ||
r.error("OIDC ID Token validation error: " + | ||
r.error("OIDC ID Token validation error for " + r.headersIn['host'] + r.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.
There is an extra concatenation
Added HTTP Host and URI to all error logs