mirror of
https://github.com/aaronsb/obsidian-mcp-plugin.git
synced 2026-07-22 16:40:32 +00:00
- Add CONTRIBUTING.md with development guidelines
- Add SECURITY.md with vulnerability reporting policy
- Create GitHub issue templates for bugs and features
- Add PR template with checklist
- Set up GitHub Actions for testing and security scanning
- Document all security findings from code audit
- Create detailed GitHub issues for all vulnerabilities
- Update CHANGELOG with security audit results
- Add project structure documentation
This establishes proper open-source project structure and documents
all critical security issues that need to be addressed.
🤖 Generated with Claude Code
Co-Authored-By: Claude <noreply@anthropic.com>
2.7 KiB
2.7 KiB
🔴 CRITICAL: No Authentication or Authorization on MCP Server
Summary
The MCP server exposes full vault access over HTTP without any authentication mechanism, allowing any local application to read, write, and delete files in the Obsidian vault.
Current Behavior
- Server runs on
http://localhost:3001with no API key validation - CORS configured to allow ALL origins (
origin: '*') - No user authentication or role-based access control
- Any local process can manipulate the entire vault
Security Impact
- Severity: CRITICAL
- Attack Vector: Local network access
- Impact: Complete vault compromise, data loss, unauthorized access
Vulnerable Code
// mcp-server.ts:248-253
this.app.use(cors({
origin: '*', // Allows any origin!
methods: ['GET', 'POST', 'PUT', 'DELETE', 'OPTIONS'],
allowedHeaders: ['Origin', 'X-Requested-With', 'Content-Type', 'Accept', 'Authorization', 'Mcp-Session-Id'],
exposedHeaders: ['Mcp-Session-Id']
}));
Reproduction Steps
- Install and enable the plugin
- From any local application, run:
curl -X POST http://localhost:3001/mcp \ -H "Content-Type: application/json" \ -d '{"method": "tools/vault", "params": {"action": "list"}}' - Observe full vault file listing returned without authentication
Proposed Solution
Phase 1: Basic API Key Authentication
interface AuthConfig {
apiKey: string;
allowedOrigins: string[];
requireHttps: boolean;
}
class AuthMiddleware {
private config: AuthConfig;
authenticate(req: Request, res: Response, next: NextFunction) {
const apiKey = req.headers['x-api-key'];
if (!apiKey || apiKey !== this.config.apiKey) {
return res.status(401).json({ error: 'Unauthorized' });
}
next();
}
}
Phase 2: Token-Based Authentication
- Generate secure session tokens
- Implement token refresh mechanism
- Add rate limiting per token
Phase 3: Role-Based Access Control
- Read-only vs read-write permissions
- Path-based restrictions
- Operation whitelisting
Mitigation Steps (Immediate)
- Restrict CORS to specific origins
- Add API key requirement
- Implement rate limiting
- Add authentication logging
References
Acceptance Criteria
- API key authentication implemented
- CORS restricted to configurable origins
- Authentication failures logged
- Settings UI for managing API keys
- Documentation updated with security setup
Labels
security critical authentication breaking-change