-
Notifications
You must be signed in to change notification settings - Fork 0
feat(auth): Add multi-user RBAC with per-deployment access control #54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Implement role-based access control system with three roles: - admin: Full access to all deployments and user management - operator: Manage assigned deployments only - viewer: Read-only access to assigned deployments Key features: - SQLite auth database at .flatrun/auth.db - User management with bcrypt password hashing - API key generation with SHA-256 hashing - Per-deployment access levels (read/write/admin) - JWT tokens with user/session claims - Permission-based middleware for route protection - Backwards compatible with legacy config API keys New endpoints: - /api/users - User CRUD operations - /api/apikeys - API key management - /api/users/:id/deployments - Deployment access control Signed-off-by: nfebe <fenn25.fn@gmail.com>
Code Review SummaryThis pull request introduces a comprehensive and robust authentication and authorization system to the Flatrun agent. It replaces a basic token-based system with a full-fledged Role-Based Access Control (RBAC) and Attribute-Based Access Control (ABAC) model, including user management, dynamic API key generation with granular permissions, persistent sessions, and deployment-specific access controls. This is a critical upgrade that significantly enhances the security, manageability, and scalability of the agent's API. 🚀 Key Improvements
💡 Minor Suggestions
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review complete. See the overview comment for a summary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review complete. See the overview comment for a summary.
Add per-route permission enforcement for containers, images, volumes, databases, infrastructure, scheduler, system, dns, registries, templates, and traffic (33 new permission constants). Routes previously only required authentication. Add per-user custom permission overrides stored in the users table. Update role defaults so admins get all permissions, operators get read/write, and viewers get read-only. Filter deployment stats in /api/stats by user access and strip stats from the public /api/health endpoint to prevent leaking global deployment counts to unauthorized users. Signed-off-by: nfebe <fenn25.fn@gmail.com>
5ab64e2 to
edb65e4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review complete. No specific code suggestions were generated. See the overview comment for a summary.
Implement role-based access control system with three roles:
Key features:
New endpoints: