santifer/career-ops · error · Error

wttj: URL must use HTTPS: ${url}

Error message

wttj: URL must use HTTPS: ${url}

What it means

SSRF guard: the URL parsed but its protocol is not https. Only fires if ENV_URL is http or the Algolia host is built with http — both constant/template regressions.

Source

Thrown at providers/wttj.mjs:40

// Each hit maps to the normalized Job shape; salary_yearly_minimum (when
// present) is attached as `salary: {min, max, currency}` so scan.mjs's
// salary_filter can gate on it.

const ENV_URL = 'https://www.welcometothejungle.com/api/env';
const SITE_ORIGIN = 'https://www.welcometothejungle.com';
const INDEX = 'wttj_jobs_production_en';
const DEFAULT_MAX_HITS = 100;
const MAX_HITS_CAP = 200;

/** Pin a URL to an expected https host. */
function assertHost(url, host, label) {
  let parsed;
  try {
    parsed = new URL(url);
  } catch {
    throw new Error(`wttj: invalid URL: ${url}`);
  }
  if (parsed.protocol !== 'https:') throw new Error(`wttj: URL must use HTTPS: ${url}`);
  if (parsed.hostname !== host.toLowerCase()) {
    throw new Error(`wttj: untrusted ${label} hostname "${parsed.hostname}" — must be ${host}`);
  }
  return url;
}

/**
 * Parse the `window.env = {...}` payload served by /api/env and extract the
 * Algolia application id + client search key.
 * @param {string} text
 * @returns {{ appId: string, apiKey: string }}
 */
export function parseEnvPayload(text) {
  const start = text.indexOf('{');
  const end = text.lastIndexOf('}');
  if (start === -1 || end <= start) throw new Error('wttj: /api/env payload has no JSON object');
  let env;
  try {

View on GitHub (pinned to 9b17a8ac97)

Solutions

  1. Restore https in ENV_URL and the Algolia host template.

Example fix

// before
const ENV_URL = 'http://www.welcometothejungle.com/api/env';
// after
const ENV_URL = 'https://www.welcometothejungle.com/api/env';
Defensive patterns

Strategy: validation

Validate before calling

if (new URL(ENV_URL).protocol !== "https:")
  throw new Error("wttj: ENV_URL must be https");

Type guard

const isHttps = (s) => { try { return new URL(s).protocol === "https:"; } catch { return false; } };

Prevention

When it happens

Trigger: A maintainer sets ENV_URL to http://; a bad merge.

Common situations: Debugging change not reverted; bad merge.

Related errors


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