{"record":{"id":"7405196bbeb7efe4","repo":"santifer/career-ops","slug":"himalayas-url-must-use-https-url","errorCode":null,"errorMessage":"himalayas: URL must use HTTPS: ${url}","messagePattern":"himalayas: URL must use HTTPS: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"providers/himalayas.mjs","lineNumber":22,"sourceCode":"// Himalayas provider - board-wide remote jobs API\n// (https://himalayas.app/jobs/api?limit=50). Returns { jobs: [...] }. The\n// full feed is fetched so scan.mjs's title_filter / location_filter can do\n// the local gating consistently with other zero-token board providers.\n//\n// Wire in via a `job_boards:` entry with `provider: himalayas`.\n\nconst FEED_URL = 'https://himalayas.app/jobs/api?limit=50';\nconst TRUSTED_HOST = 'himalayas.app';\n\n/** @param {string} url */\nfunction assertHimalayasUrl(url) {\n  let parsed;\n  try {\n    parsed = new URL(url);\n  } catch {\n    throw new Error(`himalayas: invalid URL: ${url}`);\n  }\n  if (parsed.protocol !== 'https:') throw new Error(`himalayas: URL must use HTTPS: ${url}`);\n  if (parsed.hostname !== TRUSTED_HOST) {\n    throw new Error(`himalayas: untrusted hostname \"${parsed.hostname}\" - must be ${TRUSTED_HOST}`);\n  }\n  return url;\n}\n\nfunction cleanText(value) {\n  return typeof value === 'string' ? value.trim() : '';\n}\n\nfunction cleanHimalayasUrl(value) {\n  const raw = cleanText(value);\n  if (!raw) return '';\n  try {\n    const parsed = new URL(raw);\n    const host = parsed.hostname.toLowerCase();\n    const trusted = host === TRUSTED_HOST || host.endsWith(`.${TRUSTED_HOST}`);\n    return parsed.protocol === 'https:' && trusted ? parsed.href : '';","sourceCodeStart":4,"sourceCodeEnd":40,"githubUrl":"https://github.com/santifer/career-ops/blob/9b17a8ac97b398a496b38e423ae24e433b43254f/providers/himalayas.mjs#L4-L40","documentation":"Thrown by assertHimalayasUrl when the URL parses but its protocol is not https:. As with 204, the shipped fetch() only ever passes the hardcoded https FEED_URL constant, so this branch cannot fire from the public contract. It is an SSRF guard that activates if the feed constant is changed to an http: value or if the function is reused on caller input.","triggerScenarios":"Editing FEED_URL to an http:// value (e.g. a staging host without TLS); reusing assertHimalayasUrl on entry-supplied input that uses http:. The unmodified provider's constant is https and never triggers this.","commonSituations":"Forgetting the https:// scheme when changing the feed host; pointing at a local/dev mirror over plain http during development.","solutions":["Ensure FEED_URL (or any URL passed in) uses the https: scheme.","If a dev mirror is http-only, gate the assert behind a test-only override rather than weakening the constant.","Keep TRUSTED_HOST and the scheme check together so a host change is reviewed alongside the scheme."],"exampleFix":"// before\nconst FEED_URL = 'http://himalayas.app/jobs/api?limit=50';\n\n// after\nconst FEED_URL = 'https://himalayas.app/jobs/api?limit=50';","handlingStrategy":"validation","validationCode":"// Verify scheme before driving the assert, for any URL you feed in.\nfunction ensureHttps(url) {\n  const u = new URL(url); // throws on malformed — see error 204\n  if (u.protocol !== 'https:') throw new Error(`not https: ${url}`);\n  return u.href;\n}","typeGuard":"/** True only for an https: absolute URL. */\nfunction isHttpsUrl(value) {\n  try { return new URL(value).protocol === 'https:'; } catch { return false; }\n}","tryCatchPattern":"try {\n  return await himalayasProvider.fetch(entry, ctx);\n} catch (err) {\n  if (/URL must use HTTPS/.test(err.message)) {\n    console.error(`himalayas: FEED_URL must be https — ${err.message}`);\n  }\n  throw err;\n}","preventionTips":["Always include the https:// scheme in FEED_URL and any caller URL.","If a dev mirror is http-only, gate the assert behind a test-only override instead of weakening the constant.","Review scheme and host together when changing endpoints."],"tags":["ssrf","url-validation","tls","himalayas","defense-in-depth"],"backgroundTag":null,"analyzedSha":"9b17a8ac97b398a496b38e423ae24e433b43254f","analyzedAt":"2026-08-13T00:48:39.135Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}