santifer/career-ops · warning

Blocked request to restricted destination

Error message

Blocked request to restricted destination: ${requestUrl}

What it means

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.

Solutions

  1. Expected behavior when scanning untrusted pages — no action needed if the posting itself still verifies
  2. If the TARGET posting URL itself is blocked, it is private/invalid: fix the URL in portals.yml or the scan input
  3. If a legitimate public host is wrongly blocked, review the private-range rules in rejectPrivateOrInvalid for false positives (e.g. unusual IPv6 ranges)
  4. Check page._blockedByGuard afterwards — liveness treats a blocked target as restricted rather than dead

Example fix

// before (request aborted)
Blocked request to restricted destination: http://127.0.0.1:8081/track.gif
// after (fix the page/config, not the guard)
// portals.yml: use the public https:// URL of the posting, not an internal host
Defensive patterns

Strategy: validation

Validate before calling

import { isIP } from 'node:net';
import { lookup } from 'node:dns/promises';
function looksRestricted(url) {
  try {
    const u = new URL(url);
    if (!/^https?:$/.test(u.protocol)) return true;
    if (/^(localhost|127\.|10\.|192\.168\.|169\.254\.)/.test(u.hostname)) return true;
    const ip = isIP(u.hostname) ? u.hostname : null;
    if (ip && (ip.startsWith('10.') || ip.startsWith('192.168.') || ip.startsWith('169.254.'))) return true;
    return false;
  } catch { return true; }
}

Type guard

function isPublicHttpUrl(u) {
  try { return /^https?:$/.test(new URL(u).protocol); } catch { return false; }
}

Try / catch

const errGuard = rejectPrivateOrInvalid(requestUrl);
if (errGuard) {
  page._blockedByGuard = errGuard;
  return route.abort('blockedbyclient');
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of santifer/career-ops@e7abd431fc (2026-09-16). Data as JSON: /api/errors/0f7e1579a4137b70. Report an issue: GitHub.

Appendix: source

Thrown at liveness-browser.mjs:256

    }
  }
}

export async function checkUrlLiveness(page, url, { extraSettleMs = 0 } = {}) {
  const guardError = rejectPrivateOrInvalid(url);
  if (guardError) {
    return { result: 'uncertain', code: guardError.code, reason: guardError.reason };
  }
  if (page) {
    page._blockedByGuard = null;
  }
  if (page && typeof page.route === 'function' && !page._routeInterceptorRegistered) {
    page._routeInterceptorRegistered = true;
    await page.route('**/*', async (route) => {
      const requestUrl = route.request().url();
      const errGuard = rejectPrivateOrInvalid(requestUrl);
      if (errGuard) {
        console.warn(`Blocked request to restricted destination: ${requestUrl}`);
        page._blockedByGuard = errGuard;
        return route.abort('blockedbyclient');
      }
      try {
        await validateUrlSecurity(requestUrl);
        return route.continue();
      } catch (err) {
        console.warn(`Blocked request to restricted destination (DNS): ${requestUrl} - ${err.message}`);
        // A host that resolves to nothing is a DEAD THIRD-PARTY SCRIPT, not a
        // statement about the posting. Measured 2026-08-14 over a 217-URL
        // recheck: 78 live postings were returned as `uncertain` because an
        // analytics or ad host on the page no longer exists — 53 on
        // personalisation.visitorqueue.com, 17 on s7.addthis.com (AddThis was
        // shut down in 2023), the rest on fluidads and cloudfront. One was
        // opened by hand to confirm: 11,178 characters of live posting and a
        // working apply control, called uncertain because of a dead tracker.
        //
        // The request is still aborted either way, so the egress guard loses

View on GitHub (pinned to e7abd431fc)