feat(webhook): frescor opcional (anti-replay) em verify_webhook_signature - #1
Merged
Merged
Conversation
…y_webhook_signature Novo parâmetro opcional `tolerance_seconds`: após validar o HMAC, rejeita entregas cujo `sentAt` (no corpo assinado) esteja fora da janela. Aditivo e retrocompatível (sem o param, comportamento idêntico). Pareado com o backend, que agora assina `id` + `sentAt`; deduplique por `id` para idempotência. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Contexto
Parte da remediação do webhook de saída (achado F13 da auditoria da API). A assinatura HMAC prova autenticidade, não frescor — uma entrega assinada capturada poderia ser reenviada (replay). O backend agora assina
id(UUID) +sentAtno corpo; este PR dá ao SDK a primitiva para o receptor rejeitar entregas obsoletas.Novo parâmetro opcional
tolerance_seconds: valida a assinatura e, se informado, exige quesentAtesteja dentro da janela.Retrocompatível: sem o parâmetro/tolerância, o comportamento é idêntico. A computação do HMAC não mudou → golden vector permanece válido. Deduplicar por
id(no corpo) continua a cargo do receptor.Follow-up
Parte de um conjunto de PRs paralelos (Node/Python/Go/PHP) para paridade.
🤖 Generated with Claude Code