Bug: No CSRF protection on state-changing POST endpoints #11
Labels
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: sneak/upaas#11
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
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
All state-changing POST routes (app create/delete/deploy, env var add/delete, etc.) lack CSRF token validation. The CORS middleware allows
X-CSRF-Tokenheader but no middleware generates or validates tokens.Impact
An attacker could craft a malicious page that submits forms to the upaas instance while the victim is logged in, performing actions like deleting apps or triggering deployments.
Fix
Add
gorilla/csrfmiddleware to the protected route group. Pass CSRF token to templates via template data. Include hidden CSRF field in all forms.Location
internal/server/routes.go— protected route groupinternal/middleware/middleware.go— add CSRF middleware