-
Notifications
You must be signed in to change notification settings - Fork 30
server: make nbf < iat to account for client clock skew #76
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
f557ce9 to
09094eb
Compare
| return | ||
| } | ||
|
|
||
| now := time.Now() |
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.
just moved a few lines below and renamed now to iat - which is more descriptive of its use
| } | ||
|
|
||
| // values for exp, nbp and iat claims | ||
| iat := time.Now() |
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.
these are reused in the JWT token tsClaims as well as in updating the AuthRequest
|
|
||
| // Create a refresh token from the access token with longer validity | ||
| rtAuth := *ar // copy the authRequest | ||
| rtAuth.ValidTill = iat.Add(RefreshTokenDuration) |
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.
refresh tokens have a longer duration. Though we can probably tweak the scopes it has (future PR) to be less permissive.
| fmt.Printf("❌ Error verifying ID Token: %v\n", err) | ||
| os.Exit(1) | ||
| } | ||
|
|
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.
add checks in the verifier around the changed iat, exp, nbf logic
mikeodr
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, one minor logging fix for clarity if you agree.
Set the nbf (not before) claim to be a 5 minutes before the iat (issued at) claim to account for clock skew between tsidp and clients. Fixes #73 Signed-off-by: Benson Wong <benson@tailscale.com>
09094eb to
7ba1edc
Compare
Set the nbf (not before) claim to be a 5 minutes before the iat (issued at) claim to account for clock skew between tsidp and clients.
Fixes #73