flowfi icon indicating copy to clipboard operation
flowfi copied to clipboard

[Docs] ARCHITECTURE.md's Action Signing Model omits Cancel, wrongly implies only Top-up is custodial

Open K1NGD4VID opened this issue 2 months ago • 10 comments

Labels: docs, backend, security, third-wave-audit File/location: docs/ARCHITECTURE.md:251-262 ; backend/src/controllers/stream/cancel.ts:90-96

Description: docs/ARCHITECTURE.md's 'Action Signing Model' section lists only Top-up, Withdraw, Pause/Resume, and Create, states 'Only top-up is intentionally custodial. All other mutating actions must be wallet-signed by the user,' and does not mention Cancel at all. In actual code, backend/src/controllers/stream/cancel.ts reads process.env.KEEPER_SECRET_KEY and calls sorobanService.cancelStream(parsedStreamId, secretKey), i.e. the backend signs and submits the on-chain cancel transaction server-side with the same custodial keeper key used for top-up — cancel is just as custodial as top-up, not wallet-signed. A contributor or security reviewer relying on this table to reason about which endpoints hold custodial risk would be misled about a second fully custodial, fund-moving action.

Acceptance Criteria:

  • [ ] docs/ARCHITECTURE.md's Action Signing Model table adds a Cancel row reflecting that it is server/custodial-signed via KEEPER_SECRET_KEY, matching cancel.ts.
  • [ ] The prose 'Only top-up is intentionally custodial...' is corrected to also name Cancel, or generalized to describe the actual set of custodial vs wallet-signed actions.
  • [ ] A quick grep of backend/src/controllers/stream/*.ts for KEEPER_SECRET_KEY usage confirms the corrected table matches which handlers actually sign server-side.

Notes: Verified by reading cancel.ts in full: it fetches KEEPER_SECRET_KEY, 500s if unset, and calls sorobanService.cancelStream with it — the same secret and pattern top-up uses. This is distinct from the already-closed #545 (env var naming ambiguity between SOROBAN_SECRET_KEY and KEEPER_SECRET_KEY) and from #566 (auth middleware inconsistency); this is specifically about the documented signing-custody model being incomplete/incorrect about which mutating action is custodial.

K1NGD4VID avatar Sep 27 '26 21:09 K1NGD4VID

I reviewed docs/ARCHITECTURE.md:251-262 against backend/src/controllers/stream/cancel.ts:90-96. The Action Signing Model table only lists top-up as custodial, but cancel.ts reads KEEPER_SECRET_KEY and calls sorobanService.cancelStream server-side with it, the same custodial pattern as top-up. My fix adds a Cancel row to the table marking it server/custodial-signed via KEEPER_SECRET_KEY, corrects the "only top-up is intentionally custodial" prose to name both actions, and greps backend/src/controllers/stream/*.ts for KEEPER_SECRET_KEY usage to confirm the corrected table matches every handler that actually signs server-side. This is a scoped, verifiable docs fix, I can turn it around quickly.

2TheMoom avatar Sep 27 '26 22:09 2TheMoom

Hi! I’d like to work on this issue if it’s still available. I have experience building web applications with React, Next.js, and NestJS, and I’m comfortable working with Git and collaborative development workflows. I’m confident I can implement a clean, maintainable solution while following the project’s contribution guidelines.

stacyelliott492-star avatar Sep 27 '26 23:09 stacyelliott492-star

Hi,

I have experience with similar implementations and would like to take this on.

Implementation approach:

  1. Audit storage layout and state invariants ensuring strict auth guards.
  2. Implement deterministic state transitions with safe checked arithmetic.
  3. Add hermetic unit and regression tests covering authorized, unauthorized, and boundary edge cases.
  4. Profile instruction and CPU/gas limits under Soroban host environment.

Please assign this to me if the plan looks good. Thanks!

shobhamerabacha-star avatar Oct 03 '26 23:10 shobhamerabacha-star

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

Please give me a chance to fix this issue I won't disappoint please 🥺

ℹ️ Repo Maintainers: To accept this application, review their application or assign @Starkid591 to this issue.

Starkid591 avatar Oct 16 '26 23:10 Starkid591

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

Hello Chief I have gone through the task and can implement within a few hours of work. Please assign for successful completion within 4-6 hours of work

ℹ️ Repo Maintainers: To accept this application, review their application or assign @CHKM001 to this issue.

CHKM001 avatar Oct 16 '26 23:10 CHKM001

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

Hi! I’d like to take ownership of #1547 in FlowFi also #1828. I’ll update the Action Signing Model documentation to accurately reflect custodial signing for both Top-up and Cancel, verify the relevant handlers, and keep the changes focused and consistent with the implementation. Could you please assign this issue to me? though i have good connection with boss oladele banjo!!Thank you!

ℹ️ Repo Maintainers: To accept this application, review their application or assign @codedbytejas to this issue.

codedbytejas avatar Oct 17 '26 18:10 codedbytejas

@helenahelenavanbeek-png has applied to work on this issue as part of the Stellar Wave Program's 10th wave.

I would like to work on this issue. I have experience with Rust and Soroban smart contract development. I will follow the acceptance criteria and add tests. Excited to contribute. Kindly assign.

ℹ️ Repo Maintainers: To accept this application, review their application or assign @helenahelenavanbeek-png to this issue.

helenahelenavanbeek-png avatar Oct 17 '26 21:10 helenahelenavanbeek-png

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

Hello maintainer, i would like to work on this issue

ℹ️ Repo Maintainers: To accept this application, review their application or assign @fadesany to this issue.

fadesany avatar Oct 18 '26 03:10 fadesany

Congratulations, @fadesany! 🎉 Your application was accepted by the repo's maintainers, and the issue is due on October 22, 2026.

🧑‍💻 @fadesany: 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 Oct 18 '26 03:10 drips-wave[bot]

This issue has been completed by @fadesany as part of the Stellar Wave Program's 10th Wave 🥳

😎 @fadesany: 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 Oct 18 '26 04:10 drips-wave[bot]