- Add conditional route registration based on feature toggles - AuthEnabled now controls authentication/user management endpoints - ClusteringEnabled controls member and Merkle tree endpoints - RevisionHistoryEnabled controls history endpoints - Feature toggles for RateLimitingEnabled and TamperLoggingEnabled were already implemented This completes issue #6 allowing flexible deployment scenarios by disabling unnecessary features and their associated endpoints. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
2.0 KiB
2.0 KiB
Issue #4: Secure User and Group Management Endpoints with Authentication Middleware
Status: Open
Author: MrKalzu
Created: 2025-09-12
Assignee: ryyst
Repository: #4
Description
Security Vulnerability: User, group, and token management API endpoints are currently exposed without authentication, creating a significant security risk.
Current Problem
The following administrative endpoints are accessible without authentication:
- User management endpoints (
createUserHandler
,getUserHandler
, etc.) - Group management endpoints
- Token management endpoints
Proposed Solution
1. Define Granular Administrative Scopes
Create specific administrative scopes for fine-grained access control:
admin:users:create
- Create new usersadmin:users:read
- View user informationadmin:users:update
- Modify user dataadmin:users:delete
- Remove usersadmin:groups:create
- Create new groupsadmin:groups:read
- View group informationadmin:groups:update
- Modify group membershipadmin:groups:delete
- Remove groupsadmin:tokens:create
- Generate API tokensadmin:tokens:revoke
- Revoke API tokens
2. Apply Authentication Middleware
Wrap all administrative handlers with authMiddleware
and specific scope requirements:
// Example implementation
router.Handle("/auth/users", authMiddleware("admin:users:create")(createUserHandler))
router.Handle("/auth/users/{id}", authMiddleware("admin:users:read")(getUserHandler))
Dependencies
- Depends on Issue #3: Requires implementation of autogenerated root account for initial setup
Security Benefits
- Prevents unauthorized administrative access
- Implements principle of least privilege
- Provides audit trail for administrative operations
- Protects against privilege escalation attacks
Implementation Priority
High Priority - This addresses a critical security vulnerability that could allow unauthorized access to administrative functions.