{"record":{"id":"c292b4467d054f1e","repo":"diegosouzapw/OmniRoute","slug":"path-unavailable-c292b4","errorCode":"path_unavailable","errorMessage":"Codex auth path could not be resolved","messagePattern":"Codex auth path could not be resolved","errorType":"exception","errorClass":"CodexAuthFileError","httpStatus":500,"severity":"error","filePath":"src/lib/oauth/utils/codexAuthFile.ts","lineNumber":314,"sourceCode":"  return {\n    connectionId,\n    connectionLabel,\n    fileName,\n    payload,\n    content,\n  };\n}\n\nexport async function writeCodexAuthFileToLocalCli(connectionId: string) {\n  const built = await buildCodexAuthFile(connectionId);\n  const paths = getCliConfigPaths(\"codex\");\n  // authPath is sourced exclusively from the static CLI_TOOLS table in\n  // src/shared/services/cliRuntime.ts (joined against os.homedir() inside\n  // that helper). No external/user input ever reaches the path APIs below.\n  const authPath = paths?.auth;\n\n  if (!authPath) {\n    throw new CodexAuthFileError(\"Codex auth path could not be resolved\", 500, \"path_unavailable\");\n  }\n\n  const authDir = path.dirname(authPath);\n  await fs.mkdir(authDir, { recursive: true });\n\n  // Side-by-side .bak inside the .codex directory for one-click manual\n  // rollback. Both halves are server-controlled (authDir from the static\n  // CLI_TOOLS table; basename from a server-generated ISO timestamp), so\n  // string concatenation here is safe — and avoids the false-positive\n  // taint on path.join when Semgrep cannot follow the trust chain.\n  let savedBakPath: string | null = null;\n  try {\n    await fs.access(authPath);\n    const ts = new Date().toISOString().replace(/[:.]/g, \"-\");\n    savedBakPath = `${authDir}${path.sep}auth-${ts}.bak`;\n    await fs.copyFile(authPath, savedBakPath);\n  } catch {\n    // No existing file; nothing to back up side-by-side.","sourceCodeStart":296,"sourceCodeEnd":332,"githubUrl":"https://github.com/diegosouzapw/OmniRoute/blob/a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d/src/lib/oauth/utils/codexAuthFile.ts#L296-L332","documentation":"Error \"Codex auth path could not be resolved\" thrown in diegosouzapw/OmniRoute.","triggerScenarios":"Thrown at src/lib/oauth/utils/codexAuthFile.ts:314 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d","analyzedAt":"2026-08-25T18:35:09.898Z","schemaVersion":2},"datasetVersion":"2026-08-25T21:54:21.419Z"}