Fix forbidden errors when token is about to expire #38
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.
This fixes the edge case when the communication to vault is very slow
and the passed token is about to expire, it can happen that
the call to
lookup self
returns success but the following vault callsstill run into an error as the token just expired.
This problem becomes more severe as vault communication sometimes
can be quite slow.
This change will fix this edge by calculating the maximal time, a call to
vault will take. That is:
This is capped to 60 seconds as the documentation
for the read and open timeout parameters were wrong. As the previous
documentation stated that the timeout parameter are ms valued, they
are actually seconds. See: openTimout and readTimeout
This could cause users to have high values
in these parameters. To prevent continues token refreshing in that case,
the maximal guaranteed token validity is capped to 60 seconds.
I couldn't test my PR with the docker images due to: #37