This commit is contained in:
hashbro
2026-08-26 03:14:15 +08:00
parent 5c9ceca4ea
commit 5cb5744b7a
10 changed files with 227 additions and 45 deletions
@@ -21,16 +21,29 @@ class TokenviewWebhookController extends Controller
$payload = is_array($decoded) ? $decoded : [];
}
Log::info('tokenview webhook received', [
'ip' => $request->ip(),
'method' => $request->method(),
'has_signature' => is_string($signature) && $signature !== '',
'body_bytes' => strlen($raw),
'payload' => $payload !== [] ? $payload : $raw,
]);
// Tokenview probes the webhook (often unsigned GET/POST) before a
// sign key exists. Always 200 + non-empty body; only skip ingest.
$signed = $monitor->verifySignature($raw, $signature);
if (! $signed) {
Log::warning('tokenview webhook bad signature (acked 200, skipped ingest)');
Log::warning('tokenview webhook bad signature (acked 200, skipped ingest)', [
'ip' => $request->ip(),
'body_bytes' => strlen($raw),
]);
} elseif ($payload !== []) {
try {
$monitor->handleWebhook($payload);
} catch (\Throwable $e) {
Log::warning('tokenview webhook handle failed: '.$e->getMessage());
Log::warning('tokenview webhook handle failed: '.$e->getMessage(), [
'exception' => $e::class,
]);
}
}