{"record":{"id":"936605d059375eb8","repo":"santifer/career-ops","slug":"the-release-pointer-names-an-unusable-index-filena","errorCode":null,"errorMessage":"the release pointer names an unusable index filename (${JSON.stringify(doc.filename)}): ${url}","messagePattern":"the release pointer names an unusable index filename \\((.+?)\\): (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"plugins/h1b-sponsor/install-h1b-index.mjs","lineNumber":122,"sourceCode":"  const out = await fetchImpl(url, { timeoutMs: POINTER_TIMEOUT_MS }, async res => {\n    if (res.status !== 200) return { status: res.status };\n    const read = await readBoundedText(res, MAX_POINTER_BYTES);\n    return read.oversized ? { oversized: true } : { text: read.text };\n  });\n  if (out.status) throw new Error(`could not read the release pointer (HTTP ${out.status}): ${url}`);\n  if (out.oversized) throw new Error(`the release pointer is implausibly large: ${url}`);\n\n  let doc;\n  try {\n    doc = JSON.parse(String(out.text || ''));\n  } catch {\n    throw new Error(`the release pointer is not JSON: ${url}`);\n  }\n  if (!doc || typeof doc !== 'object') throw new Error(`the release pointer is not an object: ${url}`);\n\n  const filename = String(doc.filename || '');\n  if (!FILENAME_RE.test(filename)) {\n    throw new Error(`the release pointer names an unusable index filename (${JSON.stringify(doc.filename)}): ${url}`);\n  }\n  const sha256 = String(doc.sha256 || '').trim().toLowerCase();\n  if (!SHA256_RE.test(sha256)) {\n    throw new Error(`the release pointer does not carry a sha256 digest: ${url}`);\n  }\n  // Recorded, never acted on, so a missing or odd value costs a label rather\n  // than the install. Bounded because it lands in a file on disk.\n  const version = doc.version === undefined || doc.version === null\n    ? null\n    : String(doc.version).slice(0, 64);\n  return { filename, sha256, version };\n}\n\n/**\n * Stream the asset to `tmpFile`, hashing as it goes, and return the digest.\n *\n * Streamed rather than buffered: the body is millions of times the size of\n * anything else this plugin reads, and readBoundedText's 1 MiB ceiling exists","sourceCodeStart":104,"sourceCodeEnd":140,"githubUrl":"https://github.com/santifer/career-ops/blob/aac998c7ed7248ea853b720ceeb1fdbeb322fc5d/plugins/h1b-sponsor/install-h1b-index.mjs#L104-L140","documentation":"The parsed pointer object must contain a `filename` matching FILENAME_RE; otherwise the installer refuses it, since the filename is used to construct the archive download path. A missing, empty, or path-like/unsafe filename is rejected — this also acts as a path-traversal guard.","triggerScenarios":"Running install-h1b-index.mjs against a pointer document whose `filename` field is absent, null, empty, or fails the expected index-filename pattern (e.g. contains slashes, '../', or an unexpected extension).","commonSituations":"A self-hosted or hand-edited pointer missing the filename key; a renamed archive asset so the pointer was regenerated with a different naming convention; a malicious/compromised pointer attempting path traversal.","solutions":["Inspect the pointer JSON and ensure it has a `filename` field matching the expected index archive name (e.g. h1b-index.sqlite.zst).","If you maintain the pointer, publish the correct filename key with a plain filename — no paths or directories.","Re-point the installer at the official pointer URL to get a known-good document.","Treat repeated failures from a third-party URL as a trust problem — only use pointers you trust."],"exampleFix":"// before\n{\"sha256\":\"abc...\"}                       // filename missing\n// after\n{\"filename\":\"h1b-index.sqlite.zst\",\"sha256\":\"abc...\"}","handlingStrategy":"validation","validationCode":"const doc = JSON.parse(text);\nif (!/^[A-Za-z0-9._-]+$/.test(String(doc?.filename ?? ''))) {\n  throw new TypeError(`unsafe or missing pointer filename: ${JSON.stringify(doc?.filename)}`);\n}","typeGuard":"const hasSafeFilename = (doc) => doc && typeof doc.filename === 'string' && /^[A-Za-z0-9._-]+$/.test(doc.filename);","tryCatchPattern":"try {\n  await installH1bIndex();\n} catch (e) {\n  if (e.message.includes('unusable index filename')) {\n    console.error(`Pointer filename rejected (${e.message}). Use a plain archive filename with no path components.`);\n  } else throw e;\n}","preventionTips":["Always include a plain `filename` (basename only) in pointer documents.","Never allow path separators in pointer filenames — treat this as a path-traversal guard.","Only trust pointers from sources you control or vet."],"tags":["validation","security","install"],"backgroundTag":"schema-validation-failed","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"}