{"record":{"id":"0c3f3e800f2dd185","repo":"santifer/career-ops","slug":"smartrecruiters-url-must-use-https-url","errorCode":null,"errorMessage":"smartrecruiters: URL must use HTTPS: ${url}","messagePattern":"smartrecruiters: URL must use HTTPS: (.+?)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"providers/smartrecruiters.mjs","lineNumber":22,"sourceCode":"// SmartRecruiters provider — hits the public postings API.\n// Auto-detects from careers_url pattern\n// `https://(careers|jobs).smartrecruiters.com/<slug>`. A tracked_companies\n// entry can also set `provider: smartrecruiters` explicitly to bypass\n// detection (useful when the public careers URL is a branded custom domain).\n\nconst ALLOWED_SMARTRECRUITERS_HOSTS = new Set(['api.smartrecruiters.com']);\nconst SR_CAREERS_HOSTS = new Set(['careers.smartrecruiters.com', 'jobs.smartrecruiters.com']);\nconst SR_PAGE_SIZE = 100;\nconst SR_MAX_PAGES = 50;  // safety cap (5000 postings @ 100/page)\n\nfunction assertSmartRecruitersUrl(url) {\n  let parsed;\n  try {\n    parsed = new URL(url);\n  } catch {\n    throw new Error(`smartrecruiters: invalid URL: ${url}`);\n  }\n  if (parsed.protocol !== 'https:') throw new Error(`smartrecruiters: URL must use HTTPS: ${url}`);\n  if (!ALLOWED_SMARTRECRUITERS_HOSTS.has(parsed.hostname)) {\n    throw new Error(`smartrecruiters: untrusted hostname \"${parsed.hostname}\" — must be one of: ${[...ALLOWED_SMARTRECRUITERS_HOSTS].join(', ')}`);\n  }\n  return url;\n}\n\nfunction resolveSlug(entry) {\n  // entry.api takes precedence over careers_url (mirrors greenhouse/ashby) so a\n  // branded page (e.g. https://jobs.continental.com) can stay as careers_url\n  // while the SmartRecruiters slug is pinned via\n  // api: https://careers.smartrecruiters.com/<slug> in portals.yml.\n  for (const raw of [entry.api, entry.careers_url]) {\n    if (typeof raw !== 'string' || !raw) continue;\n    let parsed;\n    try {\n      parsed = new URL(raw);\n    } catch {\n      continue;","sourceCodeStart":4,"sourceCodeEnd":40,"githubUrl":"https://github.com/santifer/career-ops/blob/9b17a8ac97b398a496b38e423ae24e433b43254f/providers/smartrecruiters.mjs#L4-L40","documentation":"assertSmartRecruitersUrl rejects any URL whose protocol is not 'https:'. The check runs after the URL parses. Since the API URL is built from a constant base on api.smartrecruiters.com, this firing means the base was altered to http or an externally-supplied http URL reached the guard.","triggerScenarios":"The API base constant was changed to http://; an external caller passed an http URL; a redirect or scraped link captured the http variant.","commonSituations":"A development override switched the scheme to http; a config or environment variable altered the base URL.","solutions":["Restore the API base to its https:// form.","If a URL came from outside, upgrade: url.replace(/^http:/, 'https:').","Audit for any http://api.smartrecruiters.com references in config or code."],"exampleFix":"// before\nconst base = 'http://api.smartrecruiters.com/v1/companies';\n// after\nconst base = 'https://api.smartrecruiters.com/v1/companies';","handlingStrategy":"validation","validationCode":"function ensureHttps(raw) {\n  return typeof raw === 'string' ? raw.replace(/^http:\\/\\//i, 'https://') : raw;\n}\n// Pin the smartrecruiters API base\nconst SR_API_BASE = 'https://api.smartrecruiters.com';","typeGuard":"null","tryCatchPattern":"try {\n  await provider.fetch(entry, ctx);\n} catch (e) {\n  if (/must use HTTPS/.test(e.message)) {\n    console.error('[bug] smartrecruiters API base is http — restore https');\n  } else throw e;\n}","preventionTips":["Hardcode the smartrecruiters API base with https://.","Do not allow env overrides to downgrade the scheme.","Audit config for any http://api.smartrecruiters.com references."],"tags":["url-validation","https","provider","smartrecruiters","security"],"backgroundTag":null,"analyzedSha":"9b17a8ac97b398a496b38e423ae24e433b43254f","analyzedAt":"2026-08-13T00:48:39.135Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}