{"record":{"id":"e4db6f1108e7a8a0","repo":"abhigyanpatwari/GitNexus","slug":"refusing-gitnexus-internal-directory-as-auto-sync","errorCode":null,"errorMessage":"Refusing GitNexus internal directory as auto-sync clone root: ${root}","messagePattern":"Refusing GitNexus internal directory as auto-sync clone root: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"gitnexus/src/core/auto-sync/path-security.ts","lineNumber":235,"sourceCode":"      throw new Error(`Refusing unsafe auto-sync clone root under ${dangerousRoot}: ${root}`);\n    }\n  }\n  if (path.parse(root).root === root)\n    throw new Error(`Refusing filesystem root as clone root: ${root}`);\n}\n\nfunction assertNotGitNexusInternalRoot(root: string): void {\n  const gitnexusDir = path.resolve(getGlobalDir());\n  const blocked = [\n    path.join(gitnexusDir, 'groups'),\n    path.join(gitnexusDir, 'indexes'),\n    path.join(gitnexusDir, 'quarantine'),\n    path.join(getAutoSyncWatchDir(gitnexusDir), 'quarantine'),\n  ];\n  for (const blockedRoot of blocked) {\n    const rel = path.relative(blockedRoot, root);\n    if (!rel || (!rel.startsWith('..') && !path.isAbsolute(rel))) {\n      throw new Error(`Refusing GitNexus internal directory as auto-sync clone root: ${root}`);\n    }\n  }\n}\n\nasync function assertNoSymlinkPath(root: string): Promise<void> {\n  const parsed = path.parse(root);\n  let current = parsed.root;\n  const parts = root.slice(parsed.root.length).split(path.sep).filter(Boolean);\n  for (const part of parts) {\n    current = path.join(current, part);\n    let stat;\n    try {\n      stat = await fs.lstat(current);\n    } catch (err: unknown) {\n      if ((err as NodeJS.ErrnoException).code === 'ENOENT') break;\n      throw err;\n    }\n    if (stat.isSymbolicLink())","sourceCodeStart":217,"sourceCodeEnd":253,"githubUrl":"https://github.com/abhigyanpatwari/GitNexus/blob/0d1aed942f0e8b5d3bac27519fff441aceea722d/gitnexus/src/core/auto-sync/path-security.ts#L217-L253","documentation":"Thrown by assertNotGitNexusInternalRoot (via resolveConfiguredCloneRoot) when the clone root is equal to or nested inside a GitNexus-internal managed directory: <globalDir>/groups, <globalDir>/indexes, <globalDir>/quarantine, or the auto-sync watch-dir quarantine. Auto-sync must not place cloned repos where GitNexus stores its own indexes, group data, and quarantined clones, or the two would corrupt each other's contents.","triggerScenarios":"Thrown at gitnexus/src/core/auto-sync/path-security.ts:235 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Configure a clone root outside the GitNexus global directory's internal subfolders","Use the dedicated default <globalDir>/repos, which is explicitly allowed","If repos must live under the global dir, pick a new subdirectory name that is not groups/, indexes/, or quarantine/"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"0d1aed942f0e8b5d3bac27519fff441aceea722d","analyzedAt":"2026-09-08T00:40:44.970Z","contentChangedAt":"2026-09-08T00:40:44.970Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}