ruvnet/ruflo · error · Error

File path is outside allowed directories

Error message

File path is outside allowed directories

What it means

The file resource was configured with allowedBasePaths, and the resolved real path does not fall under any of them. The read is refused as out-of-scope: whitelist the directory in allowedBasePaths or request a file inside an already-allowed one.

Source

Thrown at v3/@claude-flow/mcp/src/resource-registry.ts:515

    // Prevent access to sensitive system paths
    const blockedPaths = ['/etc/', '/proc/', '/sys/', '/dev/', '/root/', '/var/log/'];
    const lowerPath = normalizedPath.toLowerCase();
    for (const blocked of blockedPaths) {
      if (lowerPath.startsWith(blocked) || lowerPath.includes('/.')) {
        throw new Error('Access to system paths is not allowed');
      }
    }

    // If allowedBasePaths specified, validate against them
    if (options?.allowedBasePaths && options.allowedBasePaths.length > 0) {
      const resolvedPath = path.resolve(normalizedPath);
      const isAllowed = options.allowedBasePaths.some((basePath) => {
        const resolvedBase = path.resolve(basePath);
        return resolvedPath.startsWith(resolvedBase);
      });

      if (!isAllowed) {
        throw new Error('File path is outside allowed directories');
      }
    }

    const content = await fs.readFile(normalizedPath);
    return [
      {
        uri,
        mimeType: options?.mimeType || 'application/octet-stream',
        blob: content.toString('base64'),
      },
    ];
  };

  return { resource, handler };
}

View on GitHub (pinned to fa13ee4ad6)

Solutions

  1. Normalize and resolve the requested path, then verify it starts with one of the configured allowed directories before accessing it.
  2. Add the intended parent directory to the server's allowed directories configuration.
  3. Reject paths containing '..' or symlinks that escape allowed roots at the trust boundary.
Defensive patterns

Strategy: validation

When it happens

Trigger: A resource registration or read in the MCP resource registry resolves to a path outside the configured allowed directories.

Common situations: Occurs when a client requests a file:// resource with '..' segments or an absolute path that escapes the allowed roots, or when allowedDirectories is misconfigured.


AI-assisted analysis of ruvnet/ruflo@fa13ee4ad6 (2026-08-18). Data as JSON: /api/errors/41f7a41d0fbd5533. Report an issue: GitHub.