Rename REFRESH_TOKEN_COOL_DOWN to REFRESH_TOKEN_REUSE_GRACE_PERIOD and anchor the grace window (#17782)
## Summary - Renames `REFRESH_TOKEN_COOL_DOWN` to `REFRESH_TOKEN_REUSE_GRACE_PERIOD` — the old name was misleading and suggested a security mechanism rather than what it actually is: a grace period for concurrent refresh token use (e.g. two browser tabs refreshing simultaneously). - Makes the token revocation in `renew-token.service.ts` conditional (`revokedAt: IsNull()`), so if the token was already revoked by a concurrent request, the original `revokedAt` timestamp is preserved and the grace window stays anchored. - Updates comments and config description to clarify intent. ## Test plan - [x] Existing unit tests updated and passing (`refresh-token.service.spec.ts`, `renew-token.service.spec.ts`) - [x] Lint clean Made with [Cursor](https://cursor.com) Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -277,12 +277,13 @@ export class ConfigVariables {
|
||||
|
||||
@ConfigVariablesMetadata({
|
||||
group: ConfigVariablesGroup.TOKENS_DURATION,
|
||||
description: 'Cooldown period for refreshing tokens',
|
||||
description:
|
||||
'Grace period allowing concurrent refresh token use (e.g. two tabs refreshing simultaneously). Reuse after this window triggers suspicious activity detection.',
|
||||
type: ConfigVariableType.STRING,
|
||||
})
|
||||
@IsDuration()
|
||||
@IsOptional()
|
||||
REFRESH_TOKEN_COOL_DOWN = '1m';
|
||||
REFRESH_TOKEN_REUSE_GRACE_PERIOD = '1m';
|
||||
|
||||
@ConfigVariablesMetadata({
|
||||
group: ConfigVariablesGroup.TOKENS_DURATION,
|
||||
|
||||
Reference in New Issue
Block a user