SShortSingh.
Back to feed

How Duplicate Webhook Deliveries Silently Corrupt Payment Data

0
·1 views

Payment providers like Stripe, Midtrans, and Xendit routinely retry webhook events, but most applications are not built to handle these retries safely. Common failure modes include duplicate event delivery, out-of-order processing, malformed payloads, mid-process timeouts, and partial commits followed by failed downstream calls. A developer built a local test lab with 18 deterministic tests to reproduce these failure scenarios and validate fixes without involving real transactions. Key recommended safeguards include verifying HMAC signatures against the raw request body, storing both event IDs and payload hashes to detect suspicious retries, enforcing strict state machine transitions, and capping automatic retries at a fixed number before routing events to a human-review queue. Together, these measures address the subtle, compounding bugs that typically cause payment integrations to fail in production.

Read the full story at DEV Community

This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)

Log in to join the discussion and vote.

Log in

Related stories

0
ProgrammingDEV Community ·

How Node.js Webhook Consumers Should Handle Rate Limits and Dead-Letter Queues

A technical guide for B2B SaaS platforms warns that successful HTTP delivery responses do not confirm that downstream business actions—like renewal reminders—actually completed on time. The core principle is that a consumer must treat the business deadline as the primary service-level objective, making rate limits, retry policies, and dead-letter decisions explicit parts of the system contract. Engineers are advised to define three key numbers before choosing queue technology: the business deadline, the sustainable downstream processing rate, and the maximum tolerable duplicate effect. The guide distinguishes between acknowledgement, negative acknowledgement, and dead-lettering as separate outcomes based on the future likelihood of success, not HTTP status codes. Duplicate handling is flagged as an application-level responsibility under at-least-once delivery, with uniqueness constraints on event IDs recommended to prevent stale or repeated actions.

0
ProgrammingDEV Community ·

How a Stale Retry Silently Restored Access to a Deactivated Account

A technical case study highlights how a timed-out provisioning job can inadvertently restore access to a deactivated user account in distributed systems. In the described scenario, access was correctly removed from a deactivated account, but an older queued worker woke up and replayed the original group-addition request minutes later, bypassing the deactivation. Each individual system component behaved as designed, yet the combined sequence produced an incorrect and insecure final state. The article argues that queues preserve work but cannot guarantee that queued work remains valid, making generation-based checks and idempotent reconciliation essential safeguards. It also warns that provisioning systems often treat delayed onboarding as more urgent than delayed removal, leaving access-revocation gaps that are harder to detect through standard API success metrics.

0
ProgrammingDEV Community ·

Developer builds preflight scanner to catch MCP tool security flaws before deployment

A developer has created an open-source preflight security scanner targeting Model Context Protocol (MCP) tools, addressing gaps that standard demos fail to reveal. The tool runs static and behavioral checks across four rule categories, flagging issues such as unsafe shell commands, excessive scope declarations, embedded secrets, and unvalidated user inputs. Behavioral tests go further by calling a local fixture server to verify tenant isolation, write approval enforcement, and quota limits. Each finding is assigned a severity level, a remediation step, and a trackable status, turning security observations into actionable engineering tasks. The scanner is positioned as a bounded first-pass filter rather than a full penetration test, with source code available on GitHub at github.com/glatinone/mcp-security-preflight.

0
ProgrammingDEV Community ·

How to Securely Bridge Webhooks to Kafka, Redpanda, and NATS at the Edge

Directly ingesting webhooks into event brokers like Kafka or NATS exposes systems to synchronous timeout failures, replay attacks, and duplicate deliveries. An edge-gateway pattern addresses this by terminating TLS, validating provider-specific HMAC signatures from services like Stripe, GitHub, and Shopify before any payload parsing occurs. Signature checks must use constant-time comparisons and run against the raw request body, while deduplication relies on provider-supplied delivery IDs. Verified events are then normalized into the CloudEvents standard format and routed to the appropriate broker partition based on entity identifiers. Observability metrics and dead-letter queue handling are also essential components of a production-grade implementation.