pyatls: consider clock skew, add logging, version 0.0.5 #15
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.
Clock Skew and Logging
Note: Commits can be reviewed independently.
When validating JWT tokens, the PyJWT package validates the
IAT
(Issued At) claim strictly: it must be exactly less than the time now. This requires the issuing service and the validating system to have synchronized clocks. Otherwise, even a few milliseconds of skew forwards on the service or backwards in the validator can cause the library to claim that a token was issued in the future.There is much discussion in that library as to whether verifying that IAT is strictly in the past is a good idea, particularly since the JWT specification does not state that one must do so.
This PR adds a 5s leeway to time validation to account for this. This PR also adds optional logging so that issues like this can be more easily discovered.