Implemented a guard on POST /api/streams that rejects a near-duplicate stream — one with the same sender, recipient, asset, and amount created in the last 60 seconds — with a 409 DUPLICATE_STREAM response that includes the existing stream's ID, plus an X-Allow-Duplicate: true header to opt out. - #906
Implemented a guard on POST /api/streams that rejects a near-duplicate stream — one with the same sender, recipient, asset, and amount created in the last 60 seconds — with a 409 DUPLICATE_STREAM response that includes the existing stream's ID, plus an X-Allow-Duplicate: true header to opt out.#906DevScoopee wants to merge 1 commit into
Conversation
|
@DevScoopee 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! 🚀 |
|
@DevScoopee is attempting to deploy a commit to the ritik4ever's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
…e stream — one with the same sender, recipient, asset, and amount created in the last 60 seconds — with a 409 DUPLICATE_STREAM response that includes the existing stream's ID, plus an X-Allow-Duplicate: true header to opt out. This change adds findRecentDuplicate() to streamStore.ts, which looks up an identical active stream created within DUPLICATE_WINDOW_SECONDS (60), comparing amounts exactly and asset codes case-insensitively. The route handler in index.ts calls it before wrapping a stream and returns 409 with existingStreamId on a match, while honoring the X-Allow-Duplicate: true bypass; swagger.ts documents both the new header and the 409 shape. Closes ritik4ever#720
This change adds findRecentDuplicate() to streamStore.ts, which looks up an identical active stream created within DUPLICATE_WINDOW_SECONDS (60), comparing amounts exactly and asset codes case-insensitively. The route handler in index.ts calls it before wrapping a stream and returns 409 with existingStreamId on a match, while honoring the X-Allow-Duplicate: true bypass; swagger.ts documents both the new header and the 409 shape.
Closes #720