Skip to content

fix(mobile): harden QR auth, token handling, and OTA reliability - #121

Merged
snhsish merged 2 commits into
snhsish:mainfrom
snehasishcodes:fix/mobile-critical-hardening
Sep 26, 2026
Merged

snhsish merged 2 commits into
snhsish:mainfrom
snehasishcodes:fix/mobile-critical-hardening

Conversation

@snehasishcodes

Copy link
Copy Markdown

Implements critical fixes from mobile deep audit.

Security:

  • Strict QR validation in @crosscode/shared (8KB cap, base64 regex, token/email/URL checks, block metadata IP, https enforcement)
  • Login QR no longer trusted directly; verified via device-link claim + server account fetch with zod-style shape checks
  • Tunnel token moved out of router query params into in-memory pending-connection store
  • secureFetch helper enforces https + 15s timeout for claim/account/health
  • Link modal allowlisted to https/mailto with canOpenURL
  • btoa replaced with UTF-8-safe base64, auth cache capped at 10 and cleared on logout/remove
  • SecureStore made fail-safe with AsyncStorage fallback instead of silent data loss
  • Connections use randomUUID and dedupe by URL
  • .gitignore now ignores all .env files

Reliability:

  • OTA switched to ON_ERROR_RECOVERY + 30s cache fallback, safe reload with catch, no mid-stream kill
  • Widget refresh throttled 800ms to 5s
  • Widget data reads SecureStore fallback and fixes sessions/stats shape bugs (was always empty/offline)

Follow-ups (not in scope): server-side POST body for claim token, HMAC-signed QR, biometric/screenshot guards, FlashList virtualization for viewer.

snehasish added 2 commits September 23, 2026 05:04
- Validate QR payloads (size, base64, token, email, URL scheme, metadata IP)
- Verify login QR via device-link claim instead of trusting tier/email
- Keep tunnel token out of router query via pending-connection store
- Add secureFetch with https enforcement and 15s timeout
- Fix btoa/Hermes crash, cap auth cache, clear on logout/remove
- Make SecureStore fail-safe with AsyncStorage fallback
- Use randomUUID and dedupe connections by URL
- Allowlist external links to https/mailto with canOpenURL
- Switch OTA to ON_ERROR_RECOVERY with safe reload and 30s cache fallback
- Throttle widget refresh to 5s and fix widget data key/shape bugs
- Ignore .env files in mobile .gitignore
@snhsish
snhsish merged commit 3b96cc1 into snhsish:main Sep 26, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants