santifer/career-ops · error · Error

jobspresso: untrusted hostname

Error message

jobspresso: untrusted hostname "${parsed.hostname}" - must be ${TRUSTED_HOST}

What it means

assertJobspressoUrl enforces an exact single-host allowlist: parsed.hostname must equal TRUSTED_HOST ('jobspresso.co'). Any other hostname — subdomains, lookalikes, or internal hosts — is rejected, because these URLs are fetched server-side and the allowlist is the provider's SSRF guard.

Solutions

  1. Use exactly https://jobspresso.co/?feed=job_feed (no www. prefix)
  2. Audit the configured URL for appended/spoofed host segments
  3. To trust another host you must change TRUSTED_HOST in providers/jobspresso.mjs — keep the allowlist strict by default

Example fix

// before
url: https://www.jobspresso.co/?feed=job_feed
// after
url: https://jobspresso.co/?feed=job_feed
Defensive patterns

Strategy: validation

Validate before calling

function isTrustedJobspressoHost(url) {
  try { return new URL(url).hostname === 'jobspresso.co'; } catch { return false; }
}

Type guard

function isExactHost(u, host) {
  return URL.canParse(u) && new URL(u).hostname === host;
}

Try / catch

try {
  assertJobspressoUrl(u);
} catch (e) {
  if (/untrusted hostname/.test(e.message)) {
    console.error(`${e.message} — use https://jobspresso.co/?feed=job_feed`);
    return [];
  }
  throw e;
}

Prevention

When it happens

Trigger: Calling assertJobspressoUrl with 'https://www.jobspresso.co/...' (wrong host — note www.), 'https://jobspresso.co.evil.com/...', 'https://localhost/?feed=job_feed', or any hostname !== 'jobspresso.co'.

Common situations: Adding 'www.' out of habit; typosquat/mirror domains pasted into config; SSRF attempts naming internal hosts that the allowlist blocks.

Understand the failure class

Background: "Invalid URL" errors: why new URL(), URI.parse, and reqwest::Url reject your string — missing scheme, whitespace, and bad path format — this error's family across 39 libraries.

Related errors


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

Appendix: source

Thrown at providers/jobspresso.mjs:26

// approach as providers/personio.mjs rather than adding an XML dependency.
//
// Wire in via a `job_boards:` entry with `provider: jobspresso`.

const FEED_URL = 'https://jobspresso.co/?feed=job_feed';
const TRUSTED_HOST = 'jobspresso.co';

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

// NaN-safe Date.parse - `|| undefined` would also coerce a valid epoch 0.
function toEpochMs(value) {
  if (!value) return undefined;
  const parsed = Date.parse(value);
  return Number.isNaN(parsed) ? undefined : parsed;
}

/** @type {Provider} */
export default {
  id: "jobspresso",

  detect(entry) {

View on GitHub (pinned to aac998c7ed)