Skip to content

fix(security): resolve WhatsApp sign-in URL PII leakage and enforce fail-closed provider (P0) - #47

Merged
Satelink-Protocol merged 1 commit into
mainfrom
fix/signin-url-privacy-remediation
Nov 15, 2026
Merged

Satelink-Protocol merged 1 commit into
mainfrom
fix/signin-url-privacy-remediation

Conversation

@Satelink-Protocol

Copy link
Copy Markdown
Contributor

Summary of Remediation

This PR resolves the HIGH-severity phone-number and consent leakage vulnerability identified in the Production WhatsApp sign-in form (https://nightlifez.com/signin).

1. Root Cause

  • The <form data-wa-phone-form> and #otp-form elements lacked explicit method and action attributes, causing the browser to default to native GET submissions upon pressing Enter before deferred scripts loaded or when JavaScript was disabled/blocked.
  • This native GET submission appended sensitive form fields (phone, ageConfirmed, promotionalOptIn) as cleartext query parameters to /signin, committing PII to browser history, Edge logs, third-party referrers, and analytics beacons.
  • In addition, the production serverless runtime lacked live Meta Cloud API credentials, causing getWhatsAppProvider() to fall back unconditionally to StubWhatsAppProvider, giving users a false positive indication of OTP dispatch without real message delivery.

2. Remediations Implemented

  1. Explicit Form Semantics: Added method="POST" action="/api/auth/whatsapp/otp" and method="POST" action="/api/auth/whatsapp/verify" to the signin forms.
  2. Safe Fallback & URL Privacy:
    • Server endpoints (/api/auth/whatsapp/otp and /api/auth/whatsapp/verify) now accept both JSON and application/x-www-form-urlencoded POST payloads.
    • For native HTML POST requests, the server safely issues HTTP 302 redirects without any sensitive fields in the URL.
  3. Defense-in-Depth Sanitization:
    • Server-side redirect strips legacy sensitive query parameters (phone, ageConfirmed, promotionalOptIn, otp, code, token, secret) with Cache-Control: no-store and Referrer-Policy: no-referrer.
    • Client-side history.replaceState scrubs sensitive query parameters immediately upon DOM readiness.
    • Stricter Referrer-Policy: strict-origin-when-cross-origin configured on sign-in views.
  4. Authoritative Age & Consent Invariants:
    • URL parameters cannot verify age or grant promotional consent. Age confirmation requires explicit checkbox selection validated server-side.
    • Promotional consent remains optional and unchecked by default.
  5. Fail-Closed Production WhatsApp Provider:
    • In production/deployment environments (VERCEL or NODE_ENV=production), if live Meta Cloud API credentials are absent, the provider fails closed with HTTP 503 (whatsapp_unavailable) rather than mock-delivering to a stub.

3. Automated Test Evidence

  • Linter: 195/195 files passed (npm run lint).
  • Unit & Integration Suite: 928 passed, 0 failed, 2 skipped across 930 total tests (npm test).
  • Security Regression Suite (test/signin-security-privacy.test.js): 13/13 passed.
  • Playwright E2E Suite (e2e/whatsapp-auth.spec.js): 6/6 passed across Desktop and Mobile, including verified zero-leakage native POST submission with JavaScript disabled.

4. Release Governance

  • Candidate branch: fix/signin-url-privacy-remediation
  • Candidate commit: fa879ff7cd3c83efbf3eafbc793649c12ecd64fe
  • All production feature flags remain safe:
    • ENABLE_LIVE_PROMOTIONAL_CAMPAIGNS=false
    • ENABLE_LIVE_PAYMENTS=false
    • UPI_CHECKOUT_ENABLED=false
  • Awaiting owner approval prior to merge or production deployment.

…ive query params, and fail closed on unconfigured WhatsApp

- Add explicit method="POST" and action="/api/auth/whatsapp/otp" and "/api/auth/whatsapp/verify" to auth forms
- Add server-side x-www-form-urlencoded handling for safe JavaScript-disabled fallback
- Implement server-side 302 sanitization redirect stripping legacy sensitive query parameters
- Add defense-in-depth history.replaceState client-side URL scrubbing
- Enforce strict server-side invariants for age verification and marketing consent
- Add fail-closed guard in production when WhatsApp live credentials are absent (HTTP 503 whatsapp_unavailable)
- Add comprehensive automated unit regression suite (13 tests) and Playwright E2E test with JS disabled
@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 6:45am UTC

@Satelink-Protocol
Satelink-Protocol merged commit de1230e 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