{"record":{"id":"0f7e1579a4137b70","repo":"santifer/career-ops","slug":"blocked-request-to-restricted-destination-reque","errorCode":null,"errorMessage":"Blocked request to restricted destination: ${requestUrl}","messagePattern":"Blocked request to restricted destination: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"liveness-browser.mjs","lineNumber":256,"sourceCode":"    }\n  }\n}\n\nexport async function checkUrlLiveness(page, url, { extraSettleMs = 0 } = {}) {\n  const guardError = rejectPrivateOrInvalid(url);\n  if (guardError) {\n    return { result: 'uncertain', code: guardError.code, reason: guardError.reason };\n  }\n  if (page) {\n    page._blockedByGuard = null;\n  }\n  if (page && typeof page.route === 'function' && !page._routeInterceptorRegistered) {\n    page._routeInterceptorRegistered = true;\n    await page.route('**/*', async (route) => {\n      const requestUrl = route.request().url();\n      const errGuard = rejectPrivateOrInvalid(requestUrl);\n      if (errGuard) {\n        console.warn(`Blocked request to restricted destination: ${requestUrl}`);\n        page._blockedByGuard = errGuard;\n        return route.abort('blockedbyclient');\n      }\n      try {\n        await validateUrlSecurity(requestUrl);\n        return route.continue();\n      } catch (err) {\n        console.warn(`Blocked request to restricted destination (DNS): ${requestUrl} - ${err.message}`);\n        // A host that resolves to nothing is a DEAD THIRD-PARTY SCRIPT, not a\n        // statement about the posting. Measured 2026-08-14 over a 217-URL\n        // recheck: 78 live postings were returned as `uncertain` because an\n        // analytics or ad host on the page no longer exists — 53 on\n        // personalisation.visitorqueue.com, 17 on s7.addthis.com (AddThis was\n        // shut down in 2023), the rest on fluidads and cloudfront. One was\n        // opened by hand to confirm: 11,178 characters of live posting and a\n        // working apply control, called uncertain because of a dead tracker.\n        //\n        // The request is still aborted either way, so the egress guard loses","sourceCodeStart":238,"sourceCodeEnd":274,"githubUrl":"https://github.com/santifer/career-ops/blob/e7abd431fce9348a95261acac9e0c14779c35df8/liveness-browser.mjs#L238-L274","documentation":"liveness-browser.mjs registers a Playwright route('**/*') interceptor that runs rejectPrivateOrInvalid() against every request URL made by the checked job-posting page. Requests to private/invalid/restricted destinations (localhost, RFC1918 ranges, metadata endpoints, malformed URLs) are aborted with 'blockedbyclient' and this warning is printed — an SSRF guard protecting the host machine while loading untrusted third-party pages.","triggerScenarios":"A live job-posting page (or its scripts/iframes) issues subresource or navigation requests to a restricted destination — e.g. an analytics pixel pointing at 127.0.0.1, an internal 10.x host, or a non-http scheme URL — and the route handler aborts it.","commonSituations":"Postings embedding trackers that probe localhost; company intranet URLs accidentally referenced in public pages; attacks or misconfigurations where a 'posting' URL actually points at internal infrastructure; corrupt redirects to private IPs.","solutions":["Expected behavior when scanning untrusted pages — no action needed if the posting itself still verifies","If the TARGET posting URL itself is blocked, it is private/invalid: fix the URL in portals.yml or the scan input","If a legitimate public host is wrongly blocked, review the private-range rules in rejectPrivateOrInvalid for false positives (e.g. unusual IPv6 ranges)","Check page._blockedByGuard afterwards — liveness treats a blocked target as restricted rather than dead"],"exampleFix":"// before (request aborted)\nBlocked request to restricted destination: http://127.0.0.1:8081/track.gif\n// after (fix the page/config, not the guard)\n// portals.yml: use the public https:// URL of the posting, not an internal host","handlingStrategy":"validation","validationCode":"import { isIP } from 'node:net';\nimport { lookup } from 'node:dns/promises';\nfunction looksRestricted(url) {\n  try {\n    const u = new URL(url);\n    if (!/^https?:$/.test(u.protocol)) return true;\n    if (/^(localhost|127\\.|10\\.|192\\.168\\.|169\\.254\\.)/.test(u.hostname)) return true;\n    const ip = isIP(u.hostname) ? u.hostname : null;\n    if (ip && (ip.startsWith('10.') || ip.startsWith('192.168.') || ip.startsWith('169.254.'))) return true;\n    return false;\n  } catch { return true; }\n}","typeGuard":"function isPublicHttpUrl(u) {\n  try { return /^https?:$/.test(new URL(u).protocol); } catch { return false; }\n}","tryCatchPattern":"const errGuard = rejectPrivateOrInvalid(requestUrl);\nif (errGuard) {\n  page._blockedByGuard = errGuard;\n  return route.abort('blockedbyclient');\n}","preventionTips":["Only feed public https:// posting URLs into liveness checks","Never point scanners at internal hosts or raw IPs","Keep the SSRF guard registered (page._routeInterceptorRegistered) when loading untrusted pages","Inspect page._blockedByGuard to distinguish target-blocked from subresource-blocked"],"tags":["ssrf","security","playwright","request-blocking"],"backgroundTag":"request-blocked-by-ssrf-guard","analyzedSha":"e7abd431fce9348a95261acac9e0c14779c35df8","analyzedAt":"2026-09-16T06:35:29.214Z","contentChangedAt":"2026-09-16T06:35:29.214Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}