diff --git a/kuksa_databroker/databroker/src/authorization/jwt/decoder.rs b/kuksa_databroker/databroker/src/authorization/jwt/decoder.rs index 584a8c4b..8b9472c8 100644 --- a/kuksa_databroker/databroker/src/authorization/jwt/decoder.rs +++ b/kuksa_databroker/databroker/src/authorization/jwt/decoder.rs @@ -130,8 +130,13 @@ impl TryFrom for Permissions { } } - permissions = permissions - .expires_at(std::time::UNIX_EPOCH + std::time::Duration::from_secs(claims.exp)); + if let Some(expire_date) = + std::time::UNIX_EPOCH.checked_add(std::time::Duration::from_secs(claims.exp)) + { + permissions = permissions.expires_at(expire_date); + } else { + return Err(Error::ClaimsError); + } permissions.build().map_err(|err| match err { PermissionsBuildError::BuildError => Error::ClaimsError,