flowfi icon indicating copy to clipboard operation
flowfi copied to clipboard

[Security] Stop accepting wallet secret keys over the API in stream cancel

Open blurbeast opened this issue 2 weeks ago â€ĸ 3 comments

Overview & Background

POST /v1/streams/:streamId/cancel requires the caller to POST their Stellar secret key in the JSON body (senderSecret). The backend then reconstructs the keypair and signs the transaction server-side. Secret keys transit the API, live in server memory, and are exposed to logs, proxies, and any compromised host. This also contradicts the project's own stated direction of client-side signing (sorobanService.ts deprecation note: "deprecating backend keeper signing in favour of client-side signing").


Technical Specification & Architecture

  1. Remove senderSecret from the cancel contract:
    • backend/src/controllers/stream/cancel.ts:85-90 currently validates and forwards req.body.senderSecret.
    • backend/src/services/sorobanService.ts:314-318 (submitContractCall) accepts senderSecret: string and calls Keypair.fromSecret(senderSecret).
  2. Route cancel through the existing unsigned-XDR flow used by /v1/streams/simulate so the browser wallet signs, or sign with the server keeper key the way topUpStream does.
  3. Reject and purge any legacy senderSecret field immediately (400 with a clear migration message), and scrub historical log lines if any were recorded.

Target Files

  • backend/src/controllers/stream/cancel.ts
  • backend/src/services/sorobanService.ts
  • backend/src/routes/v1/streams/cancel.ts

Acceptance Criteria

  • [ ] No endpoint accepts a Stellar secret key in request body, query, or headers.
  • [ ] Cancel flow produces a signed transaction without the backend ever seeing a user secret key.
  • [ ] submitContractCall no longer takes senderSecret; legacy callers are removed.
  • [ ] Regression test asserts that a senderSecret field is rejected.

blurbeast avatar Nov 18 '26 19:11 blurbeast

@OlamideAdesina has applied to work on this issue as part of the Stellar Wave Program's 11th wave.

Hi maintainer, I can get this issue fixed quickly. Please assign it to me

â„šī¸ Repo Maintainers: To accept this application, review their application or assign @OlamideAdesina to this issue.

OlamideAdesina avatar Nov 21 '26 12:11 OlamideAdesina

Congratulations, @OlamideAdesina! 🎉 Your application was accepted by the repo's maintainers, and the issue is due on November 25, 2026.

🧑‍đŸ’ģ @OlamideAdesina: Please resolve the issue such that the repo's maintainers have enough time to review your contribution before the due date. You'll earn Points for completing the issue on-time, which will make you eligible for a share of the Stellar Wave Program's reward pool.

[!WARNING] When opening a PR, please link it to this issue to ensure it gets tracked accurately. Points are awarded when this issue is marked as completed by the maintainer.

🤠 Repo maintainers: Please keep an eye on the contributor's progress and review their work before the due date. You can manage this issue, including adjusting its complexity and points, here.

🌊 Happy Wave 🌊

drips-wave[bot] avatar Nov 21 '26 12:11 drips-wave[bot]

This issue has been completed by @OlamideAdesina as part of the Stellar Wave Program's 11th Wave đŸĨŗ

😎 @OlamideAdesina: You earned 200 Points for completing this issue! Once the Wave's rewards are finalized, you'll be eligible for a percentage of the Wave's reward pool based on the percentage of total points you've earned. Learn more here. You can also Leave a review to share your experience working on this issue.

🧑‍đŸ’ģ Repo maintainers: How'd the contributor do? Leave a review to share your experience working with them.

drips-wave[bot] avatar Nov 22 '26 09:11 drips-wave[bot]