flowfi icon indicating copy to clipboard operation
flowfi copied to clipboard

[Security] Block SSRF in webhook target URL validation

Open blurbeast opened this issue 2 weeks ago • 6 comments

Overview & Background

Webhook target URLs are validated only with targetUrl.startsWith("https://") before the backend fetches them server-side. Any https URL is accepted — including https://localhost/..., RFC1918 addresses, and cloud metadata hosts like https://169.254.169.254/.... Combined with the currently unauthenticated webhook routes this is a server-side request forgery primitive, with a 10s connection hold per attempt and a 5-attempt retry ladder.


Technical Specification & Architecture

  1. Harden registration-time checks in backend/src/services/webhook.service.ts:76 and :137 (update path): resolve the hostname and reject loopback, private (RFC1918), link-local, and metadata IP ranges.
  2. Re-validate at fetch time (webhook.service.ts:276-285) to cover DNS rebinding.
  3. Optionally route deliveries through an egress allowlist/proxy and cap redirect following (do not follow redirects to disallowed hosts).

Target Files

  • backend/src/services/webhook.service.ts

Acceptance Criteria

  • [ ] Registration of loopback/private/metadata URLs fails with a clear 400.
  • [ ] A hostname that resolves to a private IP at delivery time is not fetched.
  • [ ] Unit tests cover localhost, 10.x, 192.168.x, 169.254.169.254, ::1, and decimal/hex IP encodings.

blurbeast avatar Nov 18 '26 19:11 blurbeast

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

Hi team, I'm applying to work on this issue. I have strong experience with TypeScript, NestJS, and Soroban smart contracts. I will deliver clean, tested code following the acceptance criteria. Ready to start immediately.

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

Grace-ope avatar Nov 21 '26 12:11 Grace-ope

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

I would like to work on this kindly assign me

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

entitydev30 avatar Nov 21 '26 14:11 entitydev30

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

Hi team, I'd like to take on #1089! I will update CODE_OF_CONDUCT.md to establish a concrete, documented reporting escalation path (and cross-link it in SECURITY.md). Could you please confirm the preferred email address or reporting channel for LabsCrypt/flowfi so I can wire it in? Looking forward to your guidance!

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

isasadiq avatar Nov 21 '26 14:11 isasadiq

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

i will like to work on this

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

OlamideAdesina avatar Nov 21 '26 15: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 15: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]