Skip to content

fix(auth): multi-account Telegram switching guidance, fail-closed WhatsApp offline UI, and OTP state remediation - #48

Merged
Satelink-Protocol merged 1 commit into
mainfrom
feature/multi-account-telegram-and-whatsapp-signin-audit
Nov 15, 2026
Merged

Satelink-Protocol merged 1 commit into
mainfrom
feature/multi-account-telegram-and-whatsapp-signin-audit

Conversation

@Satelink-Protocol

Copy link
Copy Markdown
Contributor

Summary of Audit & Remediation

This PR resolves the critical sign-in audit findings across Telegram multi-account handling and WhatsApp production fail-closed behavior:

1. Telegram Multi-Account & Cross-Origin Session Resolution (Objective A)

  • Root Cause Analysis: Investigated why the Telegram widget displays 'Log in as Pradeep'. Telegram's official widget runs inside an iframe hosted on oauth.telegram.org and reads Telegram's cross-origin cookies. If the browser has an active Telegram Web or widget session, Telegram identifies that user. NIGHTLIFEZ does not hardcode 'Pradeep', usernames, or user IDs.
  • Backend Verification: Confirmed and verified that the backend determines identity solely by the verified Telegram numeric id validated via HMAC-SHA256 signature using BOT_TOKEN. The backend accepts any valid Telegram user ID, matches existing accounts, registers new users, and isolates accounts (User A cannot access User B).
  • User-Facing Account Switching Guidance: Added a prominent, accessible guidance box on the Telegram tab explaining how Telegram's browser cookies function and providing 3 clear ways to switch accounts (Private/Incognito window, sign out of Telegram Web, or use the Telegram mobile app bot).

2. WhatsApp Production Fail-Closed & Offline UI (Objective B)

  • Fail-Closed Availability Check: Created isWhatsAppAvailable() check that enforces fail-closed behavior in production (HTTP 503 whatsapp_unavailable) when Meta Cloud API credentials are absent.
  • Offline Sign-in State: When WhatsApp is offline/unconfigured, the signin page hides the phone form and displays a clear 'WhatsApp sign-in is temporarily unavailable' notice with an action button to switch to Telegram.
  • Telegram Tab Active by Default: When WhatsApp is unavailable, the Telegram tab is active by default.

3. Consent & Stale OTP State Remediation (Objective C)

  • Eliminated Premature OTP Panel Display: Fixed CSS selector collision where author .otp-box { display: grid; } overrode browser [hidden] styling. Added [hidden] { display: none !important; } and .otp-box[hidden] { display: none !important; }.
  • Removed Hardcoded Fallback Number: Removed dummy placeholder +91 98****1234 from HTML templates.
  • Challenge Verification Guard: memberPage verifies active unexpired sm_wa_step challenge before rendering OTP step. Direct visits to /signin?step=otp without an active challenge safely default to phone step.
  • Change Phone Challenge Reset: Clicking 'Change phone number' resets active challenge ID, clears the sm_wa_step cookie, and reveals the phone form.
  • Strict Consent Invariants: Age confirmation and promotional consent are unchecked by default for fresh visitors; promotional consent is optional and never auto-checked.

4. Automated Test Suites & Verification

  • Unit & Integration: 12 tests in test/multi-account-telegram-and-whatsapp-audit.test.js (100% pass)
  • Security & Privacy: 13 tests in test/signin-security-privacy.test.js (100% pass)
  • Telegram Auth: 51 tests across telegram-*.test.js and auth.test.js (100% pass)
  • WhatsApp Auth: 13 tests in whatsapp-*.test.js (100% pass)
  • E2E Playwright: 6/6 tests in e2e/auth-audit.spec.js (100% pass), 6/6 in e2e/whatsapp-auth.spec.js, 4/4 in e2e/promotional-campaigns.spec.js
  • Linting: 197/197 files OK

@vercel

vercel Bot commented Nov 15, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
strangersmeetup Ready Ready Preview Nov 15, 2026 8:01am UTC

@Satelink-Protocol
Satelink-Protocol merged commit 82ab8b8 into main Nov 15, 2026
3 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.

1 participant