santifer/career-ops · error · Error

weworkremotely: untrusted hostname

Error message

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

What it means

The weworkremotely provider pins requests to a single trusted host: weworkremotely.com (TRUSTED_HOST). If the URL parses and is https but its hostname differs — mirrors, www-prefixed variants, look-alike domains — assertWwrUrl throws this error. It is an allowlist/SSRF guard: only the genuine feed host is ever contacted.

Solutions

  1. Use exactly https://weworkremotely.com/remote-jobs.rss — no www prefix, no extra subdomains
  2. Drop the custom careers_url entirely and let the provider use its built-in FEED_URL constant
  3. Check the hostname for typos or look-alike characters; the check is an exact string comparison on parsed.hostname
  4. If a different host is truly needed, change TRUSTED_HOST in providers/weworkremotely.mjs deliberately — never bypass the check in config

Example fix

// before
careers_url: https://www.weworkremotely.com/remote-jobs.rss
// after
careers_url: https://weworkremotely.com/remote-jobs.rss
Defensive patterns

Strategy: validation

Validate before calling

const TRUSTED_HOST = 'weworkremotely.com';
const isTrustedWwrUrl = (url) => {
  try {
    const p = new URL(url);
    return p.protocol === 'https:' && p.hostname === TRUSTED_HOST;
  } catch { return false; }
};

Type guard

const isWwrHost = (u) => { try { return new URL(u).hostname === 'weworkremotely.com'; } catch { return false; } };

Try / catch

try {
  await wwrProvider.fetch(entry, ctx);
} catch (err) {
  if (err.message.startsWith('weworkremotely: untrusted hostname')) {
    console.error(`${entry.name}: only weworkremotely.com is allowed — ${err.message}`);
    return;
  }
  throw err;
}

Prevention

When it happens

Trigger: Configuring a careers_url like 'https://www.weworkremotely.com/remote-jobs.rss', 'https://weworkremotely.com.evil.example/...', 'https://remoteok.com/...' (wrong site), or a typo'd host such as 'weworkremotely.co'. All parse fine and are https, but the hostname does not string-equal 'weworkremotely.com'.

Common situations: Adding a www. prefix out of habit, DNS/hosts-file experiments pointing the name elsewhere, phishing or mirror URLs pasted from search results, hostname casing assumptions (hostnames are compared exactly).

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/d5e293de5d69fb2c. Report an issue: GitHub.

Appendix: source

Thrown at providers/weworkremotely.mjs:25

// 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 aac998c7ed)