fix(webui): enforce CSRF/origin gate on binding and mapping mutations

handleTaskAction, the config and workflow write handlers all call
authorizeTaskMutation before mutating, but the binding and mapping
create/update/delete/approve handlers never did, leaving those dashboard
endpoints reachable by a cross-origin request with no CSRF header -
contradicting dynamic-curators.md's documented mutation contract.
This commit is contained in:
sam committed 2026-09-15 04:35:04 +10:00
1 parent 13ef3bd8ad
commit e3dddffd3e
4 files changed
+114

No files matched your search

+12
View File
@@ -43,6 +43,9 @@ func (s *Server) handleBindingsList(w http.ResponseWriter, r *http.Request) {
}
func (s *Server) handleBindingCreate(w http.ResponseWriter, r *http.Request) {
if !s.authorizeTaskMutation(w, r) {
return
}
if s.Bindings == nil {
http.Error(w, "bindings not configured", http.StatusServiceUnavailable)
return
@@ -116,6 +119,9 @@ func (s *Server) handleBindingGet(w http.ResponseWriter, r *http.Request) {
}
func (s *Server) handleBindingUpdate(w http.ResponseWriter, r *http.Request) {
if !s.authorizeTaskMutation(w, r) {
return
}
if s.Bindings == nil {
http.Error(w, "bindings not configured", http.StatusServiceUnavailable)
return
@@ -171,6 +177,9 @@ func (s *Server) handleBindingUpdate(w http.ResponseWriter, r *http.Request) {
}
func (s *Server) handleBindingDelete(w http.ResponseWriter, r *http.Request) {
if !s.authorizeTaskMutation(w, r) {
return
}
if s.Bindings == nil {
http.Error(w, "bindings not configured", http.StatusServiceUnavailable)
return
@@ -193,6 +202,9 @@ func (s *Server) handleBindingDelete(w http.ResponseWriter, r *http.Request) {
}
func (s *Server) handleBindingApprove(w http.ResponseWriter, r *http.Request) {
if !s.authorizeTaskMutation(w, r) {
return
}
if s.Bindings == nil {
http.Error(w, "bindings not configured", http.StatusServiceUnavailable)
return