Skip to content

feat(gateway): rate limiting + replay/idempotency protection for session + webhook endpoints #34

Description

@aguilar1x

Context

The gateway is the only component that talks to the live Pacto API, holding pk_/sk_ credentials on behalf of every merchant. Today /v1/session and outbound webhooks have no rate limiting or replay protection, leaving them open to abuse and duplicate-processing bugs once real merchant traffic hits it.

Scope

  • Rate limit /v1/session and other public gateway endpoints per publishable key (sliding window, configurable).
  • Replay protection for signed webhooks: nonce/timestamp validation, reject requests outside a tolerance window.
  • Idempotency keys honored end-to-end so retried requests never create duplicate escrows or double-fire webhooks.

Acceptance criteria

  • A burst of requests beyond the configured limit returns 429 with a Retry-After header.
  • A replayed webhook payload (same signature, past its tolerance window) is rejected and logged.
  • Sending the same idempotency key twice returns the original result, not a duplicate side effect.

Metadata

Metadata

Labels

GrantFox OSSIssue tracked in GrantFox OSSMaybe RewardedIssue may be eligible for a GrantFox rewardOfficial Campaign | FWC26Campaign: Official Campaign | FWC26area:gatewayConnect Gateway (BFF)

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions