Missing HTTP 429 handling (rate-limit / account lockout feedback) #1

Closed
opened 2026-04-25 04:17:58 +00:00 by msdong · 0 comments
msdong commented 2026-04-25 04:17:58 +00:00 (Migrated from codeberg.org)

Problem

The app has no handler for HTTP 429 Too Many Requests responses. After the server introduced account lockout (5 failed logins → 15-minute lockout) and rate-limiting on critical endpoints, the user sees only a generic "Verbindung fehlgeschlagen" error instead of a meaningful message.

Affected flows

  • Login (/api/v1/auth/login): after 5 wrong attempts the server returns 429. The app shows a generic connection error with no hint about the lockout duration.
  • File upload (UploadWorker.kt): retries 3× on failure but does not check for 429, so it retries immediately even when rate-limited.
  • File download (DownloadWorker.kt): same — no 429 detection.
  • General API calls: any endpoint can return 429; currently treated as an opaque HTTP error.

Expected behaviour

  • Detect HTTP 429 in the OkHttp interceptor chain.
  • Read the Retry-After response header (value = seconds to wait).
  • Show a user-friendly message, e.g. "Zu viele Versuche. Bitte warte 15 Minuten." / "Too many attempts. Please wait 15 minutes."
  • For background workers (upload/download): honour the Retry-After delay before the next retry instead of retrying immediately.

Suggested implementation location

Add a new RateLimitInterceptor in NetworkModule.kt (after SessionExpiredInterceptor), or extend the existing interceptor to handle 429 alongside 401.

Context

Discovered during compatibility audit against server security-hardening branch (security-hardening-2026-04). No crash or data loss — purely a UX gap.

## Problem The app has no handler for HTTP `429 Too Many Requests` responses. After the server introduced account lockout (5 failed logins → 15-minute lockout) and rate-limiting on critical endpoints, the user sees only a generic *"Verbindung fehlgeschlagen"* error instead of a meaningful message. ## Affected flows - **Login** (`/api/v1/auth/login`): after 5 wrong attempts the server returns 429. The app shows a generic connection error with no hint about the lockout duration. - **File upload** (`UploadWorker.kt`): retries 3× on failure but does not check for 429, so it retries immediately even when rate-limited. - **File download** (`DownloadWorker.kt`): same — no 429 detection. - **General API calls**: any endpoint can return 429; currently treated as an opaque HTTP error. ## Expected behaviour - Detect HTTP 429 in the OkHttp interceptor chain. - Read the `Retry-After` response header (value = seconds to wait). - Show a user-friendly message, e.g. *"Zu viele Versuche. Bitte warte 15 Minuten."* / *"Too many attempts. Please wait 15 minutes."* - For background workers (upload/download): honour the `Retry-After` delay before the next retry instead of retrying immediately. ## Suggested implementation location Add a new `RateLimitInterceptor` in `NetworkModule.kt` (after `SessionExpiredInterceptor`), or extend the existing interceptor to handle 429 alongside 401. ## Context Discovered during compatibility audit against server security-hardening branch (`security-hardening-2026-04`). No crash or data loss — purely a UX gap.
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
msdong/dumangofilecloud_android#1
No description provided.