EricksonLopez.Webhooks — Visión General
EricksonLopez.Webhooks (1.0.0 en NuGet, L3, 432 descargas) ofrece entrega HTTP saliente protegida por filtros SSRF de EricksonLopez.Security.Network, reintentos Polly con Retry-After, verificación HMAC-SHA256 en tiempo constante y persistencia Redis anti-repetición y dead-letter.
- Entrega saliente protegida contra SSRF:
AddWebhooks()conectaSafeSocketsHttpHandlerFactory(EnableSsrfProtection = truepor defecto) para impedir sondeos hacia redes internas o metadatos cloud. - Verificación entrante en tiempo constante y anti-repetición:
AddWebhookReceiver()+UseWebhookReceiver()/RequireWebhookSignature()valida firmas HMAC-SHA256, tolerancia temporal y unicidad de entregas (InMemoryWebhookReplayDetectoroRedisWebhookReplayDetector). - Resiliencia
Retry-After(429/503) y DLQ: Respeta cabecerasRetry-After(hasta 5 minutos) y deriva payloads agotados aIWebhookDeadLetterSink(NoOpWebhookDeadLetterSinkoRedisWebhookDeadLetterSink).
Renderizando diagrama…
flowchart LR Out["IWebhookSender"] --> Sign["WebhookSigner (HMAC-SHA256)"] Sign --> SSRF["SafeSocketsHttpHandlerFactory + Retry-After"] SSRF --> DLQ["IWebhookDeadLetterSink (on exhaustion)"] InReq["Incoming POST"] --> Val["IWebhookValidator + IWebhookReplayDetector"]
Ver descripción textual y tabla accesible
IWebhookSender firma payloads y entrega mediante SafeSocketsHttpHandlerFactory con Retry-After, mientras el middleware ASP.NET Core entrante valida firmas y consulta IWebhookReplayDetector.
flowchart LR
Out["IWebhookSender"] --> Sign["WebhookSigner (HMAC-SHA256)"]
Sign --> SSRF["SafeSocketsHttpHandlerFactory + Retry-After"]
SSRF --> DLQ["IWebhookDeadLetterSink (on exhaustion)"]
InReq["Incoming POST"] --> Val["IWebhookValidator + IWebhookReplayDetector"]Paquetes y Estado Native AOT (3 / 4 Publicados)
Sección titulada «Paquetes y Estado Native AOT (3 / 4 Publicados)»3 de 4 paquetes están publicados en 1.0.0 en NuGet (net8.0;net9.0;net10.0; localVersion: 2.1.0 en disco), mientras EricksonLopez.Webhooks.PaymentGateways permanece sin publicar (2.1.0 solo local). Estado AOT global Full (4 / 4 IsAotCompatible=true, EnableTrimAnalyzer=true):
EricksonLopez.Webhooks(168dl,1.0.0, AOTFull):AddWebhooks,IWebhookSender,WebhookSigner,WebhookSecret,WebhookSenderOptions.EricksonLopez.Webhooks.AspNetCore(133dl,1.0.0, AOTFull):AddWebhookReceiver,AddInMemoryReplayDetector,UseWebhookReceiver,RequireWebhookSignature.EricksonLopez.Webhooks.Redis(131dl,1.0.0, AOTFull):AddRedisWebhookReplayDetector,AddRedisWebhookDeadLetterSink.EricksonLopez.Webhooks.PaymentGateways(Sin publicar, local2.1.0, AOTFull):AddPaymentGatewayWebhookSchemes().
Medidos desde benchmarks.json (5 / 5 filas medidas del BenchmarkDotNet.Artifacts raíz bajo BenchmarkDotNet v0.14.0, .NET 10.0.11 X64 RyuJIT AVX-512F+CD+BW+DQ+VL+VBMI, Job=Dry / ColdStart (IterationCount=1, WarmupCount=1) — sin reportes NativeAOT):
WebhookSignerBenchmarks.ComputeSignature_SmallPayload: 281,300 ns (281.3 μs) / 0 BWebhookSignerBenchmarks.ComputeSignature_MediumPayload: 290,100 ns (290.1 μs) / 0 BWebhookSignerBenchmarks.VerifySignature_ConstantTime: 754,700 ns (754.7 μs) / 0 BDeadLetterSinkBenchmarks.DeadLetterSink_EnqueueAsync: 2,862,000 ns (2.862 ms) / 0 BWebhookSenderBenchmarks.WebhookSender_SendAsync_Success: 171,800,000 ns (171.8 ms) / 15,749 B (15.38 KB)
(Una ejecución DefaultJob separada en benchmarks/EricksonLopez.Webhooks.Benchmarks/ reporta 288.3 ns en ComputeSignature_SmallPayload, 1,406.8 ns en MediumPayload y 479.7 ns / 360 B en VerifySignature_ConstantTime.)