Repository navigation
fix(security): resolve WhatsApp sign-in URL PII leakage and enforce fail-closed provider (P0) - #47
Merged
Conversation
…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
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
<form data-wa-phone-form>and#otp-formelements lacked explicitmethodandactionattributes, causing the browser to default to nativeGETsubmissions upon pressing Enter before deferred scripts loaded or when JavaScript was disabled/blocked.phone,ageConfirmed,promotionalOptIn) as cleartext query parameters to/signin, committing PII to browser history, Edge logs, third-party referrers, and analytics beacons.getWhatsAppProvider()to fall back unconditionally toStubWhatsAppProvider, giving users a false positive indication of OTP dispatch without real message delivery.2. Remediations Implemented
method="POST" action="/api/auth/whatsapp/otp"andmethod="POST" action="/api/auth/whatsapp/verify"to the signin forms./api/auth/whatsapp/otpand/api/auth/whatsapp/verify) now accept both JSON andapplication/x-www-form-urlencodedPOST payloads.phone,ageConfirmed,promotionalOptIn,otp,code,token,secret) withCache-Control: no-storeandReferrer-Policy: no-referrer.history.replaceStatescrubs sensitive query parameters immediately upon DOM readiness.Referrer-Policy: strict-origin-when-cross-originconfigured on sign-in views.VERCELorNODE_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
npm run lint).npm test).test/signin-security-privacy.test.js): 13/13 passed.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
fix/signin-url-privacy-remediationfa879ff7cd3c83efbf3eafbc793649c12ecd64feENABLE_LIVE_PROMOTIONAL_CAMPAIGNS=falseENABLE_LIVE_PAYMENTS=falseUPI_CHECKOUT_ENABLED=false