flowfi icon indicating copy to clipboard operation
flowfi copied to clipboard

[Backend] Stop echoing raw error.message to clients and mislabeling 4xx as unhandled errors

Open blurbeast opened this issue 1 week ago • 5 comments

Overview & Background

Two logging/response leaks: (1) error.middleware.ts:16 runs logger.error('Unhandled error:', err) unconditionally, before any classification — so handled 400s (e.g. the ZodError branch) are logged at error level as "unhandled", hiding real failures in on-call noise. (2) webhook.controller.ts:40,102,116,130,155 echoes raw exception text ({ error: error.message }) to clients — Prisma messages name models/tables — bypassing sanitizeDatabaseErrorMessage, which exists precisely to prevent that. graphql/routes.ts:56-59 similarly returns raw error.message in errors[0].message.


Technical Specification & Architecture

  1. Log at warn/debug for 4xx; reserve error for 5xx.
  2. Route webhook/GraphQL failures through sendApiError/sanitizeDatabaseErrorMessage with generic client messages.

Target Files

  • backend/src/middleware/error.middleware.ts
  • backend/src/controllers/webhook.controller.ts
  • backend/src/graphql/routes.ts
  • backend/src/lib/api-error.ts

Acceptance Criteria

  • [ ] 4xx responses are not logged as unhandled errors.
  • [ ] No raw exception text reaches clients.
  • [ ] Tests assert sanitized error bodies.

blurbeast avatar Nov 18 '26 19:11 blurbeast

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

I can take this on. I've gone through the details and will provide a well-tested solution aligned with the project standards.

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

heymide avatar Nov 20 '26 13:11 heymide

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

Hi maintainer, I would like to work on this issue. I understand the goal is a cash-flow calendar that visualizes expected incoming and outgoing stream activity over a selectable period, correctly accounting for pauses, end dates, and uncertainty so projections are never presented as guaranteed settlement. Based on my experience building financial timeline components in React/TypeScript with careful date and timezone handling, this is how I'll resolve this issue: I will build the calendar to expand each stream's schedule across the selected range while respecting pauses and end dates, reconcile per-day summaries against existing stream detail calculations, test timezone boundaries and failure cases, label projected amounts as estimates, update the relevant documentation, and open a PR referencing Closes #263 with test results, without touching wallet authorization, chain validation, accounting invariants, or secret handling.

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

Aboyeji-Isaac avatar Nov 20 '26 15:11 Aboyeji-Isaac

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

yours is easy

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

anitahhhh avatar Nov 21 '26 07:11 anitahhhh

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

🧑‍💻 @anitahhhh: 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 07:11 drips-wave[bot]

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

😎 @anitahhhh: 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 24 '26 09:11 drips-wave[bot]