{"record":{"id":"fd8b2fad7e9d6cae","repo":"santifer/career-ops","slug":"itviec-url-must-use-https-url","errorCode":null,"errorMessage":"itviec: URL must use HTTPS: ${url}","messagePattern":"itviec: URL must use HTTPS: (.+?)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"providers/itviec.mjs","lineNumber":84,"sourceCode":"/** Relative publication label: English \"Posted … ago\" or Vietnamese \"Đăng … trước\". */\nconst POSTED_LABEL_RE =\n  /(?:Posted|Đăng)\\s*:?\\s*(?:<\\/\\w+>\\s*)?([^.<]{0,40}?(?:ago|trước)|today|hôm nay)/i;\n\n/** @param {any} ctx @param {number} ms */\nfunction sleep(ctx, ms) {\n  if (typeof ctx?.sleep === 'function') return ctx.sleep(ms);\n  return new Promise((r) => setTimeout(r, ms));\n}\n\n/** @param {string} url */\nfunction assertItviecUrl(url) {\n  let parsed;\n  try {\n    parsed = new URL(url);\n  } catch {\n    throw new Error(`itviec: invalid URL: ${url}`);\n  }\n  if (parsed.protocol !== 'https:') throw new Error(`itviec: URL must use HTTPS: ${url}`);\n  if (parsed.hostname !== TRUSTED_HOST) {\n    throw new Error(`itviec: untrusted hostname \"${parsed.hostname}\" — must be ${TRUSTED_HOST}`);\n  }\n  return url;\n}\n\n/**\n * Collapse a markup fragment to its visible text.\n * @param {string} fragment\n * @returns {string}\n */\nexport function visibleText(fragment) {\n  return decodeEntities(\n    String(fragment ?? '')\n      .replace(/<!--[\\s\\S]*?-->/g, ' ')\n      .replace(/<[^>]+>/g, ' '),\n  )\n    .replace(/\\s+/g, ' ')","sourceCodeStart":66,"sourceCodeEnd":102,"githubUrl":"https://github.com/santifer/career-ops/blob/aac998c7ed7248ea853b720ceeb1fdbeb322fc5d/providers/itviec.mjs#L66-L102","documentation":"assertItviecUrl requires the https: protocol; itviec content is only fetched over TLS. Any http:// URL — even one with the correct hostname — is rejected with this error to prevent downgrade/MITM of scraped content.","triggerScenarios":"A portals.yml entry (or test URL) uses http:// instead of https:// for an itviec.com URL and is passed through assertItviecUrl.","commonSituations":"Config copied from an old pre-HTTPS link; a manual edit dropped the 's'; a redirect target (http URL captured from logs) was pasted back into config.","solutions":["Change the scheme to https:// in the URL/portals.yml entry","Prefer https by default when constructing URLs in code (e.g. `https://${host}${path}` instead of `${scheme}://${host}`)","If the site redirects http->https, link directly to the https canonical URL"],"exampleFix":"// before\nassertItviecUrl('http://www.itviec.com/it-jobs');\n// after\nassertItviecUrl('https://www.itviec.com/it-jobs');","handlingStrategy":"validation","validationCode":"function isHttpsUrl(url) {\n  try { return new URL(url).protocol === 'https:'; } catch { return false; }\n}\n// check before calling: if (!isHttpsUrl(entry.careers_url)) upgrade or skip;","typeGuard":"const isHttps = (u) => { try { return new URL(u).protocol === 'https:'; } catch { return false; } };","tryCatchPattern":"try {\n  assertItviecUrl(url);\n} catch (err) {\n  if (/must use HTTPS/.test(err.message)) {\n    const upgraded = url.replace(/^http:/, 'https:');\n    return assertItviecUrl(upgraded); // one retry after scheme fix\n  }\n  throw err;\n}","preventionTips":["Default to https:// when building URLs programmatically","Never copy http:// links from old docs or logs into config","Normalize schemes in config-loading code","Prefer canonical https URLs the site itself redirects to"],"tags":["https","url-validation","security","config"],"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"}