Sfoglia il codice sorgente

fix: drop the dead clientIp assignment in buildFormTriggerData

buildFormTriggerData set out["clientIp"], but handleWebhook only ever copies
"form" and "submittedAt" out of that result into trigger_data - it sets
clientIp itself, from req.remote_addr, for every webhook (form-triggered or
not). The assignment here was never read. Removed, with a comment explaining
why, so it does not get "fixed" back in by someone who reads it in isolation
and assumes it is load-bearing.
fszontagh 1 mese fa
parent
commit
170d1be269
1 ha cambiato i file con 4 aggiunte e 1 eliminazioni
  1. 4 1
      src/webserver/api/webhook_controller.cpp

+ 4 - 1
src/webserver/api/webhook_controller.cpp

@@ -889,7 +889,10 @@ bool WebhookController::buildFormTriggerData(const httplib::Request& req,
     out = nlohmann::json::object();
     out["form"] = form;
     out["submittedAt"] = TimeUtils::nowMs();
-    out["clientIp"] = req.remote_addr;
+    // clientIp is not set here: handleWebhook only copies "form" and
+    // "submittedAt" out of this into trigger_data, and sets clientIp itself
+    // from req.remote_addr for every webhook (form or not) - setting it here
+    // too would be a dead assignment nobody reads.
     return true;
 }