santifer/career-ops · error · Error

yourator: untrusted hostname

Error message

yourator: untrusted hostname "${parsed.hostname}" — must be ${TRUSTED_HOST}

What it means

assertYouratorUrl pins the hostname to TRUSTED_HOST (yourator.net): any successfully parsed HTTPS URL whose hostname differs throws this error. This is an SSRF/confusion guard — it ensures the provider can never be pointed at an attacker-controlled domain that merely looks like a Yourator link. The message names the offending hostname and the required host.

Solutions

  1. Change the URL's hostname to exactly the TRUSTED_HOST value (yourator.net) — no www or subdomains
  2. If a legitimate new official domain appears, update TRUSTED_HOST in providers/yourator.mjs deliberately, after verifying ownership
  3. Strip any path/host rewriting from upstream code so only trusted, canonical Yourator URLs reach this function
  4. Treat this error as a security signal: audit where the URL originated before simply swapping it

Example fix

// before
const url = 'https://www.yourator.net/companies/acme';
// after
const url = 'https://yourator.net/companies/acme';
Defensive patterns

Strategy: validation

Validate before calling

const u = new URL(candidateUrl);
const TRUSTED_HOST = 'yourator.net';
if (u.hostname !== TRUSTED_HOST) {
  throw new Error(`refusing non-trusted host: ${u.hostname}`);
}

Type guard

function isTrustedYouratorUrl(s) {
  try { return new URL(s).hostname === 'yourator.net'; } catch { return false; }
}

Try / catch

try {
  await scanYourator(entry);
} catch (e) {
  if (e.message.startsWith('yourator: untrusted hostname')) {
    console.warn('Only exact yourator.net URLs are allowed (SSRF guard) — check the configured hostname for typos/lookalikes.');
  } else throw e;
}

Prevention

When it happens

Trigger: Passing https://evil.example.com/... , a lookalike domain (yourator.com, yourator.net.evil.io), a subdomain like www.yourator.net, or a URL built from unvalidated user input.

Common situations: Config entries pointing at mirrors or staging domains; username/host confusion after parsing a company's custom share URL; typosquat domains; redirect chains that would land off-host (intercepted earlier by redirect:'error' but blocked here first).

Understand the failure class

Background: "Invalid URL" / "URL cannot be empty": fix the malformed or missing URL behind request-construction failures — this error's family across 50 libraries.

Related errors


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

Appendix: source

Thrown at providers/yourator.mjs:85

const FEED_BASE = `${SITE_ORIGIN}/api/v4/jobs`;
const TRUSTED_HOST = 'www.yourator.co';
// Safety bound only — the loop stops on payload.hasMore. The live board was 88
// pages on 2026-08-18; this leaves room to grow without silently truncating.
const DEFAULT_MAX_PAGES = 120;
const MAX_PAGES_CAP = 500;
const PAGE_DELAY_MS = 200;

/** @param {string} url */
function assertYouratorUrl(url) {
  let parsed;
  try {
    parsed = new URL(url);
  } catch {
    throw new Error(`yourator: invalid URL: ${url}`);
  }
  if (parsed.protocol !== 'https:') throw new Error(`yourator: URL must use HTTPS: ${url}`);
  if (parsed.hostname !== TRUSTED_HOST) {
    throw new Error(`yourator: untrusted hostname "${parsed.hostname}" — must be ${TRUSTED_HOST}`);
  }
  return url;
}

/** Resolve the page cap: a positive integer `max_pages` on the entry, capped. */
function resolveMaxPages(entry) {
  const v = entry?.max_pages;
  if (Number.isInteger(v) && v > 0) return Math.min(v, MAX_PAGES_CAP);
  return DEFAULT_MAX_PAGES;
}

/**
 * Canonical URL for a posting — Source Indexing Policy rule 2, "the shortest
 * verifiable path to the employer the source exposes".
 *
 * Prefers `thirdPartyUrl` (the employer's own ATS page), with the board's
 * `utm_*` ad parameters stripped. Accepts any https: origin — the value is
 * display-only and never fetched here. Falls back to the Yourator posting page

View on GitHub (pinned to aac998c7ed)