Security Model
This document describes spuff's security architecture, threat model, and security considerations.
Overview
Spuff handles sensitive data including:
Cloud provider API tokens
SSH private keys (by reference)
Agent authentication tokens
User data in cloud-init
The security model is designed around:
Minimal exposure: Only expose what's necessary
Short-lived access: Ephemeral VMs limit attack window
No secret storage on VMs: Keys stay local via SSH forwarding
Defense in depth: Multiple security layers
Architecture Security
Threat Model
Assets to Protect
Cloud API token
User's machine
Env var, never stored in files
SSH private key
User's machine
Filesystem permissions, ssh-agent
Agent token
VM env var
Per-session generation
User code
VM
Ephemeral, user responsibility
Threat Actors
External attackers: Internet-based attacks
Compromised VM: Malicious code on VM
Man-in-the-middle: Network interception
Insider threat: Shared machine access
Attack Scenarios
Scenario 1: VM Compromise
Threat: Attacker gains root on VM
Impact without mitigations:
Could use SSH agent to sign requests (while user connected)
Could read any data on VM
Could attack other systems from VM
Mitigations:
SSH agent forwarding is session-scoped
No persistent credentials on VM
Ephemeral nature limits exposure window
Agent binds to localhost only
Scenario 2: API Token Theft
Threat: Attacker obtains cloud API token
Impact:
Could create/destroy instances
Could access other resources in account
Cost impact from resource creation
Mitigations:
Token stored in env var, not file
Recommended: Use scoped tokens where possible
Regular token rotation
Scenario 3: Network Interception
Threat: MITM attack on communications
Impact without mitigations:
Could intercept API calls
Could hijack SSH sessions
Mitigations:
Provider API uses TLS
SSH provides end-to-end encryption
Host key verification (accept-new policy)
Security Controls
Authentication
Cloud Provider API
Token stored in environment variable
Never written to config files
Transmitted over TLS only
SSH Access
Ed25519 or RSA key pairs
No password authentication
Key-based auth only
Agent forwarding for git operations
Agent API
Token generated per VM creation
Passed via systemd environment
Required for all authenticated endpoints
Agent binds to 127.0.0.1 only
Network Security
Exposed Ports
22
SSH
Public
Key auth only
7575
Agent
Localhost
Token auth required
Firewall Recommendations
Only allow SSH from known IPs if possible
No other inbound ports required
Outbound: Allow HTTPS for package updates
VM Hardening
Cloud-init applies these hardening measures:
Data Protection
At Rest
Config
~/.spuff/config.yaml
0600 permissions
State
~/.spuff/state.db
Standard file perms
SSH keys
~/.ssh/
0600 permissions
In Transit
Provider API
TLS 1.2+
SSH
SSH protocol encryption
Cloud-init
Base64 (not encryption)
Secrets Management
Do's
Store API tokens in environment variables
Use ssh-agent for key management
Rotate tokens regularly
Use scoped tokens when possible
Don'ts
Never commit tokens to git
Never store tokens in config files
Never copy private keys to VMs
Never disable SSH key verification
Security Considerations
SSH Agent Forwarding Risks
Risk: A root process on the VM can use the forwarded agent while you're connected.
Mitigations:
Keep SSH sessions short
Use
ssh-add -cfor confirmation promptsConsider separate keys for development
VM is ephemeral, limiting exposure window
Recommendation for sensitive operations:
Cloud-Init Secrets
Issue: User data is accessible on VM via metadata service.
Mitigations:
Agent token is the only secret in cloud-init
Token only valid for that VM's agent
Agent binds to localhost
Ephemeral Security Benefits
The ephemeral nature provides security benefits:
Limited persistence: Compromises don't persist
Fresh state: Each VM starts clean
Short window: Less time for attacks
Easy recovery: Just create new VM
Compliance Considerations
For Sensitive Workloads
If using spuff for sensitive work:
Network isolation: Use Tailscale or VPN
Audit logging: Enable provider audit logs
Access control: Limit who has API tokens
Data handling: Don't store sensitive data on VM
Data Residency
Choose regions based on data residency requirements
Be aware that cloud-init data is stored by providers
Incident Response
If API Token Compromised
Revoke token immediately in provider dashboard
Check for unauthorized resources
Generate new token
Audit recent activity
If VM Compromised
Destroy VM:
spuff down --forceRevoke any tokens that were on VM
Check for unusual account activity
Create new VM with fresh token
If SSH Key Compromised
Remove public key from provider
Remove from all VMs
Generate new key pair
Update configuration
Security Checklist
Initial Setup
Ongoing
For Teams
Reporting Vulnerabilities
If you discover a security vulnerability:
Do not create a public issue
Email: [email protected]
Include:
Description of vulnerability
Steps to reproduce
Potential impact
Allow 48 hours for initial response
See SECURITY.md for full policy.
References
Last updated
Was this helpful?