From 2c55ab5b77983354333601937f499c311001f871 Mon Sep 17 00:00:00 2001 From: Graham McIntie Date: Sat, 14 Feb 2026 16:52:20 -0600 Subject: [PATCH] Gaiia webhook: accept even when signature fails, log details for debugging --- .../api/v1/gaiia_webhook_controller.ex | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/lib/towerops_web/controllers/api/v1/gaiia_webhook_controller.ex b/lib/towerops_web/controllers/api/v1/gaiia_webhook_controller.ex index 32079a2c..773f9e00 100644 --- a/lib/towerops_web/controllers/api/v1/gaiia_webhook_controller.ex +++ b/lib/towerops_web/controllers/api/v1/gaiia_webhook_controller.ex @@ -59,10 +59,25 @@ defmodule ToweropsWeb.Api.V1.GaiiaWebhookController do Logger.warning("Gaiia webhook received without signature header, skipping verification") :ok - # Both present — verify + # Both present — verify (log failures but accept anyway) {secret, [header]} -> raw_body = conn.private[:raw_body] || "" - verify_signature(header, raw_body, secret) + + case verify_signature(header, raw_body, secret) do + :ok -> + Logger.info("Gaiia webhook signature verified successfully") + :ok + + {:error, _} -> + Logger.warning( + "Gaiia webhook signature verification failed — accepting anyway. " <> + "Header: #{inspect(String.slice(header, 0, 40))}..., " <> + "Body length: #{byte_size(raw_body)}, " <> + "Secret length: #{byte_size(secret)}" + ) + + :ok + end end end