-
Notifications
You must be signed in to change notification settings - Fork 216
Add the masked stored state (transient value) when OAuth Connect validation fails #4806
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
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.
Pull Request Overview
This PR enhances OAuth Connect verbose logging to improve debugging capabilities when OAuth validation fails. The changes add the stored state value (masked or 'false' if not set) to error logs and implement consistent logging for both successful and failed connection attempts.
- Stores the transient state value before validation to include it in error logs
- Adds stored_state, state, code, and nonce (all masked) to verbose debug logs
- Implements conditional logging that uses error level for failures and debug level for successes
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Code looks good and it tests as described 👍
✅ The attribute stored_state is present, and it is false in the additional context of OAuth: Invalid state received from the WCC server log.
Note
stored_state is not present in the additional context of the OAuth: Account connection failed log. Should we add the data here as well?
malithsen
left a comment
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.
LGTM
I don't think it adds any value.... when Also, to add it to the |

Fixes STRIPE-745
Fixes #<github_issue_id>
Changes proposed in this Pull Request:
This PR improves the OAuth optional verbose logs to include additional data:
Testing instructions
add_filter( 'wc_stripe_is_verbose_debug_mode_enabled', '__return_true' );WooCommerce > Payments > Stripe)Create or connect a test account instead(do not complete the onboarding yet)wp transient delete wcs_stripe_connect_state_teststored_stateis present, and that it isfalse:Changelog entry
Changelog Entry Comment
Comment
Post merge