abhigyanpatwari/GitNexus · error · Error
Refusing world-writable auto-sync clone root: ${root}
Error message
Refusing world-writable auto-sync clone root: ${root} What it means
Thrown by assertDirectoryOwnerAndPermissions (POSIX only) when the clone-root directory's permission mode has the other-write bit set (mode & 0o002). A world-writable directory lets any local user add, remove, or replace cloned repositories, which auto-sync would then pull and index — a privilege-escalation vector into the analysis pipeline. The guard rejects the directory rather than downgrading expectations.
Source
Thrown at gitnexus/src/core/auto-sync/path-security.ts:276
export async function assertDirectoryOwnerAndPermissions(root: string): Promise<void> {
const stat = await fs.stat(root);
if (!stat.isDirectory()) throw new Error(`auto-sync clone root is not a directory: ${root}`);
// POSIX uid/mode have no meaning on Windows, and this runs on every tick for
// every project, so throwing here failed 100% of repos forever while `watch
// status` still read `running`. Skip the ownership assertions rather than the
// whole feature: the caller's other guards — dangerous-root rejection
// (including the Windows system roots), symlink refusal, realpath containment
// and the GitNexus-internal-root check — all still apply, and managed git runs
// with `core.hooksPath` pinned to the null device.
if (process.platform === 'win32') return;
if (typeof process.getuid === 'function' && stat.uid !== process.getuid()) {
throw new Error(`auto-sync clone root is owned by uid ${stat.uid}, not current process uid`);
}
const mode = stat.mode & 0o777;
const groupWritable = (mode & 0o020) !== 0;
const worldWritable = (mode & 0o002) !== 0;
if (worldWritable) {
throw new Error(`Refusing world-writable auto-sync clone root: ${root}`);
}
if (groupWritable) {
throw new Error(`Refusing group-writable auto-sync clone root: ${root}`);
}
}
function assertContainedOrSame(root: string, child: string, message: string): void {
const rel = path.relative(root, child);
if (rel.startsWith('..') || path.isAbsolute(rel)) throw new Error(message);
}
View on GitHub (pinned to 0d1aed942f)
Solutions
- chmod o-w <root> to clear the world-write bit (e.g. chmod 755)
- Run chmod -R o-w over the clone root if subdirectories inherited the permissive mode
- Avoid /tmp-style shared locations; use a dedicated directory with restrictive permissions
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at gitnexus/src/core/auto-sync/path-security.ts:276 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of abhigyanpatwari/GitNexus@0d1aed942f (2026-09-08).
Data as JSON: /api/errors/efba852c5fed4ebe.
Report an issue: GitHub.