Skip to content

fix: map Horizon upstream errors to safe stable API responses - #1051

Merged
MaryammAli merged 3 commits into
BlockDash-Studios:mainfrom
agba-marvel:fix/issue-1013-ba-100-avoid-exposing-upstream-horizon-error
Oct 17, 2026
Merged

MaryammAli merged 3 commits into
BlockDash-Studios:mainfrom
agba-marvel:fix/issue-1013-ba-100-avoid-exposing-upstream-horizon-error

Conversation

@agba-marvel

@agba-marvel agba-marvel commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

Overview

This PR prevents upstream Horizon error payloads from leaking through the Stellar API surface. Upstream failures are now mapped to safe, stable API errors while diagnostic context (status, operation, upstream message) is retained internally for logging/debugging.

Related Issue

Changes

🛡️ Horizon Error Mapping

  • [MODIFY] BackendAcademy/src/stellar/horizon.service.ts

    • Wraps Horizon calls so upstream failures are caught and translated into safe, stable error objects instead of propagating raw Horizon payloads.
    • Retains diagnostic context (upstream status, operation, message) internally for logging, without exposing it to callers.
  • [MODIFY] BackendAcademy/src/stellar/stellar.controller.ts

    • Returns the mapped, safe error responses to API consumers so upstream Horizon details are never surfaced in HTTP responses.
  • [MODIFY] BackendAcademy/src/stellar/horizon.service.spec.ts

    • Adds coverage verifying upstream Horizon failures are mapped to safe stable errors and that diagnostic context is preserved internally.

Verification Results

npm test -- BackendAcademy/src/stellar/horizon.service.spec.ts
✅ Horizon error-mapping tests pass
Acceptance Criteria Status
Upstream failures mapped to safe, stable API errors ✅ Horizon errors translated before reaching callers
Diagnostic context retained internally ✅ Upstream status/operation/message preserved for logging
Scope limited to the three allowlisted files ✅ Only horizon.service.ts, stellar.controller.ts, horizon.service.spec.ts modified

Closes #1013

@drips-wave

drips-wave Bot commented Oct 17, 2026

Copy link
Copy Markdown

@agba-marvel 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! 🚀

Learn more about application limits

@agba-marvel agba-marvel changed the title fix: map Horizon upstream errors to safe API responses fix: map Horizon upstream errors to safe stable API responses Oct 17, 2026
@MaryammAli
MaryammAli merged commit 9ad1776 into BlockDash-Studios:main Oct 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BA-100 — Avoid exposing upstream Horizon error payloads

2 participants