santifer/career-ops · error · Error

weworkremotely: untrusted hostname "${parsed.hostname}" - mu

Error message

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

What it means

SSRF guard: the URL parsed and is https, but its hostname is not exactly weworkremotely.com. Stops a tampered feed URL from exfiltrating requests to another host. Runtime redirects are already blocked by redirect: "error" on the fetch, so this guards the constant itself.

Source

Thrown at providers/weworkremotely.mjs:24

// and XML, so it is parsed in-process with the same tiny tag extractor approach
// as providers/personio.mjs rather than adding an XML dependency.
//
// Wire in via a `job_boards:` entry with `provider: weworkremotely`.

const FEED_URL = 'https://weworkremotely.com/remote-jobs.rss';
const TRUSTED_HOST = 'weworkremotely.com';

/** @param {string} url */
function assertWwrUrl(url) {
  let parsed;
  try {
    parsed = new URL(url);
  } catch {
    throw new Error(`weworkremotely: invalid URL: ${url}`);
  }
  if (parsed.protocol !== 'https:') throw new Error(`weworkremotely: URL must use HTTPS: ${url}`);
  if (parsed.hostname !== TRUSTED_HOST) {
    throw new Error(`weworkremotely: 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;
}

function fallbackCompany(entry) {
  return typeof entry?.name === 'string' && entry.name.trim() ? entry.name.trim() : 'We Work Remotely';
}

/** @type {Provider} */
export default {
  id: 'weworkremotely',

View on GitHub (pinned to 9b17a8ac97)

Solutions

  1. Restore hostname to weworkremotely.com.
  2. If WWR ever moves the feed, update TRUSTED_HOST and FEED_URL together.

Example fix

// before
const FEED_URL = 'https://feeds.example.com/wr.rss';
// after
const FEED_URL = 'https://weworkremotely.com/remote-jobs.rss';
Defensive patterns

Strategy: validation

Validate before calling

const TRUSTED_HOST = 'weworkremotely.com';
if (new URL(FEED_URL).hostname !== TRUSTED_HOST)
  throw new Error("weworkremotely: hostname drifted from TRUSTED_HOST");

Type guard

const isTrustedHost = (s, h) => { try { return new URL(s).hostname === h; } catch { return false; } };

Prevention

When it happens

Trigger: Reached with the FEED_URL constant; fires if a maintainer points it at a different host (e.g. a staging mirror or look-alike domain).

Common situations: FEED_URL edited to a staging mirror; a bad merge; the We Work Remotely feed moved and TRUSTED_HOST was not updated in step.

Related errors


AI-assisted analysis of santifer/career-ops@9b17a8ac97 (2026-08-13). Data as JSON: /api/errors/d5e293de5d69fb2c. Report an issue: GitHub.