{"record":{"id":"8bd4bb1541595fa0","repo":"santifer/career-ops","slug":"nodesk-url-must-use-https-url","errorCode":null,"errorMessage":"nodesk: URL must use HTTPS: ${url}","messagePattern":"nodesk: URL must use HTTPS: (.+?)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"providers/nodesk.mjs","lineNumber":23,"sourceCode":"// NoDesk provider - board-wide RSS feed\n// (https://nodesk.co/remote-jobs/index.xml). The feed is public, no-auth,\n// and XML, so it is parsed in-process with the same tiny tag extractor\n// approach as providers/personio.mjs rather than adding an XML dependency.\n//\n// Wire in via a `job_boards:` entry with `provider: nodesk`.\n\nconst FEED_URL = 'https://nodesk.co/remote-jobs/index.xml';\nconst TRUSTED_HOST = 'nodesk.co';\n\n/** @param {string} url */\nfunction assertNodeskUrl(url) {\n  let parsed;\n  try {\n    parsed = new URL(url);\n  } catch {\n    throw new Error(`nodesk: invalid URL: ${url}`);\n  }\n  if (parsed.protocol !== 'https:') throw new Error(`nodesk: URL must use HTTPS: ${url}`);\n  if (parsed.hostname !== TRUSTED_HOST) {\n    throw new Error(`nodesk: untrusted hostname \"${parsed.hostname}\" - must be ${TRUSTED_HOST}`);\n  }\n  return url;\n}\n\n// NaN-safe Date.parse - `|| undefined` would also coerce a valid epoch 0.\nfunction toEpochMs(value) {\n  if (!value) return undefined;\n  const parsed = Date.parse(value);\n  return Number.isNaN(parsed) ? undefined : parsed;\n}\n\nfunction fallbackCompany(entry) {\n  return typeof entry?.name === 'string' && entry.name.trim() ? entry.name.trim() : 'NoDesk';\n}\n\n/** @type {Provider} */","sourceCodeStart":5,"sourceCodeEnd":41,"githubUrl":"https://github.com/santifer/career-ops/blob/aac998c7ed7248ea853b720ceeb1fdbeb322fc5d/providers/nodesk.mjs#L5-L41","documentation":"assertNodeskUrl enforces HTTPS on every URL it accepts. Once the string parses as a URL, this error is thrown if parsed.protocol is anything other than 'https:' — typically a plain-http URL. The provider only talks to the trusted host over TLS, so http:// links are rejected outright.","triggerScenarios":"Calling the nodesk provider (or assertNodeskUrl) with a URL whose scheme is 'http:' or any non-https scheme such as 'ftp:' — e.g. 'http://<trusted-host>/api/jobs'.","commonSituations":"A config file or portal entry written with http:// by habit; an older bookmarked/internal link that predates HTTPS enforcement; a URL copied from a redirect chain that starts with http; mixed-scheme concatenation like 'http://' + host.","solutions":["Change the scheme in the config/source to https://","If the source is an env var or CLI flag, update the value passed in to use https","If you control the upstream link, replace stored http:// links with their https equivalents","Do not disable the check — the host requirement exists to keep API traffic encrypted and pinned to the trusted host"],"exampleFix":"// before\n{ careers_url: 'http://nodesk.example/api/postings' }\n// after\n{ careers_url: 'https://nodesk.example/api/postings' }","handlingStrategy":"validation","validationCode":"const parsed = new URL(url);\nif (parsed.protocol !== 'https:') throw new Error(`use https: ${url}`);","typeGuard":"function isHttpsUrl(u) {\n  try { return new URL(u).protocol === 'https:'; } catch { return false; }\n}","tryCatchPattern":"try {\n  useNodesk(url);\n} catch (e) {\n  if (String(e.message).startsWith('nodesk: URL must use HTTPS')) {\n    log.warn(`Upgrading to https: ${url}`);\n    return useNodesk(url.replace(/^http:/, 'https:'));\n  }\n  throw e;\n}","preventionTips":["Normalize schemes once at config load: upgrade http:// to https:// or reject with a clear message","Never copy URLs from HTTP redirect logs; take them from the live address bar","Add a CI check that flags http:// in portals/config files","Default to https:// when writing new config entries by hand"],"tags":["url-validation","https","security"],"backgroundTag":"invalid-url","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"}