Skip to content

Desktop trial paywall: client-side enforcement can be bypassed #7345

Closed as not planned

Description

@beastoin

Summary

The desktop free trial paywall has a client-side enforcement gap that allows trial-expired users to continue using features without upgrading.

Current Architecture

The trial enforcement has two layers:

1. Backend (server-side) — enforces on specific endpoints

  • Chat (/v2/messages): enforce_chat_quota() checks is_trial_paywalled(uid, platform) and returns HTTP 402 when trial expired
  • Chat WebSocket: checks is_trial_paywalled() and closes with code 1008
  • Push-to-talk: checks is_trial_paywalled() before hitting Deepgram
  • Platform gating: only applies when X-App-Platform header is macos or desktop

2. Client (desktop app) — enforces on capture toggles

  • fetchTrialMetadata() calls GET /v1/users/me/trial every 60 seconds
  • If trialExpired == true, sets isPaywalled = true
  • blockIfPaywalled() gates startTranscription() and shows upgrade popup
  • isPaywalled persisted to UserDefaults (desktop_isPaywalled)

Bypass Vectors

A. Missing X-App-Platform header bypass

  • is_trial_paywalled() returns False when platform is None or not in {"macos", "desktop"}
  • A modified client omitting the X-App-Platform header bypasses all server-side trial checks
  • Chat, PTT, and listen WebSocket all gate on this header

B. Client-side fetch failure = fail-open

  • fetchTrialMetadata() catch block only logs the error — isPaywalled stays false
  • Backend get_trial_metadata() also fails open: returns trial_expired=False on any exception
  • A client blocking requests to /v1/users/me/trial (e.g., DNS override, proxy rule) keeps the app unpaywalled indefinitely

C. isPaywalled defaults to false on fresh launch

  • isPaywalled initializes from UserDefaults (desktop_isPaywalled), which defaults to false
  • Deleting the app's UserDefaults plist resets isPaywalled to false
  • The app is usable between launch and the first successful fetchTrialMetadata() response (up to 60s polling interval)

D. Listen WebSocket not gated by trial

  • startTranscription() is gated by blockIfPaywalled() on the client side
  • The backend listen WebSocket (/v4/listen) does not check is_trial_paywalled() — it relies on the client to not connect
  • A modified client or direct WebSocket connection bypasses the transcription paywall

Affected Code

  • Client: desktop/Desktop/Sources/AppState.swift — fetchTrialMetadata(), blockIfPaywalled(), isPaywalled
  • Backend: backend/utils/subscription.py — is_trial_paywalled(), get_trial_metadata()
  • Backend: backend/routers/chat.py — enforce_chat_quota() with platform header check
  • Backend: backend/routers/transcribe.py — listen WebSocket (no trial check)

Related

by AI for @beastoin

Activity

  1. added
    p2
    maintainer
    on May 18, 2026
  2. beastoin commented on Jun 10, 2026

    @beastoin
    CollaboratorAuthor

    Closing as not planned per CTO directive (2026-06-10).


    by AI for @beastoin

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    maintainerp2

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions