SecureCredentialsManager serves expired access tokens for up to an hour after the autumn DST transition
メンテナーはふだん 1 日以内に返信
@utkrishtsahu がすでに取り組んでいます。
2026年11月4日 から。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 57/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
調査の方向性
Start with GsonProvider and the SecureCredentialsManager.saveCredentials and continueGetCredentials paths named in the report; inspect the existing credentials manager tests for date serialization and expiry checks. Reproduce the repeated-hour round trip using the supplied date format and compare the saved and restored expiresAt. Done means expiry survives the save/load round trip across the DST transition and the manager refreshes an expired token.
索引モデルが issue の本文から書いたものです。
説明
Checklist
- The issue can be reproduced in the Auth0.Android sample app (or N/A).
- I have looked into the Readme, Examples, and FAQ and have not found a suitable solution or answer.
- I have looked into the API documentation and have not found a suitable solution or answer.
- I have searched the issues and have not found a suitable solution or answer.
- I have searched the Auth0 Community forums and have not found a suitable solution or answer.
- I agree to the terms within the Auth0 Code of Conduct.
Description
GsonProvider configures Gson with
private const val DATE_FORMAT = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"
...
.setDateFormat(DATE_FORMAT)
The Z is a quoted literal and no TimeZone is set, so Date values are serialized as local wall-clock time that looks like UTC. SecureCredentialsManager.saveCredentials stores gson.toJson(credentials), and continueGetCredentials later does gson.fromJson(json, OptionalCredentials::class.java) and uses credentials.expiresAt.time to decide whether the access token is still valid (willExpire).
On the night daylight saving time ends, the local hour between 02:00 and 03:00 occurs twice. An expiresAt that falls in the first occurrence (summer time) is written as, for example, 2026-10-25T02:35:16.000Z. When it is parsed back, SimpleDateFormat resolves the ambiguous wall time to standard time, which is one hour later (shown below on OpenJDK 17; the production data from Android devices shows the same one-hour shift). The manager therefore believes the access token is valid for one more hour and keeps returning it. With minTtl = 300 the SDK only refreshes after real expiry + 55 minutes. Every API call in that hour fails with 401, while getCredentials reports success, so an app that trusts it keeps sending the stale token.
Note that hasValidCredentials is not affected: it reads the epoch value stored separately under KEY_EXPIRES_AT. Only the decision inside continueGetCredentials uses the date that went through the JSON round trip, so the two checks disagree during that hour.
Expected: expiresAt survives the save/load round tripST transitions. Storing epoch milliseconds, or settingthe Gson date format's time zone to UTC (and using a real X/Z pattern), would fix it.
This is distinct from auth0/auth0-flutter#286 and auth0/auth0-flutter#427, which fixed the plugin's conversion of expiresAt for Dart but
not the native round trip inside `SecureCredentialsManarts: #695, #757.
Reproduction
Round trip with the SDK's exact format (OpenJDK 17, zonded 2026-10-25 01:00 UTC):
import java.text.SimpleDateFormat; import java.util.*;
public class DstTest { public static void main(String[]
TimeZone.setDefault(TimeZone.getTimeZone("Europe/Amsterdam"));
SimpleDateFormat f = new SimpleDateFormat("yyyy-MM-dde.US); // GsonProvider.DATE_FORMAT
SimpleDateFormat utc = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'", Locale.US); utc.setTimeZone(TimeZone.getTimeZone("UTC"));
long base = 1792886400L * 1000; // 2026-10-25T00:00:0
for (long o : new long[]{-60_000L, 0L, 2116_000L, 3540_000L, 3600_000L, 5640_000L}) {
Date d = new Date(base + o); String s = f.format(d)
System.out.printf("real=%s stored=\"%s\" parsedBack=%s shiftMin=%+d%n",
utc.format(d), s, utc.format(back), (back.getTi0);
}
}}
Output:
real=2026-10-24T23:59:00Z stored="2026-10-25T01:59:00.000Z" parsedBack=2026-10-24T23:59:00Z shiftMin=+0
real=2026-10-25T00:00:00Z stored="2026-10-25T02:00:00.000Z" parsedBack=2026-10-25T01:00:00Z shiftMin=+60
real=2026-10-25T00:35:16Z stored="2026-10-25T02:35:16.000Z" parsedBack=2026-10-25T01:35:16Z shiftMin=+60
real=2026-10-25T00:59:00Z stored="2026-10-25T02:59:00.000Z" parsedBack=2026-10-25T01:59:00Z shiftMin=+60
real=2026-10-25T01:00:00Z stored="2026-10-25T02:00:00.000Z" parsedBack=2026-10-25T01:00:00Z shiftMin=+0
real=2026-10-25T01:34:00Z stored="2026-10-25T02:34:00.000Z" parsedBack=2026-10-25T01:34:00Z shiftMin=+0
Every expiry inside the repeated hour comes back one hour late; everything else is unchanged.
Expected steps on a device (derived from the production observation, not yet re-run in a lab):
- Set the device zone to any zone that observes DST and the date to shortly before the autumn transition.
- Log in so that the access token's
expiresAtfalls inside the repeated hour (first occurrence). - After that time has passed, call
credentialsManager.getCredentials(). - It returns the expired access token instead of refreshing, until roughly
expiresAt + 1h - minTtl.
The round trip above reproduces consistently; on devices it is only observable on the transition night.
Additional context
Observed in production on 2026-10-25 via auth0_flutter 2.6.2 (which depends on com.auth0.android:auth0:3.21.0): between 00:00 and 01:55 UTC, about 1,100 Android devices sent expired access tokens to our API every 15 seconds and received 401s. Each device was stuck for 50 to 55 minutes (token lifetime 144 min, minTtl 300 s). Only tokens expiring between 00:00 and 01:00 UTC (02:00 to 03:00 local, the repeated hour) were affected; the Auth0 tenant log shows the corresponding dip in refresh-token exchanges and no failures. The same code is present on main and in 4.2.0.
Auth0.Android version
3.21.0 (via auth0_flutter 2.6.2); GsonProvider unchanged in 4.2.0
Android version(s)
13, 14
- 主要言語
- Kotlin
- スター
- 303
- フォーク
- 182
- 平均マージ
- 18時間 42分
- マージ済み PR(30日)
- 36
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
auth0/Auth0.Android のほかの issue
-
feature request
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
auth0/Auth0.Android#1136 · コメント 1 件 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 4/5 3〜5日 初心者へのやさしさ 58/100
auth0/Auth0.Android#1130 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 54/100
auth0/Auth0.Android#1127 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 28/100
auth0/Auth0.Android#1093 · コメント 5 件 ·
メンテナーはふだん 1 日以内に返信
auth0/Auth0.Android の issue をすべて見る
似ている issue
-
hoglite
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
Android: with view recycling on, a recycled View keeps its nextFocusLeft対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープンNeeds: Triage :mag: Platform: Android
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
react/react-native#60167 ·
メンテナーはふだん 2 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
ankidroid/Anki-Android#23557 ·
メンテナーはふだん 1 日以内に返信
-
CI/CD ⚒️ Flaky-tests 🐦 python 🐍
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
valkey-io/valkey-glide#7804 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信