Security Model
Gambiarra is designed as a local-first, trusted network system. The security model makes specific assumptions about the deployment environment and trust relationships.Core Assumptions
- Network Trust: All machines on the network are trusted
- Participant Trust: All participants are authorized to access shared models
- Local Deployment: Hub and participants run on a private network (home, office, VPN)
- No Built-in Auth: The hub does not enforce authentication by default
- Plain HTTP: Communication uses unencrypted HTTP by default
Threat Model
In-Scope Threats
These are threats Gambiarra is designed to help mitigate:| Threat | Mitigation |
|---|---|
| Room squatting | 6-character random codes (36^6 = 2B+ combinations) |
| Password sniffing | Passwords are hashed with argon2id before storage |
| Replay attacks | Room codes are single-use per session |
Out-of-Scope Threats
| Threat | Why Out of Scope |
|---|---|
| Network eavesdropping | No TLS/encryption by default |
| Unauthorized network access | No authentication on hub endpoints |
| Man-in-the-middle attacks | Plain HTTP communication |
| DoS/resource exhaustion | No rate limiting or quotas |
| Malicious participants | Assumes all participants are trusted |
| Data exfiltration | Participants have direct access to all models |
Password Protection
Gambiarra supports optional password protection for rooms.How It Works
Creating a password-protected room:Password Security
Passwords are hashed using argon2id (Bun’s native password API) before storage. The hash is never exposed in API responses.
- Hashing:
Bun.password.hash()with argon2id - Verification:
Bun.password.verify()for constant-time comparison - Storage: Hash stored in
RoomInfo.passwordHash(seepackages/core/src/room.ts:8-18) - API:
passwordHashfield stripped from public responses (seepackages/core/src/hub.ts:56-58)
Password Limitations
Passwords only prevent:- Unauthorized room joining
- Casual access by other network users
- Network sniffing
- MITM attacks
- Traffic analysis
Production Deployment
Recommended Architecture
For production or internet-exposed deployments, use this layered security approach:Reverse Proxy Configuration
Caddy
Caddy provides automatic HTTPS with Let’s Encrypt:Nginx
Nginx with manual certificate management:When using a reverse proxy, ensure SSE (Server-Sent Events) connections are properly configured with
proxy_buffering off to avoid breaking real-time updates.VPN/Tunnel Access
For remote access without exposing the hub to the internet:WireGuard
http://10.0.0.1:3000 directly.
Tailscale
Tailscale provides zero-config mesh VPN:Network Isolation
Docker Network
Isolate Gambiarra in a Docker network:Firewall Rules
Restrict access to the hub port:Best Practices
For Development/Testing
- Use password-protected rooms
- Run on localhost or trusted network only
- Don’t expose hub port to the internet
- Use short-lived rooms (recreate frequently)
For Production
- Always use a reverse proxy with TLS
- Implement authentication at the proxy level
- Use VPN for remote access
- Enable rate limiting to prevent abuse
- Monitor access logs for suspicious activity
- Rotate room codes regularly
- Use strong passwords for room protection
- Isolate network from other services
For Teams
- Establish clear usage policies
- Document who has access
- Use descriptive participant nicknames
- Set up monitoring/alerting
- Regular security audits
- Incident response plan
Data Privacy
What Data is Shared
When joining a room, participants share:- Participant ID: Random UUID
- Nickname: User-provided or auto-generated
- Model name: LLM model identifier
- Endpoint URL: Where the LLM is hosted
- Machine specs: CPU, RAM, GPU (optional with
--no-specs) - Last seen timestamp: For health monitoring
What Data is NOT Shared
- Prompts/completions: Not logged by the hub
- API keys: Not required or stored
- User credentials: No user accounts
- Model weights: Never transmitted
The hub acts as a transparent proxy for chat completions. Prompt and completion data passes through the hub but is not logged or persisted.
Hiding Machine Specs
Use--no-specs to prevent sharing hardware information:
Compliance Considerations
GDPR
- No personal data is collected by default
- Participant nicknames should not contain PII
- Machine specs are optional
- No data persistence in memory-only mode
Corporate Policies
Before deploying in a corporate environment:- Review data loss prevention (DLP) policies
- Check if LLM usage requires approval
- Verify network security requirements
- Ensure compliance with IT security standards
- Document architecture and data flows
Incident Response
Compromised Room Code
If a room code is leaked:- All participants leave the room
- Create a new room with a fresh code
- Use a password for the new room
- Notify all authorized participants
Unauthorized Access
If unauthorized access is detected:- Check hub access logs
- Identify the source IP/participant
- Reset room codes
- Review firewall rules
- Consider implementing authentication
Suspicious Traffic
If unusual activity is observed:- Monitor SSE events for anomalies
- Check participant health status
- Review model routing patterns
- Analyze request frequencies
- Consider rate limiting
Security Roadmap
Planned security enhancements (see README.md:540-549):- Built-in authentication & authorization
- Participant quotas and rate limiting
- Request queueing for busy participants
- End-to-end encryption option
- Audit logging
- Role-based access control (RBAC)
Reporting Security Issues
If you discover a security vulnerability:- Do not open a public GitHub issue
- Email the maintainers directly
- Provide detailed reproduction steps
- Allow time for a patch before disclosure