[BUG] Fixing refresh of AccessToken while its still valid.#92
Open
CoolZeroNL wants to merge 1 commit into
Open
[BUG] Fixing refresh of AccessToken while its still valid.#92CoolZeroNL wants to merge 1 commit into
CoolZeroNL wants to merge 1 commit into
Conversation
making seconds_of_drift, subtract from self.access_grant["expires_in"] instead of appending.
⛔ Snyk checks have failed. 4 issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
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.
Pull request checklist
Please check if your PR fulfills the following requirements:
Description of the issue
The
seconds_of_drift timeis added to theexpires_invalue instead of subtracting from it, causing the AccessToken to appear valid for a longer period than it actually is.python-tss-sdk/delinea/secrets/server.py
Line 275 in f483f81
i have added logging into the local package,
Request after 3650seconds:
Log:
So the AccessToken will expire on: 2026-04-28 11:32:15.132437
The logic is thinking it expires on : 2026-04-28 11:37:15.132437 <-- 5 min longer then it is expires_in value, what is the (300) default seconds that is eq to the
seconds_of_drift=300Expected behavior
the AccessToken should be refreshed before it expired.
Actual behavior
The
seconds_of_drift timeis added to theexpires_invalue instead of subtracting from it, causing the AccessToken to appear valid for a longer period than it actually is.Your environment
api call
Steps to reproduce
any api url that need auth should work, run it for an hours ( or adjust somehow the ttl of the token (
expires_invalue)) and see, that you will get first 401 after an hour, then a period of 5 min (seconds_of_driftvalue) and finaly it does request a new AccessToken.Solution:
subtract the
seconds_of_drift