Skip to content

0x bernny payment - #644

Merged
therealjhay merged 2 commits into
Betta-Pay:mainfrom
0xBernny:0xBernny-payment
Sep 4, 2026
Merged

0x bernny payment#644
therealjhay merged 2 commits into
Betta-Pay:mainfrom
0xBernny:0xBernny-payment

Conversation

@0xBernny

@0xBernny 0xBernny commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Description

This pull request addresses the unbounded database growth vulnerability within the API gateway's payment idempotency handling. Previously, transactional idempotency keys accumulated indefinitely inside Redis, risking long-term performance degradation and hash collision bottlenecks.

Key Changes

  1. TTL Implementation: Configured a strict 24-hour Time-To-Live (EX: 86400 seconds) threshold on all newly initialized tracking entries via saveIdempotencyKey. Expirations are executed automatically natively by Redis.
  2. Automated Cleanup: Enforcing time-bounds mitigates cache expansion and risks of duplicate parameter collisions across extended multi-week tracking intervals.
  3. Expiry Test Coverage: Updated payment-idempotency.test.ts to assertively validate that parameter arguments explicitly instruct the storage layer to inject matching expiration bounds.

Verification of TTL Configuration

When a payment request hits the application gateway, checking its state directly via the Redis CLI demonstrates the active countdown timeline:

# Verify the key is successfully saved with its expiry time matrix intact
TTL idempotency:payment_req_992a1
(integer) 86395  # Successfully counting down to automated purging limit

Related Issues

Checklist

  • I have read the CONTRIBUTING.md guidelines.
  • I have updated the documentation accordingly.
  • I have added/updated tests for my changes.
  • All CI validations pass.

Implement idempotency middleware to save and retrieve payment responses with a 24-hour expiration.
Add a test for saving idempotency keys with a 24-hour TTL in Redis.
@drips-wave

drips-wave Bot commented Sep 3, 2026

Copy link
Copy Markdown

@0xBernny Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@therealjhay
therealjhay merged commit 39e4153 into Betta-Pay:main Sep 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

api-gateway payment idempotency stores the key without cleanup

2 participants