Description

Ensure the access token (JWT) expiry time is set to a reasonable value, such as the default of 3600 seconds (1 hour) or shorter. Values longer than one hour should be avoided, and values below five minutes are also not recommended because they cause frequent token refreshes.

Rationale

An access token remains valid until it expires, even if the user signs out or their account is changed. The longer the expiry time, the longer a stolen token can be used by an attacker. Keeping the expiry at one hour or less limits this window, while the refresh token mechanism keeps legitimate users signed in.

Impact

  • Limits how long a stolen access token can be used

  • Changes to user access take effect sooner

  • Very short values increase load on the Auth server

Default Value

By default, access tokens expire after 3600 seconds (1 hour).

Pre-Requisites

  • Project Owner or Admin role

Test Plan

  1. Sign in to the Supabase Dashboard at https://supabase.com/dashboard.

  2. Select your project.

  3. Open Project Settings and select JWT Keys.

  4. Check the Access token expiry time (shown on the Legacy JWT Secret tab in some projects).

  5. If it is longer than 3600 seconds without a documented reason, follow the implementation steps.

Implementation Steps

  1. Sign in to the Supabase Dashboard at https://supabase.com/dashboard.

  2. Select your project.

  3. Open Project Settings and select JWT Keys.

  4. Set Access token expiry time to 3600 seconds or less.

  5. Select Save.

Backout Plan

  1. Sign in to the Supabase Dashboard at https://supabase.com/dashboard.

  2. Select your project.

  3. Open Project Settings and select JWT Keys.

  4. Set Access token expiry time back to its previous value.

  5. Select Save.

Reference