From 8bb7b2e88b550ea05b2bfd58d9219ee7db44fe5a Mon Sep 17 00:00:00 2001 From: Nick O'Leary Date: Sat, 6 Jul 2019 16:34:48 +0100 Subject: [PATCH] Ensure session expiry timeout doesn't exceed limit --- packages/node_modules/@node-red/editor-api/lib/auth/tokens.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/node_modules/@node-red/editor-api/lib/auth/tokens.js b/packages/node_modules/@node-red/editor-api/lib/auth/tokens.js index 31c12d228..6e867d7df 100644 --- a/packages/node_modules/@node-red/editor-api/lib/auth/tokens.js +++ b/packages/node_modules/@node-red/editor-api/lib/auth/tokens.js @@ -56,7 +56,7 @@ function expireSessions() { } if (nextExpiry < Number.MAX_SAFE_INTEGER) { // Allow 5 seconds grace - expiryTimeout = setTimeout(expireSessions,(nextExpiry - Date.now()) + 5000) + expiryTimeout = setTimeout(expireSessions,Math.min(2147483647,(nextExpiry - Date.now()) + 5000)) } if (modified) { return storage.saveSessions(sessions); @@ -129,7 +129,7 @@ module.exports = { sessions[accessToken] = session; if (!expiryTimeout) { - expiryTimeout = setTimeout(expireSessions,(accessTokenExpiresAt - Date.now()) + 5000) + expiryTimeout = setTimeout(expireSessions,Math.min(2147483647,(accessTokenExpiresAt - Date.now()) + 5000)) } return storage.saveSessions(sessions).then(function() {