{"record":{"id":"77837d433c128a3b","repo":"abhigyanpatwari/GitNexus","slug":"refusing-group-writable-auto-sync-clone-root-ro","errorCode":null,"errorMessage":"Refusing group-writable auto-sync clone root: ${root}","messagePattern":"Refusing group-writable auto-sync clone root: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"gitnexus/src/core/auto-sync/path-security.ts","lineNumber":279,"sourceCode":"  // POSIX uid/mode have no meaning on Windows, and this runs on every tick for\n  // every project, so throwing here failed 100% of repos forever while `watch\n  // status` still read `running`. Skip the ownership assertions rather than the\n  // whole feature: the caller's other guards — dangerous-root rejection\n  // (including the Windows system roots), symlink refusal, realpath containment\n  // and the GitNexus-internal-root check — all still apply, and managed git runs\n  // with `core.hooksPath` pinned to the null device.\n  if (process.platform === 'win32') return;\n  if (typeof process.getuid === 'function' && stat.uid !== process.getuid()) {\n    throw new Error(`auto-sync clone root is owned by uid ${stat.uid}, not current process uid`);\n  }\n  const mode = stat.mode & 0o777;\n  const groupWritable = (mode & 0o020) !== 0;\n  const worldWritable = (mode & 0o002) !== 0;\n  if (worldWritable) {\n    throw new Error(`Refusing world-writable auto-sync clone root: ${root}`);\n  }\n  if (groupWritable) {\n    throw new Error(`Refusing group-writable auto-sync clone root: ${root}`);\n  }\n}\n\nfunction assertContainedOrSame(root: string, child: string, message: string): void {\n  const rel = path.relative(root, child);\n  if (rel.startsWith('..') || path.isAbsolute(rel)) throw new Error(message);\n}\n","sourceCodeStart":261,"sourceCodeEnd":287,"githubUrl":"https://github.com/abhigyanpatwari/GitNexus/blob/0d1aed942f0e8b5d3bac27519fff441aceea722d/gitnexus/src/core/auto-sync/path-security.ts#L261-L287","documentation":"Thrown by assertDirectoryOwnerAndPermissions (POSIX only) when the clone-root directory's permission mode has the group-write bit set (mode & 0o010) and group writing is not expected. A group-writable directory allows other members of the owning group to tamper with cloned repository content that auto-sync subsequently pulls and indexes, so the directory is rejected until the permission is tightened.","triggerScenarios":"Thrown at gitnexus/src/core/auto-sync/path-security.ts:279 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["chmod g-w <root> to clear the group-write bit (e.g. chmod 755)","Apply chmod -R g-w if the permissive mode was inherited by existing cloned repos","Choose a clone root owned solely by the watcher user rather than a shared-group directory"],"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-14T05:17:10.506Z"}