Traffic-exchange frames: framed pages open sign-in, Get a Position, My Team, wallet and off-site links in a new tab carrying ?ref=<sponsor>

Traffic exchanges, rotators and Massifly Adpoints show 5xyourteam.com inside another site's frame, where the browser drops the
SameSite=Lax fx.ref and fx.sid cookies, so signing in, buying or joining from the frame lost the sponsor (Marty 2026-11-19).
- common.js: framed (window.top !== window.self) -> /team, /join, /admin, /sso/ and off-site links get target=_blank
  rel=noopener (on load and again at click time); /team, /join and /sso/ links add ?ref= from the page's ?ref= (or ?r=), the
  coach page it is, or the cookie. The wallet buttons ([data-wallet-signin], Pay = [data-full-window]) open this page in a new
  tab with ?ref= instead of signing inside the frame. Public pages stay in the frame.
- server: /sso/start?...&ref=<name> sets fx.ref first-party and 302s to the plain start; /sso/* sends X-Frame-Options DENY
  (/team and /admin already did). Sponsor rules unchanged.
- coach.js marks the coach; join.js keeps Pay clickable when framed; asset tags bumped.
Checked with the fake traffic-exchange harness (cross-site frame, JS a.click()): 11/11 flows open a new tab with the sponsor.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
martbost
2026-11-19 07:21:13 -06:00
parent 214f348503
commit 47389a4169
23 changed files with 69 additions and 25 deletions
+9
View File
@@ -232,6 +232,15 @@ const server = http.createServer(async (req, res) => {
{ const host = String(req.headers.host || '').toLowerCase().split(':')[0];
if (C.isProd && host !== C.site && host.endsWith('.' + C.site)) { res.writeHead(301, { Location: 'https://' + C.site + req.url, 'Cache-Control': 'no-store' }); return res.end(); } }
try {
// a framed page's sign-in opens in a new tab as /sso/start?...&ref=<sponsor> (the frame dropped the fx.ref cookie, 2026-11-19):
// keep the sponsor first-party here, then the normal start. Sign-in hand-offs are never shown in a frame.
if (req.method === 'GET' && p === '/sso/start' && u.searchParams.has('ref')) {
const ref = u.searchParams.get('ref'); u.searchParams.delete('ref');
const h = { Location: p + u.search, 'Cache-Control': 'no-store', 'X-Frame-Options': 'DENY', 'Referrer-Policy': 'no-referrer' };
if (NAME_RE.test(ref) || ADDR_RE.test(ref)) h['Set-Cookie'] = cookie('fx.ref', ref, 30 * 86400, false);
res.writeHead(302, h); return res.end();
}
if (req.method === 'GET' && p.startsWith('/sso/')) res.setHeader('X-Frame-Options', 'DENY');
if (req.method === 'GET' && await networksso.page(req, res, u)) return; // network hub: daily activity ping + the hub sign-in push (2026-11-15)
if (req.method === 'GET' && (p.startsWith('/sso/') || p === '/api/sso/status') && await networksso.handle(req, res, u)) return;
if ((p === '/api/promo-kit' || p === '/promote') && promokit.handle(req, res, u, sendFile)) return;