managarten/apps-archived/uload/docs/SECURITY_BEST_PRACTICES.md
Till-JS ee42b6cc76 feat: major update with network graphs, themes, todo extensions, and more
## New Features

### Network Graph Visualization (Contacts, Calendar, Todo)
- D3.js force simulation for physics-based layout
- Zoom & pan with mouse/touchpad
- Keyboard shortcuts: +/- zoom, 0 reset, Esc deselect, / search, F focus
- Filtering by tags, company/location/project, connection strength
- Shared components in @manacore/shared-ui

### Central Tags API (mana-core-auth)
- CRUD endpoints for tags
- Schema: tags table with userId, name, color, app
- Shared tag components in @manacore/shared-ui

### Custom Themes System
- Theme editor with live preview and color picker
- Community theme gallery
- Theme sharing (public, unlisted, private)
- Backend API in mana-core-auth

### Todo App Extensions
- Glass-pill design for task input and items
- Settings page with 20+ preferences
- Task edit modal with inline editing
- Statistics page with visualizations
- PWA support with offline capabilities
- Multiple kanban boards

### Contacts App Features
- Duplicate detection
- Photo upload
- Batch operations
- Enhanced favorites page with multiple view modes
- Alphabet view improvements
- Search modal

### Help System
- @manacore/shared-help-content
- @manacore/shared-help-ui
- @manacore/shared-help-types

### Other Features
- Themes page for all apps
- Referral system frontend
- CommandBar (global search)
- Skeleton loaders
- Settings page improvements

## Bug Fixes
- Network graph simulation initialization
- Database schema TEXT for user_id columns (Better Auth compatibility)
- Various styling fixes

## Documentation
- Daily report for 2025-12-10
- CI/CD deployment guide

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-10 02:37:46 +01:00

3.1 KiB

🔐 Security Best Practices für uLoad Deployment

Aktuelle Risiken

1. Öffentliches Admin Panel 🚨

  • Problem: PocketBase Admin unter /api/_/ ist für jeden erreichbar
  • Risiko: Brute-Force, unauthorisierter Zugriff
  • Lösung: Zugriff beschränken (siehe unten)

2. Keine Rate Limiting ⚠️

  • Problem: API kann überlastet werden
  • Risiko: DDoS, Ressourcen-Erschöpfung
  • Lösung: Nginx rate limiting implementieren

Empfohlene Architektur

Option 1: SSH Tunnel für Admin (SICHERSTE)

# Admin Panel NUR über SSH erreichbar machen
# Keine öffentliche Route für /_/ einrichten!

# Zugriff über SSH Tunnel:
ssh -L 8090:localhost:8090 user@ulo.ad
# Dann lokal: http://localhost:8090/_/

Vorteile:

  • Admin Panel nie öffentlich
  • Maximale Sicherheit
  • Keine Angriffsfläche

Option 2: VPN/Wireguard 🔒

# Nur im privaten Netzwerk erreichbar
# Admin Panel hinter VPN
# Öffentliche API für App

Option 3: Basic Auth + IP-Whitelist 🛡️

location /api/_/ {
    # Nur deine IP
    allow 91.99.221.179;
    deny all;

    # Plus Basic Auth
    auth_basic "Admin";
    auth_basic_user_file /etc/nginx/.htpasswd;

    proxy_pass http://127.0.0.1:8090/_/;
}

Empfohlene Konfiguration

Für Produktion:

// 1. Separate URLs für Frontend und Admin
const config = {
	// App nutzt API
	app: 'https://ulo.ad',
	api: 'https://ulo.ad/api/collections/',

	// Admin NUR über SSH oder separaten Port
	admin: 'Nicht öffentlich!',
};

2. Environment Variables

# .env.production
PUBLIC_POCKETBASE_URL=https://ulo.ad/api
POCKETBASE_ADMIN_URL=http://localhost:8090  # Nur intern!

3. Firewall Rules (in Coolify/Hetzner)

# Nur benötigte Ports öffnen
ufw allow 80/tcp   # HTTP (redirect zu HTTPS)
ufw allow 443/tcp  # HTTPS
ufw allow 22/tcp   # SSH

# PocketBase Port NICHT öffnen!
# ufw allow 8090  # NEIN!

Monitoring & Alerts

1. Fail2Ban einrichten

# Für wiederholte fehlgeschlagene Logins
apt install fail2ban

2. Logs überwachen

# In Coolify Alerts einrichten für:
- Fehlgeschlagene Admin-Logins
- Ungewöhnlich viele API-Anfragen
- 404 auf /_/ Route

Beste Praxis für dein Setup

🎯 EMPFEHLUNG:

  1. KEIN öffentliches Admin Panel
  2. API nur für benötigte Endpoints
  3. Admin-Zugriff nur über SSH

Sichere nginx.conf:

# NUR diese Routes öffentlich:
location /api/collections/ { ... }  # App-Funktionalität
location /api/health { ... }         # Health Check

# Admin NICHT öffentlich
# Zugriff nur über SSH Tunnel

Admin-Zugriff:

# Wenn du ins Admin Panel musst:
ssh user@ulo.ad
cd /app
./pocketbase admin

# Oder SSH Tunnel:
ssh -L 8090:localhost:8090 user@ulo.ad
# Browser: http://localhost:8090/_/

Zusammenfassung

Aktuelles Setup ist NICHT sicher, weil:

  • Admin Panel öffentlich
  • Keine Zugriffsbeschränkung
  • Keine Rate Limits

Bessere Lösung:

  • Admin nur über SSH
  • API mit Rate Limiting
  • Monitoring aktivieren

Möchtest du die sichere Variante implementieren?