feat(repo): enforce dot-prefixed repos as always-private system repos #77

Merged
jmiller merged 1 commits from feature/system-repo-private into main 2026-05-13 00:16:13 +00:00
Owner

Summary

  • Repositories with names starting with . are now treated as system repositories that are always private and cannot be made public
  • On creation paths (API, web, migrate, template, push-to-create), privacy is silently forced
  • On edit paths (API edit, web settings, public access settings), a clear error is returned
  • UI disables the "Make Public" button for system repos by setting ForcePrivate in template context

Files Changed (10)

Layer File Behavior
Model models/repo/repo.go IsSystemRepo() � name starts with .
Service services/repository/repository.go MakeRepoPrivate() guard � hard error
API Create routers/api/v1/repo/repo.go Silent force private
API Edit routers/api/v1/repo/repo.go 403 Forbidden
API Migrate routers/api/v1/repo/migrate.go Silent force private
Web Create routers/web/repo/repo.go Silent force private
Web Migrate routers/web/repo/migrate.go Silent force private
Web Settings routers/web/repo/setting/setting.go UI disabled + hard error
Public Access routers/web/repo/setting/public_access.go UI disabled + redirect
Push Hook routers/private/hook_post_receive.go Silent ignore + log warning
Locale options/locale/locale_en-US.json Error message string

Test plan

  • Create a repo named .test-system via API � verify it is created as private
  • Create a repo named .test-system-web via web UI � verify it is created as private
  • Try to edit .test-system visibility to public via API � verify 403 response
  • Try to change visibility to public via web settings � verify error message
  • Verify normal (non-dot) repos are unaffected

?? Generated with Claude Code

## Summary - Repositories with names starting with `.` are now treated as **system repositories** that are always private and cannot be made public - On creation paths (API, web, migrate, template, push-to-create), privacy is silently forced - On edit paths (API edit, web settings, public access settings), a clear error is returned - UI disables the "Make Public" button for system repos by setting `ForcePrivate` in template context ## Files Changed (10) | Layer | File | Behavior | |---|---|---| | Model | `models/repo/repo.go` | `IsSystemRepo()` � name starts with `.` | | Service | `services/repository/repository.go` | `MakeRepoPrivate()` guard � hard error | | API Create | `routers/api/v1/repo/repo.go` | Silent force private | | API Edit | `routers/api/v1/repo/repo.go` | 403 Forbidden | | API Migrate | `routers/api/v1/repo/migrate.go` | Silent force private | | Web Create | `routers/web/repo/repo.go` | Silent force private | | Web Migrate | `routers/web/repo/migrate.go` | Silent force private | | Web Settings | `routers/web/repo/setting/setting.go` | UI disabled + hard error | | Public Access | `routers/web/repo/setting/public_access.go` | UI disabled + redirect | | Push Hook | `routers/private/hook_post_receive.go` | Silent ignore + log warning | | Locale | `options/locale/locale_en-US.json` | Error message string | ## Test plan - [ ] Create a repo named `.test-system` via API � verify it is created as private - [ ] Create a repo named `.test-system-web` via web UI � verify it is created as private - [ ] Try to edit `.test-system` visibility to public via API � verify 403 response - [ ] Try to change visibility to public via web settings � verify error message - [ ] Verify normal (non-dot) repos are unaffected ?? Generated with [Claude Code](https://claude.com/claude-code)
jmiller added 1 commit 2026-05-13 00:15:52 +00:00
feat(repo): enforce dot-prefixed repos as always-private system repos
compliance / files-changed (pull_request) Successful in 2m48s
pr-title / lint-pr-title (pull_request) Successful in 5s
db-tests / files-changed (pull_request) Successful in 2m53s
docker-dryrun / files-changed (pull_request) Successful in 3m7s
e2e-tests / files-changed (pull_request) Successful in 3m8s
compliance / lint-on-demand (pull_request) Successful in 1m23s
compliance / lint-backend (pull_request) Failing after 4m50s
compliance / frontend (pull_request) Has been skipped
compliance / checks-backend (pull_request) Failing after 5m20s
compliance / backend (pull_request) Failing after 4m15s
db-tests / test-pgsql (pull_request) Failing after 4m7s
db-tests / test-sqlite (pull_request) Failing after 4m29s
db-tests / test-unit (pull_request) Failing after 5m53s
db-tests / test-mysql (pull_request) Failing after 5m21s
docker-dryrun / container-amd64 (pull_request) Has been skipped
docker-dryrun / container-arm64 (pull_request) Has been skipped
docker-dryrun / container-riscv64 (pull_request) Has been skipped
db-tests / test-mssql (pull_request) Failing after 6m30s
e2e-tests / test-e2e (pull_request) Failing after 4m53s
compliance / lint-go-gogit (pull_request) Failing after 33m59s
compliance / lint-go-windows (pull_request) Failing after 33m59s
c5eb8df8a2
Repositories with names starting with "." are now treated as system
repositories that are always private and cannot be made public. This is
enforced at every code path: API create, web create, migrate, template
create, push-to-create, API edit, web settings, and public access
settings. On creation paths, privacy is silently forced. On edit paths,
a clear error is returned.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
jmiller merged commit ef6a7dcfcf into main 2026-05-13 00:16:13 +00:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: MokoConsulting/MokoGitea#77