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

+9
View File
@@ -35,6 +35,9 @@ func (s *Server) handleMappingsList(w http.ResponseWriter, r *http.Request) {
}
func (s *Server) handleMappingCreate(w http.ResponseWriter, r *http.Request) {
if !s.authorizeTaskMutation(w, r) {
return
}
if s.Mappings == nil {
http.Error(w, "mappings not configured", http.StatusServiceUnavailable)
return
@@ -89,6 +92,9 @@ func (s *Server) handleMappingGet(w http.ResponseWriter, r *http.Request) {
}
func (s *Server) handleMappingUpdate(w http.ResponseWriter, r *http.Request) {
if !s.authorizeTaskMutation(w, r) {
return
}
if s.Mappings == nil {
http.Error(w, "mappings not configured", http.StatusServiceUnavailable)
return
@@ -127,6 +133,9 @@ func (s *Server) handleMappingUpdate(w http.ResponseWriter, r *http.Request) {
}
func (s *Server) handleMappingDelete(w http.ResponseWriter, r *http.Request) {
if !s.authorizeTaskMutation(w, r) {
return
}
if s.Mappings == nil {
http.Error(w, "mappings not configured", http.StatusServiceUnavailable)
return