Pull Request Opened
PR #7 opened: ADR: Per-User API Keys for Multi-Tenant SaaS Support
Summary
This PR proposes an architecture decision for implementing per-user API keys to support multi-tenant SaaS deployments.
Problem
Currently, a single API key grants access to ALL users' data. If compromised in a SaaS context, it's a total data breach.
Solution
Each user gets their own API key, scoped to only their data:
- Key generated on OAuth completion
- Returned to calling app (Laravel) for storage
- All API calls validated against user_id in path
- Compromised key = single user affected
Key Changes Proposed
- Add
api_key_hash,api_key_prefixcolumns to User model - Generate API key during OAuth callback
- New auth guard that validates key ownership
- Backward compatible with existing single API key mode
Test plan
- Review ADR for architectural soundness
- Identify any security concerns
- Validate backward compatibility approach
- Confirm implementation plan is complete
š¤ Generated with Claude Code
+1759
additions
-36
deletions
14
files changed