fix: disable API v1 write methods (closes #112) #115
Reference in New Issue
Block a user
Delete Branch "fix/disable-api-write-methods"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Remove API v1 write methods (POST /apps, DELETE /apps/{id}, POST /apps/{id}/deploy) that used cookie-based session auth without CSRF protection.
Read-only endpoints, login, and whoami are retained.
Closes #112
make check output
Remove POST /apps, DELETE /apps/{id}, and POST /apps/{id}/deploy from the API v1 route group. These endpoints used cookie-based session auth without CSRF protection, creating a CSRF vulnerability. Read-only endpoints (GET /apps, GET /apps/{id}, GET /apps/{id}/deployments), login, and whoami are retained. Removed handlers: HandleAPICreateApp, HandleAPIDeleteApp, HandleAPITriggerDeploy, along with apiCreateRequest struct and validateCreateRequest function. Updated tests to use service layer directly for app creation in remaining read-only endpoint tests.Code Review: PR #115 — Disable API v1 Write Methods
Result: ✅ LGTM — Ready for merge
Checklist
POST /apps,DELETE /apps/{id},POST /apps/{id}/deployHandleAPICreateApp,HandleAPIDeleteApp,HandleAPITriggerDeploy,validateCreateRequest,apiCreateRequestinternal/server/routes.gocontext,appservice in api.go)apiRequesthelper narrowed toapiGet— clean simplificationmake checkpasses cleanly (all tests pass, build succeeds, lint clean)Clean, focused removal of CSRF-vulnerable write endpoints. No regressions.