Gaiia webhook: accept even when signature fails, log details for debugging
This commit is contained in:
parent
f395c8cea1
commit
2c55ab5b77
1 changed files with 17 additions and 2 deletions
|
|
@ -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
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue