{"record":{"id":"d5558b9ac288e506","repo":"santifer/career-ops","slug":"getonbrd-invalid-url-url","errorCode":null,"errorMessage":"getonbrd: invalid URL: ${url}","messagePattern":"getonbrd: invalid URL: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"providers/getonbrd.mjs","lineNumber":27,"sourceCode":"// scan.mjs's title_filter can gate on the configured titles instead. Pages are\n// fetched until one comes back short/empty or the page cap is reached (default\n// 3, override with `max_pages` on the portal entry).\n//\n// Wire in via a `job_boards:` entry with `provider: getonbrd`.\n\nconst FEED_BASE = 'https://www.getonbrd.com/api/v0/categories/programming/jobs';\nconst TRUSTED_HOST = 'www.getonbrd.com';\nconst PER_PAGE = 100;\nconst DEFAULT_MAX_PAGES = 3;\nconst MAX_PAGES_CAP = 50;\n\n/** @param {string} url */\nfunction assertGetonbrdUrl(url) {\n  let parsed;\n  try {\n    parsed = new URL(url);\n  } catch {\n    throw new Error(`getonbrd: invalid URL: ${url}`);\n  }\n  if (parsed.protocol !== 'https:') throw new Error(`getonbrd: URL must use HTTPS: ${url}`);\n  if (parsed.hostname !== TRUSTED_HOST) {\n    throw new Error(`getonbrd: untrusted hostname \"${parsed.hostname}\" — must be ${TRUSTED_HOST}`);\n  }\n  return url;\n}\n\n/** Resolve the page cap: a positive integer `max_pages` on the entry, capped. */\nfunction resolveMaxPages(entry) {\n  const v = entry?.max_pages;\n  if (Number.isInteger(v) && v > 0) return Math.min(v, MAX_PAGES_CAP);\n  return DEFAULT_MAX_PAGES;\n}\n\n/**\n * Normalize a single Get on Board job (JSON:API resource). Exported for tests.\n *","sourceCodeStart":9,"sourceCodeEnd":45,"githubUrl":"https://github.com/santifer/career-ops/blob/9b17a8ac97b398a496b38e423ae24e433b43254f/providers/getonbrd.mjs#L9-L45","documentation":"getonbrd.mjs throws this inside assertGetonbrdUrl() when `new URL(url)` raises — the string is not an absolute, parseable URL. The guard validates the Get on Board feed endpoint before fetching. The validated URL is built from the module constant FEED_BASE ('https://www.getonbrd.com/api/v0/categories/programming/jobs'), so a live throw means FEED_BASE was corrupted/edited to a non-URL, or a test called the guard with a malformed string.","triggerScenarios":"FEED_BASE was edited to a relative path or a string with illegal characters; a config/CI injection replaced the constant with undefined/''; a unit test invokes assertGetonbrdUrl('/api/v0/...') or assertGetonbrdUrl('not a url').","commonSituations":"A contributor shortens the constant to a path assuming base resolution; a templating step mangled the URL; a test expected a different error path.","solutions":["Restore FEED_BASE to 'https://www.getonbrd.com/api/v0/categories/programming/jobs'.","Ensure no runtime code mutates FEED_BASE; it is a literal constant.","In tests, pass a well-formed absolute URL when you do not intend to hit this branch."],"exampleFix":"// before\nconst FEED_BASE = '/api/v0/categories/programming/jobs'; // relative -> throws\n\n// after\nconst FEED_BASE = 'https://www.getonbrd.com/api/v0/categories/programming/jobs';","handlingStrategy":"validation","validationCode":"// Startup self-check: FEED_BASE must be an absolute URL.\nfunction checkGetonbrdFeed() {\n  try { new URL('https://www.getonbrd.com/api/v0/categories/programming/jobs'); }\n  catch { throw new Error('getonbrd FEED_BASE is not a valid absolute URL'); }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep FEED_BASE a literal absolute URL; never compute it at runtime.","Add a CI test that assertGetonbrdUrl(FEED_BASE) does not throw.","Review any PR editing the FEED_BASE line."],"tags":["url-validation","getonbrd","config","ssrf-guard"],"backgroundTag":null,"analyzedSha":"9b17a8ac97b398a496b38e423ae24e433b43254f","analyzedAt":"2026-08-13T00:48:39.135Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}