{"record":{"id":"b1c27f7bca70b90d","repo":"santifer/career-ops","slug":"wttj-url-must-use-https-url","errorCode":null,"errorMessage":"wttj: URL must use HTTPS: ${url}","messagePattern":"wttj: URL must use HTTPS: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"providers/wttj.mjs","lineNumber":40,"sourceCode":"// Each hit maps to the normalized Job shape; salary_yearly_minimum (when\n// present) is attached as `salary: {min, max, currency}` so scan.mjs's\n// salary_filter can gate on it.\n\nconst ENV_URL = 'https://www.welcometothejungle.com/api/env';\nconst SITE_ORIGIN = 'https://www.welcometothejungle.com';\nconst INDEX = 'wttj_jobs_production_en';\nconst DEFAULT_MAX_HITS = 100;\nconst MAX_HITS_CAP = 200;\n\n/** Pin a URL to an expected https host. */\nfunction assertHost(url, host, label) {\n  let parsed;\n  try {\n    parsed = new URL(url);\n  } catch {\n    throw new Error(`wttj: invalid URL: ${url}`);\n  }\n  if (parsed.protocol !== 'https:') throw new Error(`wttj: URL must use HTTPS: ${url}`);\n  if (parsed.hostname !== host.toLowerCase()) {\n    throw new Error(`wttj: untrusted ${label} hostname \"${parsed.hostname}\" — must be ${host}`);\n  }\n  return url;\n}\n\n/**\n * Parse the `window.env = {...}` payload served by /api/env and extract the\n * Algolia application id + client search key.\n * @param {string} text\n * @returns {{ appId: string, apiKey: string }}\n */\nexport function parseEnvPayload(text) {\n  const start = text.indexOf('{');\n  const end = text.lastIndexOf('}');\n  if (start === -1 || end <= start) throw new Error('wttj: /api/env payload has no JSON object');\n  let env;\n  try {","sourceCodeStart":22,"sourceCodeEnd":58,"githubUrl":"https://github.com/santifer/career-ops/blob/9b17a8ac97b398a496b38e423ae24e433b43254f/providers/wttj.mjs#L22-L58","documentation":"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.","triggerScenarios":"A maintainer sets ENV_URL to http://; a bad merge.","commonSituations":"Debugging change not reverted; bad merge.","solutions":["Restore https in ENV_URL and the Algolia host template."],"exampleFix":"// before\nconst ENV_URL = 'http://www.welcometothejungle.com/api/env';\n// after\nconst ENV_URL = 'https://www.welcometothejungle.com/api/env';","handlingStrategy":"validation","validationCode":"if (new URL(ENV_URL).protocol !== \"https:\")\n  throw new Error(\"wttj: ENV_URL must be https\");","typeGuard":"const isHttps = (s) => { try { return new URL(s).protocol === \"https:\"; } catch { return false; } };","tryCatchPattern":null,"preventionTips":["Treat the https requirement as load-bearing for SSRF safety — do not relax it.","CI lint that flags http:// literals in providers/."],"tags":["validation","url","ssrf-guard","https","wttj","invariant"],"backgroundTag":null,"analyzedSha":"9b17a8ac97b398a496b38e423ae24e433b43254f","analyzedAt":"2026-08-13T00:48:39.135Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}