fix: correct token expiration and JSON parsing bugs in XSUAA client - #5819
Open
o-liver wants to merge 2 commits into
Open
fix: correct token expiration and JSON parsing bugs in XSUAA client#5819o-liver wants to merge 2 commits into
o-liver wants to merge 2 commits into
Conversation
Co-Authored-By: Claude <noreply@anthropic.com>
Member
Author
|
/go-it |
o-liver
enabled auto-merge (squash)
July 6, 2026 14:10
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes two critical bugs in the XSUAA OAuth2 client that prevent proper token refreshing and error handling.
Bugs Fixed
Token expiration logic (line 46): Removed
secondsOfValidityLeft > 0check that prevented expired tokens from being refreshed. When a token expires,secondsOfValidityLeftbecomes negative, and the old conditionsecondsOfValidityLeft > 0 && secondsOfValidityLeft < oneHourInSecondswould never be true for expired tokens, causing them to never refresh.JSON parsing error check (line 98): Changed
if err != niltoif parsingErr != nil. The original code checked the wrong variable, silently ignoring JSON unmarshal failures and only catching earlier HTTP errors.Impact
These bugs could cause:
Changes
Testing
Unit tests pass. The fixes ensure:
secondsOfValidityLeft) trigger refreshRelated
These fixes were discovered during migration of the ANS/XSUAA packages to the tekton-logging-shim: https://github.tools.sap/cloudci/tekton-logging-shim/pull/81