Skip to content

Commit c66ee33

Browse files
Merge pull request #399 from DLzer/master
Added typing to avoid overflow warnings
2 parents 0883a0f + 2a13a47 commit c66ee33

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [unreleased]
99

10+
## [0.17.5] - 2024-03-14
11+
- Adds a type uint64 to the `accessTokenCookiesExpiryDurationMillis` local variable in `recipe/session/utils.go`. It also removes the redundant `uint64` type forcing needed because of the untyped variable.
12+
1013
## [0.17.4] - 2024-02-08
1114

1215
- Adds `TLSConfig` to SMTP settings.

recipe/session/utils.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ func ValidateAndNormaliseUserInput(appInfo supertokens.NormalisedAppinfo, config
239239
return typeNormalisedInput, nil
240240
}
241241

242-
var accessTokenCookiesExpiryDurationMillis = 3153600000000
242+
var accessTokenCookiesExpiryDurationMillis uint64 = 3153600000000
243243

244244
func normaliseSameSiteOrThrowError(sameSite string) (string, error) {
245245
sameSite = strings.TrimSpace(sameSite)
@@ -301,14 +301,14 @@ func SetAccessTokenInResponse(config sessmodels.TypeNormalisedInput, res http.Re
301301
// This should be safe to do, since this is only the validity of the cookie (set here or on the frontend) but we check the expiration of the JWT anyway.
302302
// Even if the token is expired the presence of the token indicates that the user could have a valid refresh
303303
// Setting them to infinity would require special case handling on the frontend and just adding 100 years seems enough.
304-
setToken(config, res, sessmodels.AccessToken, accessToken, GetCurrTimeInMS()+uint64(accessTokenCookiesExpiryDurationMillis), tokenTransferMethod, request, userContext)
304+
setToken(config, res, sessmodels.AccessToken, accessToken, GetCurrTimeInMS()+accessTokenCookiesExpiryDurationMillis, tokenTransferMethod, request, userContext)
305305

306306
if config.ExposeAccessTokenToFrontendInCookieBasedAuth && tokenTransferMethod == sessmodels.CookieTransferMethod {
307307
// We set the expiration to 100 years, because we can't really access the expiration of the refresh token everywhere we are setting it.
308308
// This should be safe to do, since this is only the validity of the cookie (set here or on the frontend) but we check the expiration of the JWT anyway.
309309
// Even if the token is expired the presence of the token indicates that the user could have a valid refresh
310310
// Setting them to infinity would require special case handling on the frontend and just adding 100 years seems enough.
311-
setToken(config, res, sessmodels.AccessToken, accessToken, GetCurrTimeInMS()+uint64(accessTokenCookiesExpiryDurationMillis), sessmodels.HeaderTransferMethod, request, userContext)
311+
setToken(config, res, sessmodels.AccessToken, accessToken, GetCurrTimeInMS()+accessTokenCookiesExpiryDurationMillis, sessmodels.HeaderTransferMethod, request, userContext)
312312
}
313313
return nil
314314
}

supertokens/constants.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ const (
2121
)
2222

2323
// VERSION current version of the lib
24-
const VERSION = "0.17.4"
24+
const VERSION = "0.17.5"
2525

2626
var (
2727
cdiSupported = []string{"3.0"}

0 commit comments

Comments
 (0)