Link-farm hardening (2026-10-30 incident: 106 free accounts used casino bios and website links as backlinks; Google indexed the text through /wall pages)

Public walls: profile fields (bio, avatar, socials, intro video) render only for a paying member (memberId > 0 or a registered position), on /api/wall and in the OG image; a free account's wall shows the name, the line's ads and the join call. The meta/og description is a fixed site sentence with the handle, never the bio. Outbound profile links are rel="sponsored ugc noopener" target="_blank". A deleted or unknown name is a real 404 with X-Robots-Tag noindex (was a bare "Banner wall" page at 200, a soft 404 that stayed indexed).

Policy (prohibited.js, byte-for-byte copy on LinkSpin): bios may not carry a URL or a domain token ("Links go in the social fields, not the bio"); gambling, adult, pharma, weapons and link-selling terms (Unicode aware, Vietnamese and Portuguese terms included) are refused in bios, social URLs, line banner targets, wall offers and every campaign field, with the refusal logged. lssync applies it on the way out and lsinbound on ingest.

Quarantine rule: a brand-new free account (no wallet, no sponsor, under 24 h) whose first profile save plants a link is saved with profileQuarantined (JSON + MySQL column), never rendered publicly, and told "Your profile links will appear after your first ad package"; the admin member card shows the flag.

Daily link-farm scan (spamscan.js, same copy on LinkSpin): in-app job at 06:30 Central, claimOnce per day, lists memberId-0 walletless accounts with a link plus a farm signal (prohibited term, sign-in over within 15 min, no sponsor), skips the spamScanAllow setting (seeded), writes DATA_DIR/wall-spam-scan.json and sends one Telegram to the private admin chat only when there are candidates. Admin > Members > Link-farm list: rows with "also on LinkSpin", Delete selected (existing DELETE /api/admin/member, on-chain refused, no cascade) and Allow.

Terms section 8 "Prohibited content", bio hint in the profile editor, chatbot canned answer "What content is not allowed?", KNOWLEDGE_DATE 2026-10-30. Test: qa/profile-policy.test.cjs (unit + local copy; runs in qa/run.sh member and policy).

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
martbost
2026-10-30 07:29:11 -05:00
parent ec4ada08d7
commit 337d4f9e8f
18 changed files with 615 additions and 36 deletions
+59 -12
View File
@@ -70,7 +70,9 @@ const audit = require('./audit'); // counter audit: views vs delivery logs,
const leaderboard = require('./leaderboard');
const toolkit = require('./toolkit');
const badge = require('./badge'); // achievement badge image drawn on the server with ffmpeg (2026-09-16)
const friday = require('./friday');
const friday = require('./friday');
const prohibited = require('./prohibited'); // prohibited-content policy shared with LinkSpin (2026-10-30 link-farm incident)
const spamscan = require('./spamscan'); // daily link-farm scan + quarantine rule, byte-for-byte copy on LinkSpin
const starter = require('./starter'); // member welcome offer from the games (2026-10-05)
const wednesday = require('./wednesday'); // Wired Wednesday: +25% on $10+ packs, wired into a visits campaign (2026-09-29)
const fridaybank = require('./fridaybank'); // Friday Bonus Hunts: days banked Sat-Thu by solo + video (2026-09-26)
@@ -168,6 +170,14 @@ const videoTokens = persistedMap('video'); // email -> watch-to-earn video token
const faucetHits = new Map(); // address -> last faucet ts (rehearsal test-POL faucet rate limit)
const visitTokens = persistedMap('visit'); // email -> verified-visit token (dwell + captcha floor)
// walk the referral chain upward via sponsorRef (code/username/member id)
// A PAYING member (memberId > 0, or a registered linked position) gets their profile on public pages; a free account gets
// nothing from the profile there (2026-10-30 link-farm incident: 106 free accounts used bios and socials as backlinks).
async function hasBought(a) {
if (!a) return false; if (Number(a.memberId) > 0) return true;
try { return (await accounts.positions(a.email)).some(p => Number(p.memberId) > 0); } catch (e) { return false; }
}
// the wall's meta description is always this sentence, never profile text, so the indexed snippet is ours
const wallDescription = nm => nm + '\u2019s ad wall on InstantAdPay: the network\u2019s member ads, paid out on Polygon the moment a package clears.';
async function uplineSlides(email, depth = 3) {
const out = [];
let cur = await accounts.byEmail(email);
@@ -614,7 +624,14 @@ async function boot() {
setInterval(() => refuel.tick().catch(e => console.error('refuel', e.message)), 10 * 60 * 1000);
setTimeout(() => refill.tick().catch(e => console.error('refill', e.message)), 90000);
setInterval(() => refill.tick().catch(e => console.error('refill', e.message)), 20 * 60 * 1000);
setInterval(() => friday.tick().catch(e => console.error('friday', e.message)), 5 * 60 * 1000);
setInterval(() => friday.tick().catch(e => console.error('friday', e.message)), 5 * 60 * 1000);
// link-farm scan (2026-10-30): 06:30 Central, once a day across app copies (marks), Telegram to the private admin chat only when there is something to review
spamscan.init({ dataDir: DATA_DIR, site: 'InstantAdPay', siteUrl: 'https://instantadpay.com', otherSite: 'LinkSpin', accounts, siteConfig, marks,
saveSite: patch => { const cur = siteConfig(); fs.writeFileSync(SITE_FILE, JSON.stringify(Object.assign(cur, patch), null, 2)); },
notify: async text => { const sc = siteConfig(); const chat = String(sc.telegramAdminChatId || '1289244227').trim(); if (sc.telegramBotToken) return telegramSend(chat, text); const hermes = String(process.env.HERMES_BOT_TOKEN || '').trim(); if (hermes) return tgSendAs(hermes, chat, text); if (ADMIN_EMAIL && mailer.hasKey()) return mailer.send(ADMIN_EMAIL, 'InstantAdPay link-farm scan', text); },
alsoOn: async (email, a) => (a && a.joinedVia === 'linkspin') ? true : lssync.knows(email) });
setTimeout(() => spamscan.tick().catch(e => console.error('spamscan', e.message)), 150000);
setInterval(() => spamscan.tick().catch(e => console.error('spamscan', e.message)), 5 * 60 * 1000);
wednesday.init({ dataDir: DATA_DIR, siteConfig, chain, ads, accounts, mailer, drip, marks, rates: () => ads.rates(),
telegram: async text => { const sc = siteConfig(); if (!sc.telegramBotToken || !sc.telegramEchoChatId) return false; return telegramSend(sc.telegramEchoChatId, '\u{1F7E0} <b>InstantAdPay</b> · ' + text, sc.telegramEchoTopicId); },
notify: async (memberId, subject, text, kind) => { const a = await accounts.byMemberId(memberId); if (!a || !a.email) return; const html = '<p>' + String(text).replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/(https:\/\/[^\s]+)/g, '<a href="$1" target="_blank" rel="noopener">$1</a>').split('\n\n').join('</p><p>').replace(/\n/g, '<br>') + '</p>'; await messages.deliver(1, ADMIN_EMAIL || 'house@instantadpay.com', [a.email], subject, html, kind || 'notice'); } });
@@ -781,7 +798,8 @@ function siteConfig() {
telegramBotToken: '', telegramChatId: '', telegramTopicId: '', telegramEvents: 'payouts', telegramCtaUrl: 'https://instantadpay.com/',
fraudMaxSignupsPerIpDay: 2, fraudBlockSharedDevice: 'on', // anti-fraud: accounts per IP per day; block a second account from the same browser
telegramEchoChatId: '', telegramEchoTopicId: '', telegramEchoEvents: 'payouts', // shared cross-program payments topic
telegramAdminChatId: '', // private chat for admin alerts (sign-up guard bursts); falls back to ADMIN_EMAIL
telegramAdminChatId: '', // private chat for admin alerts (sign-up guard bursts); falls back to ADMIN_EMAIL
spamScanAllow: spamscan.DEFAULT_ALLOW.join(', '), // link-farm scan (2026-10-30): emails never listed as candidates; Admin > Members > Link-farm list > Allow adds here
fridayPromo: '1', // Five Dollar Friday on/off (Marty, 2026-09-20)
fridayBonusPct: '20', // bonus credits on any $5+ package bought on a Friday, Central
fridayStart: '2026-09-25', // the first Five Dollar Friday
@@ -2388,7 +2406,7 @@ const server = http.createServer(async (req, res) => {
const t = nameTok.toLowerCase();
let a = await accounts.byCode(t); if (!a) a = await accounts.byUsername(t);
if (!a && /^\d+$/.test(nameTok)) a = await accounts.byMemberId(Number(nameTok));
if (a) { name = a.username ? '@' + a.username : (a.memberId ? 'member #' + a.memberId : null); avatarUrl = a.avatarUrl || null; own = !!(acct && a.email === acct.email); var bio = null, cobrand = false; try { cobrand = (await ads.milestonesOf(a.email)).includes('level3'); if (cobrand) bio = a.bio ? String(a.bio).slice(0, 220) : null; } catch (e) {} }
if (a) { name = a.username ? '@' + a.username : (a.memberId ? 'member #' + a.memberId : null); avatarUrl = a.avatarUrl || null; own = !!(acct && a.email === acct.email); var bio = null, cobrand = false; try { cobrand = (await ads.milestonesOf(a.email)).includes('level3'); if (cobrand && !a.profileQuarantined && await hasBought(a)) bio = a.bio ? String(a.bio).slice(0, 220) : null; } catch (e) {} }
}
// "You're joining the line of X" must only greet someone who is actually about to
// join. The last-touch sponsor cookie lives 30 days, so an EXISTING member who once
@@ -3021,6 +3039,15 @@ const server = http.createServer(async (req, res) => {
}
return json(res, 200, await adminMember.view(e));
}
// -- link-farm scan (2026-10-30): last result + allowlist, run now (no Telegram), allow / unallow an email
if (p === '/api/admin/spamscan' && req.method === 'GET') { if (!isAdmin(req)) return json(res, 401, { error: 'auth' }); return json(res, 200, spamscan.view()); }
if (p === '/api/admin/spamscan/run' && req.method === 'POST') { if (!isAdmin(req)) return json(res, 401, { error: 'auth' }); await spamscan.run({ manual: true, quiet: true }); return json(res, 200, spamscan.view()); }
if (p === '/api/admin/spamscan/allow' && req.method === 'POST') {
if (!isAdmin(req)) return json(res, 401, { error: 'auth' });
const b = await readBody(req); const e = String(b.email || '').trim().toLowerCase(); if (!e) return json(res, 400, { error: 'Which email?' });
spamscan.setAllow(e, !b.remove); console.log('spamscan allowlist', b.remove ? 'removed' : 'added', e);
return json(res, 200, spamscan.view());
}
if (p === '/api/admin/member' && req.method === 'DELETE') {
if (!isAdmin(req)) return json(res, 401, { error: 'auth' });
const e = String(u.searchParams.get('email') || '').trim().toLowerCase(); const acct = e && await accounts.byEmail(e);
@@ -4638,7 +4665,7 @@ const server = http.createServer(async (req, res) => {
return json(res, 400, { error: 'Avatar must be an uploaded image or an https image URL.' });
const bio = b.bio === undefined ? undefined : String(b.bio || '').trim().slice(0, 600);
// socials: {platform: url}; keep only known platforms with valid https urls
let socials;
let socials, cleanSoc = null;
if (b.socials !== undefined) {
const PLAT = ['facebook', 'twitter', 'youtube', 'instagram', 'tiktok', 'telegram', 'linkedin', 'website', 'video'];
const clean = {};
@@ -4650,8 +4677,17 @@ const server = http.createServer(async (req, res) => {
if (clean.video && !/^https:\/\/((www\.|m\.)?youtube\.com\/(watch\?|shorts\/|embed\/)|youtu\.be\/|(www\.)?vimeo\.com\/\d+|player\.vimeo\.com\/video\/\d+|[^\s]+\.(mp4|webm)(\?|$))/i.test(clean.video))
return json(res, 400, { error: 'The intro video needs to be a YouTube link, a Vimeo link, or a direct .mp4 link.' });
socials = Object.keys(clean).length ? JSON.stringify(clean) : null;
cleanSoc = clean;
}
const r = await accounts.setProfile(s.email, avatar, bio, socials);
// prohibited-content policy (2026-10-30): gambling, adult, pharma, weapons and link-selling terms are refused in the bio and the social URLs
{ const pr = prohibited.checkFields(Object.assign({ bio }, cleanSoc || {}), 'InstantAdPay', { profile: true }); if (pr.error) { prohibited.logRefusal('profile-details', s.email, pr); return json(res, 400, { error: pr.error }); } }
// a bio is not a backlink: links go in the social fields. Exception, the quarantine rule: a brand-new free account (no wallet,
// no sponsor, under 24 h) whose first save plants a link is saved with profileQuarantined and never rendered publicly
const acct = await accounts.byEmail(s.email);
const quarantine = spamscan.shouldQuarantine(acct, bio, cleanSoc) ? true : undefined;
if (bio && prohibited.hasUrl(bio) && !quarantine) { prohibited.logRefusal('profile-details', s.email, { field: 'bio', reason: 'url' }); return json(res, 400, { error: prohibited.BIO_LINK_MSG }); }
const r = await accounts.setProfile(s.email, avatar, bio, socials, quarantine);
if (quarantine && !r.error) { console.log('profile quarantined', String(s.email).replace(/^(.).*(@.*)$/, '$1***$2'), prohibited.hasUrl(bio) ? 'bio-url' : 'social-link'); r.quarantined = true; r.notice = spamscan.QUARANTINE_NOTICE; }
return json(res, r.error ? 400 : 200, r);
}
// -- BixPay partner link (2026-10-29): Profile > BixPay card. Validated (bix.ibportal.io/auth/register, e=, a=1; the
@@ -4693,6 +4729,7 @@ const server = http.createServer(async (req, res) => {
const title = String(o.title || '').trim().slice(0, 60);
if (targetUrl && !/^https:\/\/[^\s]+$/i.test(targetUrl)) return json(res, 400, { error: 'Position ' + (i + 2) + ': the link must start with https://' });
if (bannerUrl && !/^(\/uploads\/[a-z0-9]{24}\.(png|jpg|webp|gif)|https:\/\/[^\s]+)$/i.test(bannerUrl)) return json(res, 400, { error: 'Position ' + (i + 2) + ': banner must be an uploaded image or an https image URL.' });
{ const pr = prohibited.checkFields({ title, targetUrl }, 'InstantAdPay'); if (pr.error) { prohibited.logRefusal('wall-offers', s.email, pr); return json(res, 400, { error: pr.error }); } }
out.push(targetUrl ? { title: title || null, bannerUrl: bannerUrl || null, targetUrl } : null);
}
const r = await accounts.setWallOffers(s.email, out.some(Boolean) ? JSON.stringify(out) : null);
@@ -4705,6 +4742,7 @@ const server = http.createServer(async (req, res) => {
const b = await readBody(req);
const target = String(b.targetUrl || '').trim();
if (!/^https?:\/\/[^\s]+$/i.test(target)) return json(res, 400, { error: 'Destination URL must start with http(s)://' });
{ const pr = prohibited.checkFields({ targetUrl: target }, 'InstantAdPay'); if (pr.error) { prohibited.logRefusal('linebanner', s.email, pr); return json(res, 400, { error: pr.error }); } }
const fc = await frameCheck(target); // welcome tours frame it full screen
if (!fc.ok) return json(res, 400, { error: fc.reason });
const banner = String(b.bannerUrl || '').trim();
@@ -4770,9 +4808,11 @@ const server = http.createServer(async (req, res) => {
badge = { img: '/badges/badge-' + t[0] + '.jpg?v=2', label: t[1] };
}
const joinPath = '/join/' + (a.username || a.code);
let socials = null; try { socials = a.socials ? JSON.parse(a.socials) : null; } catch (e) {}
return json(res, 200, { name: a.username ? '@' + a.username : 'member #' + (a.memberId || 0),
avatarUrl: a.avatarUrl || null, bio: a.bio || null, socials, badge,
// profile fields (bio, avatar, socials, intro video) only for a paying member; a free account's wall carries the name, the line's ads and the join call (2026-10-30)
const bought = (await hasBought(a)) && !a.profileQuarantined;
let socials = null; if (bought) { try { socials = a.socials ? JSON.parse(a.socials) : null; } catch (e) {} }
return json(res, 200, { name: a.username ? '@' + a.username : 'member #' + (a.memberId || 0), bought,
avatarUrl: bought ? (a.avatarUrl || null) : null, bio: bought ? (a.bio || null) : null, socials, badge,
joinUrl: joinPath, qrUrl: '/api/qr?d=' + encodeURIComponent('https://instantadpay.com' + joinPath), ladder: finalLadder, unlocked, buyerCount: bc });
}
// -- watch-to-earn video ads: serve one, then reward a server-clock-verified watch
@@ -5781,13 +5821,20 @@ const server = http.createServer(async (req, res) => {
try {
const tok = m[1].toLowerCase();
let a = await accounts.byUsername(tok); if (!a) a = await accounts.byCode(tok);
// a deleted or never-seen name is a real 404, never a bare "Banner wall" page at 200 (a soft 404 Google kept indexed, 2026-10-30)
if (!a) {
const nf = '<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>No wall under that name | InstantAdPay</title><meta name="robots" content="noindex"><link rel="icon" type="image/png" href="/logo-icon.png"><link rel="stylesheet" href="/assets/site.css?v=20260911w"></head><body><section><div class="wrap" style="max-width:720px;text-align:center;padding:60px 0"><h1>No wall under that name</h1><p class="muted">This member page does not exist or was removed.</p><p><a class="btn" href="/">Go to InstantAdPay</a></p></div></section></body></html>';
res.writeHead(404, baseHeaders({ 'Content-Type': 'text/html; charset=utf-8', 'Cache-Control': 'no-cache', 'X-Robots-Tag': 'noindex' }));
return res.end(nf);
}
let html = fs.readFileSync(path.join(PUBLIC_DIR, 'wall.html'), 'utf8');
if (a) {
const nm = a.username ? '@' + a.username : 'member #' + (a.memberId || 0);
const esc = t => String(t || '').replace(/[&<>"]/g, c => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;' }[c]));
const title = nm + ' on InstantAdPay';
const desc = a.bio ? esc(a.bio).slice(0, 200) : 'Join ' + nm + '’s line on InstantAdPay — instant on-chain ad payouts, free to join.';
const img = a.avatarUrl && /^https:/.test(a.avatarUrl) ? a.avatarUrl : 'https://instantadpay.com/banners/iap-hero-1200x630.png';
const bought = (await hasBought(a)) && !a.profileQuarantined; // only a paying member's avatar becomes the share image
const title = nm + '\u2019s ad wall | InstantAdPay';
const desc = esc(wallDescription(nm)); // fixed site sentence, never the bio (indexed snippet stays ours)
const img = bought && a.avatarUrl && /^https:/.test(a.avatarUrl) ? a.avatarUrl : 'https://instantadpay.com/banners/iap-hero-1200x630.png';
const url = 'https://instantadpay.com/wall/' + (a.username || a.code);
const og = [
'<meta property="og:type" content="profile">',