|
Download tasks/data/reverse/abdelstark__guts.8876fcf/environment/docs/MILESTONE-4.md from Lego-X/ProgramGen: direct link, hf CLI and curl.
- Browser
- Download file 6.76 kB
-
https://huggingface.co/datasets/Lego-X/ProgramGen/resolve/main/tasks/data/reverse/abdelstark__guts.8876fcf/environment/docs/MILESTONE-4.md
- Command line
-
hf download hf://datasets/Lego-X/ProgramGen/tasks/data/reverse/abdelstark__guts.8876fcf/environment/docs/MILESTONE-4.md
-
curl -L -o MILESTONE-4.md https://huggingface.co/datasets/Lego-X/ProgramGen/resolve/main/tasks/data/reverse/abdelstark__guts.8876fcf/environment/docs/MILESTONE-4.md
6.76 kB
Milestone 4: Governance & Access Control
Status: Completed Started: 2025-12-21 Completed: 2025-12-21
Overview
Milestone 4 implements governance features that enable secure, multi-user collaboration with proper access control. This includes repository permissions, organizations with teams, and a webhook system for CI/CD integration.
Goals
- Repository Permissions: Granular access control (Read, Write, Admin)
- Organizations: Multi-user repository ownership with teams
- Teams: Group users for easier permission management
- Branch Protection: Protect branches from direct pushes
- Webhooks: Event notifications for external integrations
New Crate: guts-auth
Data Models
Permission Levels
Organization
Team
Collaborator
Branch Protection
Webhook
API Endpoints
Organizations
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/orgs |
List organizations |
| POST | /api/orgs |
Create organization |
| GET | /api/orgs/{org} |
Get organization |
| PATCH | /api/orgs/{org} |
Update organization |
| DELETE | /api/orgs/{org} |
Delete organization |
| GET | /api/orgs/{org}/members |
List members |
| PUT | /api/orgs/{org}/members/{user} |
Add/update member |
| DELETE | /api/orgs/{org}/members/{user} |
Remove member |
Teams
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/orgs/{org}/teams |
List teams |
| POST | /api/orgs/{org}/teams |
Create team |
| GET | /api/orgs/{org}/teams/{team} |
Get team |
| PATCH | /api/orgs/{org}/teams/{team} |
Update team |
| DELETE | /api/orgs/{org}/teams/{team} |
Delete team |
| GET | /api/orgs/{org}/teams/{team}/members |
List team members |
| PUT | /api/orgs/{org}/teams/{team}/members/{user} |
Add member |
| DELETE | /api/orgs/{org}/teams/{team}/members/{user} |
Remove member |
| GET | /api/orgs/{org}/teams/{team}/repos |
List team repos |
| PUT | /api/orgs/{org}/teams/{team}/repos/{repo} |
Add repo to team |
| DELETE | /api/orgs/{org}/teams/{team}/repos/{repo} |
Remove repo from team |
Collaborators
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/repos/{owner}/{repo}/collaborators |
List collaborators |
| PUT | /api/repos/{owner}/{repo}/collaborators/{user} |
Add collaborator |
| DELETE | /api/repos/{owner}/{repo}/collaborators/{user} |
Remove collaborator |
| GET | /api/repos/{owner}/{repo}/collaborators/{user}/permission |
Check permission |
Branch Protection
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/repos/{owner}/{repo}/branches/{branch}/protection |
Get protection |
| PUT | /api/repos/{owner}/{repo}/branches/{branch}/protection |
Set protection |
| DELETE | /api/repos/{owner}/{repo}/branches/{branch}/protection |
Remove protection |
Webhooks
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/repos/{owner}/{repo}/hooks |
List webhooks |
| POST | /api/repos/{owner}/{repo}/hooks |
Create webhook |
| GET | /api/repos/{owner}/{repo}/hooks/{id} |
Get webhook |
| PATCH | /api/repos/{owner}/{repo}/hooks/{id} |
Update webhook |
| DELETE | /api/repos/{owner}/{repo}/hooks/{id} |
Delete webhook |
| POST | /api/repos/{owner}/{repo}/hooks/{id}/ping |
Ping webhook |
P2P Message Types
New message types for governance data replication:
CLI Commands
Phase 1: Core Types (guts-auth crate)
- Create crate structure
- Implement
Permissionenum with ordering - Implement
Organizationwith member management - Implement
Teamwith repo associations - Implement
Collaboratortype - Implement
BranchProtectionrules - Implement
Webhooktype - Create
AuthStorefor in-memory storage - Add comprehensive unit tests
Phase 2: Permission Checking
- Handle org → team → user permission inheritance
- Implement branch protection checks
- Add authorization middleware for API
Phase 3: API Integration (guts-node)
- Add
guts-authdependency - Integrate
AuthStoreintoAppState - Implement organization endpoints
- Implement team endpoints
- Implement collaborator endpoints
- Implement branch protection endpoints
- Implement webhook endpoints
- Add authorization checks to existing endpoints
- Add API integration tests
Phase 4: P2P Replication (guts-p2p)
- Add auth message types to P2P protocol
- Implement auth event broadcasting
- Implement auth sync protocol
- Handle concurrent updates
- Add P2P integration tests
Phase 5: CLI Commands (guts-cli)
- Add
orgsubcommand - Add
teamsubcommand - Add
collaboratorsubcommand - Add
protect/unprotectcommands - Add
webhooksubcommand
Phase 6: E2E Testing
- Create multi-user permission test
- Test organization workflow
- Test team permissions inheritance
- Test branch protection enforcement
- Test webhook delivery
Success Criteria
- Create and manage organizations via API
- Create teams within organizations
- Add collaborators with specific permissions
- Permission checks on all repository operations
- Branch protection rules enforced
- Webhooks fire on repository events
- P2P replication of auth data across nodes (future enhancement)
- CLI commands for governance operations (future enhancement)
- E2E test passing for permission scenarios
Dependencies
guts-types: Core types (Identity, ObjectId)guts-collaboration: PR/Issue integrationguts-p2p: P2P networking layerserde: Serializationthiserror: Error handling
Security Considerations
- Permission Escalation: Prevent users from granting higher permissions than they have
- Org Takeover: Ensure at least one owner exists
- Webhook Security: HMAC signing of payloads, secret storage
- Rate Limiting: Prevent brute-force permission enumeration
- Audit Logging: Track all permission changes
Future Considerations
These features are out of scope for Milestone 4 but should be considered:
- Fine-grained Permissions: Path-based permissions
- Permission Templates: Predefined permission sets
- Audit Trail: Complete history of permission changes
- SSO Integration: External identity providers
- API Keys: Non-user authentication for CI/CD
- 2FA Enforcement: Require 2FA for sensitive operations