[#1552] Improve Horizon listener reconciliation: authorization and hostile-input boundary - #1589
Merged
1nonlypiece merged 1 commit intoAug 30, 2026
Conversation
…ation and hostile-input boundary
|
@xtep103 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! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
Enforces strict authorization, route parameter, and adversarial input validation boundaries for Horizon listener reconciliation and transaction repository operations to prevent terminal-state regressions, unauthorized access, and hostile input vulnerabilities.
Related Issue
Refs #1552
Closes #1552
Changes
Horizon Listener Configuration
src/config/horizonListener.tsisValidContractAddressString) and deduplication (sanitizeContractAddresses).startLedger(>= 0),retryMaxAttempts(1-100),retryBackoffMs(0-300k),shutdownTimeoutMs(1k-300k), andlagThreshold(0-100k).Transaction Repository & Data Boundary
src/repositories/transactionRepository.tsTransactionValidationErrorandTransactionAuthorizationError..create()(positive/non-negative amounts, allowed types, safe integer ledgers)..findByHash(),.findById(), and.listByVault().clampLimit(1-100) andclampOffset(>= 0), and safe cursor decoding.Horizon Reconciliation Engine
src/services/horizonReconciliation.tsisValidObservation,filterValidObservations) and quarantine invalid events.validateScanWindow).completed,failed,cancelled) can never be regressed.Transactions API Routes
src/routes/transactions.tsresolveActorUserId), rejecting disconnected wallets with 401.:id,:vaultId) with 400 Bad Request on malformed inputs.x-network-idandx-wallet-addressheaders.assertValidTransactionResponse).type,amount_min,amount_max,date_from,date_to).Automated Tests
src/tests/horizonListener.boundary.test.tssrc/repositories/transactionRepository.test.tssrc/services/horizonReconciliation.boundary.test.tssrc/tests/transactions.boundary.test.tsVerification Results
/api/transactionsand repository boundariesRefs #1552Design Tradeoffs & Remaining Limitations
loadHorizonListenerConfigsanitizes and deduplicates configured contract addresses to tolerate trailing whitespace/duplicate entries, whilevalidateHorizonListenerConfigfails closed on empty lists or invalid string formats.bun:test/vitest) are isolated injest.config.cjsto keep CI and blocking test runs clean and reproducible without modifying unrelated test contracts.