-
Couldn't load subscription status.
- Fork 154
Add additional logging to troubleshoot failed backchannel logout issu… #632
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: master
Are you sure you want to change the base?
Conversation
…es + don't show clientSecret/secret in debug logs
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.
Pull Request Overview
This PR enhances troubleshooting capabilities for backchannel logout functionality by adding additional debug logging while also improving security by redacting sensitive information from logs. The changes help developers identify specific failure points in the backchannel logout process while preventing accidental exposure of secrets.
- Added debug logging for missing logout tokens and JWT verification failures
- Redacted sensitive information (clientSecret and secret) from configuration debug logs
- Improved clarity of existing error logging messages
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| middleware/auth.js | Redacts clientSecret and secret values from configuration debug logs |
| lib/context.js | Adds debug logging for backchannel logout failures and improves existing error message clarity |
| const auth = function (params) { | ||
| const config = getConfig(params); | ||
| debug('configuration object processed, resulting configuration: %O', config); | ||
| debug('configuration object processed, resulting configuration: %O', {...config, clientSecret: "REDACTED", secret: "REDACTED"}); |
Copilot
AI
Jul 18, 2025
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.
The spread operator approach may not handle nested objects containing sensitive data. Consider using a dedicated function to recursively redact sensitive fields or ensure no nested sensitive data exists in the config object.
| debug('configuration object processed, resulting configuration: %O', {...config, clientSecret: "REDACTED", secret: "REDACTED"}); | |
| const redactSensitiveFields = (obj, fieldsToRedact) => { | |
| if (obj && typeof obj === 'object') { | |
| return Object.keys(obj).reduce((acc, key) => { | |
| acc[key] = fieldsToRedact.includes(key) | |
| ? "REDACTED" | |
| : redactSensitiveFields(obj[key], fieldsToRedact); | |
| return acc; | |
| }, Array.isArray(obj) ? [] : {}); | |
| } | |
| return obj; | |
| }; | |
| const redactedConfig = redactSensitiveFields(config, ['clientSecret', 'secret']); | |
| debug('configuration object processed, resulting configuration: %O', redactedConfig); |
| res.setHeader('cache-control', 'no-store'); | ||
| const logoutToken = req.body.logout_token; | ||
| if (!logoutToken) { | ||
| debug('req.oidc.backchannelLogout() failed due to missing logout token', req.body); |
Copilot
AI
Jul 18, 2025
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.
Logging the entire req.body could potentially expose sensitive information. Consider logging only non-sensitive fields or a sanitized version of the request body.
| debug('req.oidc.backchannelLogout() failed due to missing logout token', req.body); | |
| debug('req.oidc.backchannelLogout() failed due to missing logout token. logout_token present: %s', !!req.body.logout_token); |
|
Claude finished @gyaneshgouraw-okta's task —— View job I'll review this PR that adds logging for backchannel logout troubleshooting and redacts sensitive information from debug logs. Todo List
Review Complete ✅I've submitted a code review highlighting two security concerns that need to be addressed:
The PR improves troubleshooting capabilities but these security issues should be resolved before merging to prevent accidental exposure of sensitive information in debug logs. |
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.
Overall Assessment
❌ Security concerns need to be addressed
The PR improves troubleshooting capabilities but has two security issues:
- Request body logging exposure: The new debug statement logs the entire
req.bodywhich may contain sensitive information beyond just the logout token - Incomplete sensitive data redaction: The current approach only redacts top-level sensitive fields but won't handle nested objects that might contain secrets
Both issues should be resolved to prevent accidental exposure of sensitive information in debug logs.
| res.setHeader('cache-control', 'no-store'); | ||
| const logoutToken = req.body.logout_token; | ||
| if (!logoutToken) { | ||
| debug('req.oidc.backchannelLogout() failed due to missing logout token', req.body); |
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.
Logging the entire req.body exposes sensitive information that may be present in the request. The logout token itself could contain sensitive claims, and other fields in the body might contain secrets.
| debug('req.oidc.backchannelLogout() failed due to missing logout token', req.body); | |
| debug('req.oidc.backchannelLogout() failed due to missing logout token. logout_token present: %s', !!req.body.logout_token); |
| const auth = function (params) { | ||
| const config = getConfig(params); | ||
| debug('configuration object processed, resulting configuration: %O', config); | ||
| debug('configuration object processed, resulting configuration: %O', {...config, clientSecret: "REDACTED", secret: "REDACTED"}); |
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.
The spread operator approach only handles top-level properties. If the config object contains nested objects with sensitive fields, they won't be redacted. Consider using a recursive redaction function to handle nested sensitive data.
| debug('configuration object processed, resulting configuration: %O', {...config, clientSecret: "REDACTED", secret: "REDACTED"}); | |
| const redactSensitiveFields = (obj) => { | |
| if (!obj || typeof obj !== 'object') return obj; | |
| const result = Array.isArray(obj) ? [...obj] : { ...obj }; | |
| Object.keys(result).forEach(key => { | |
| if (['clientSecret', 'secret'].includes(key)) { | |
| result[key] = 'REDACTED'; | |
| } else if (typeof result[key] === 'object') { | |
| result[key] = redactSensitiveFields(result[key]); | |
| } | |
| }); | |
| return result; | |
| }; | |
| debug('configuration object processed, resulting configuration: %O', redactSensitiveFields(config)); |
…es + don't show clientSecret/secret in debug logs
By submitting a PR to this repository, you agree to the terms within the Auth0 Code of Conduct. Please see the contributing guidelines for how to create and submit a high-quality PR for this repo.
Description
Extra logging to troubleshoot backchannel logout failing. In my case we were using a different version of jose in our app than the one used in this library (which uses openid-client), resulting in multiple class definitions of KeyStore being used resulting in the error "key must be an instance of a key instantiated by JWK.asKey, a valid JWK.asKey input, or a JWKS.KeyStore instance" being suppressed
No breaking changes, just logging changes
None
References
None
Testing
Existing test cases should cover this
If you want to test this, run through backchannel logout
Checklist