Merge branch 'main' into security/csrf-ssrf-ratelimit
All checks were successful
check / check (push) Successful in 1m59s

This commit is contained in:
2026-03-17 12:32:30 +01:00
6 changed files with 465 additions and 6 deletions

View File

@@ -520,14 +520,14 @@ func (h *Handlers) HandleTargetCreate() http.HandlerFunc {
// Validate target type
switch targetType {
case database.TargetTypeHTTP, database.TargetTypeDatabase, database.TargetTypeLog:
case database.TargetTypeHTTP, database.TargetTypeDatabase, database.TargetTypeLog, database.TargetTypeSlack:
// valid
default:
http.Error(w, "Invalid target type", http.StatusBadRequest)
return
}
// Build config JSON for HTTP targets
// Build config JSON based on target type
var configJSON string
if targetType == database.TargetTypeHTTP {
if url == "" {
@@ -554,6 +554,20 @@ func (h *Handlers) HandleTargetCreate() http.HandlerFunc {
return
}
configJSON = string(configBytes)
} else if targetType == database.TargetTypeSlack {
if url == "" {
http.Error(w, "Webhook URL is required for Slack targets", http.StatusBadRequest)
return
}
cfg := map[string]interface{}{
"webhook_url": url,
}
configBytes, err := json.Marshal(cfg)
if err != nil {
http.Error(w, "Internal server error", http.StatusInternalServerError)
return
}
configJSON = string(configBytes)
}
maxRetries := 0 // default: fire-and-forget (no retries)