santifer/career-ops · error · Error

weworkremotely: invalid URL: ${url}

Error message

weworkremotely: invalid URL: ${url}

What it means

assertWwrUrl is an SSRF guard that pins every request this provider makes to https://weworkremotely.com. This branch fires when new URL(url) throws — the string is not parseable as an absolute URL at all. In production it is only ever called with the module constant FEED_URL, so it is effectively a maintainer-invariant guard, not a user-configurable error.

Source

Thrown at providers/weworkremotely.mjs:20

/** @typedef {import('./_types.js').Provider} Provider */

// We Work Remotely provider - board-wide RSS feed
// (https://weworkremotely.com/remote-jobs.rss). The feed is public, no-auth,
// 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';
}

View on GitHub (pinned to 9b17a8ac97)

Solutions

  1. Restore FEED_URL to https://weworkremotely.com/remote-jobs.rss.
  2. If you intentionally changed the host, keep it an absolute https URL.
  3. Add a unit test asserting assertWwrUrl(FEED_URL) does not throw.

Example fix

// before
const FEED_URL = 'weworkremotely.com/remote-jobs.rss'; // missing scheme
// after
const FEED_URL = 'https://weworkremotely.com/remote-jobs.rss';
Defensive patterns

Strategy: validation

Validate before calling

// sanity-check module constants at load time rather than at first request
const FEED_URL = 'https://weworkremotely.com/remote-jobs.rss';
try { new URL(FEED_URL); }
catch { throw new Error(`weworkremotely: FEED_URL constant is malformed: ${FEED_URL}`); }

Type guard

const isAbsoluteUrl = (s) => { try { new URL(s); return true; } catch { return false; } };

Prevention

When it happens

Trigger: Reached only with the FEED_URL constant (line 49). Fires if a maintainer edits FEED_URL into something new URL() rejects (empty string, embedded NUL, missing scheme). Not reachable from portals.yml config.

Common situations: A PR that refactors FEED_URL and breaks it; a bad merge; running a patched fork that changed the constant.

Related errors


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