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:
4 files changed
+114
No files matched your search
@@ -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
|
||||
|
||||
Reference in new issue
Block a user