{"record":{"id":"65904d93d3f1a9eb","repo":"santifer/career-ops","slug":"torre-url-must-use-https-url","errorCode":null,"errorMessage":"torre: URL must use HTTPS: ${url}","messagePattern":"torre: URL must use HTTPS: (.+?)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"providers/torre.mjs","lineNumber":92,"sourceCode":"// same result set, so the default is arbitrary among them.\nconst EXPERIENCE_LEVELS = new Set([\n  'potential-to-develop',\n  '1-plus-year',\n  '2-plus-years',\n  '3-plus-years',\n  '5-plus-years',\n]);\nconst DEFAULT_EXPERIENCE = '1-plus-year';\n\n/** @param {string} url */\nfunction assertTorreUrl(url) {\n  let parsed;\n  try {\n    parsed = new URL(url);\n  } catch {\n    throw new Error(`torre: invalid URL: ${url}`);\n  }\n  if (parsed.protocol !== 'https:') throw new Error(`torre: URL must use HTTPS: ${url}`);\n  if (parsed.hostname !== TRUSTED_API_HOST) {\n    throw new Error(`torre: untrusted hostname \"${parsed.hostname}\" — must be ${TRUSTED_API_HOST}`);\n  }\n  return url;\n}\n\n/**\n * Build the search body from the portal entry. Only filters proven to affect\n * `total` are emitted — see the header note. Exported for tests.\n *\n * @param {any} entry\n * @returns {object}\n */\nexport function buildTorreQuery(entry) {\n  /** @type {Record<string, unknown>} */\n  const body = {};\n\n  const search = typeof entry?.search === 'string' ? entry.search.trim() : '';","sourceCodeStart":74,"sourceCodeEnd":110,"githubUrl":"https://github.com/santifer/career-ops/blob/aac998c7ed7248ea853b720ceeb1fdbeb322fc5d/providers/torre.mjs#L74-L110","documentation":"The torre provider validates every URL it is handed through assertTorreUrl before making a request. After parsing succeeds, it requires the protocol to be exactly https:. Any http:, ftp:, or other scheme is rejected with this error, since the provider only ever talks to the TLS-only Torre search API and will not downgrade a URL that was misconfigured to plain HTTP.","triggerScenarios":"A portals.yml job_boards entry (or any caller passing a URL into the torre provider) specifies a careers_url or endpoint starting with http:// instead of https://, e.g. 'http://search.torre.co/opportunities/_search'. The URL parses fine as a URL, so the invalid-URL branch is not hit; only the scheme check fires.","commonSituations":"Hand-editing portals.yml and forgetting the trailing 's', copying a URL from an insecure redirect or old documentation, template placeholders that concatenate 'http://' as a default prefix, or a stored config value that was normalized to http somewhere upstream.","solutions":["Change the URL in the portal entry to use https:// instead of http://","If the URL is built programmatically, hardcode the https: scheme rather than deriving it from user input","Verify the final URL with new URL(url).protocol === 'https:' before passing it to the provider"],"exampleFix":"// before\ncareers_url: http://search.torre.co/opportunities/_search\n// after\ncareers_url: https://search.torre.co/opportunities/_search","handlingStrategy":"validation","validationCode":"function assertHttpsUrl(url) {\n  const parsed = new URL(url); // throws if unparseable\n  if (parsed.protocol !== 'https:') {\n    throw new Error(`URL must use HTTPS: ${url}`);\n  }\n  return url;\n}\n// call before invoking the provider: assertHttpsUrl(entry.careers_url)","typeGuard":"const isHttpsUrl = (u) => { try { return new URL(u).protocol === 'https:'; } catch { return false; } };","tryCatchPattern":"try {\n  await provider.fetch(entry);\n} catch (err) {\n  if (err.message.startsWith('torre:') && err.message.includes('must use HTTPS')) {\n    console.error(`Config error: fix ${entry.name} careers_url to https:// — ${err.message}`);\n    return; // skip entry, do not retry\n  }\n  throw err;\n}","preventionTips":["Always write full https:// URLs in portals.yml; never rely on scheme defaults","Lint portal config at startup with a protocol check for every careers_url","Keep the provider's default endpoint instead of hand-writing URLs where possible"],"tags":["url-validation","https","config","security"],"backgroundTag":"invalid-url-format","analyzedSha":"aac998c7ed7248ea853b720ceeb1fdbeb322fc5d","analyzedAt":"2026-09-16T06:35:29.214Z","contentChangedAt":"2026-09-16T06:35:29.214Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}