Add Stellar address validation, mainnet payment kill-switch, build SHA in health check, and consolidated auth error messages - #655
Merged
Conversation
…A in health check, and consolidated auth error messages
|
@CeceOs92 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! 🚀 |
…ayment-kill-switch-build-SHA-in-healt-check-and-consolidated-auth-error-messages
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.
Title
Add Stellar address validation, mainnet payment kill-switch, build SHA in health check, and consolidated auth error messages
Summary
@IsStellarPublicKey()validator (backed byStrKeyHelper/stellar-sdk, not just a shape regex) and wired it into every DTO that accepts a Stellar address:BuildTransactionDto,FeeBumpTransactionDto,CreateTransactionDto,ReconcileBalanceDto,BalanceFilterDto.BuildTransactionDtopreviously had no validation decorators at all.FeeBumpService.submitFeeBumpnow checks amainnet_payment_submitflag (FEATURE_MAINNET_PAYMENT_SUBMIT) before submitting anynetwork: "MAINNET"fee-bump transaction to Horizon, returning a403if disabled.TESTNETsubmissions are unaffected.GET /healthnow returnsbuild: { gitSha }, sourced from aGIT_SHAenv var (wired into theDockerfileas a build arg), merged into both the healthy response and the503failure body for a consistent shape.POST /auth/authenticateno longer leaks raw downstream error text (e.g."DB unavailable","Stellar unavailable") into the HTTP response. Unclassified failures now throw a singleServiceUnavailableExceptionwith a generic, consolidated message; the real cause is still logged server-side only.Details
#515 — Validate Stellar addresses in DTOs
src/common/stellar/is-stellar-public-key.validator.ts(+ spec)build-transaction.dto.ts,fee-bump-transaction.dto.ts,create-transaction.dto.ts,reconcile-balance.dto.ts,balance-filter.dto.ts^G[A-Z0-9]{55}$) with real StrKey checksum validation, catching typos/bit-flips a regex would miss#522 — Add feature flag for mainnet payment submit
FeeBumpServicenow injectsFeatureFlagService; gates MAINNET submissions before any wallet key decryption or Horizon call403responsedocs/MAINNET-PAYMENT-FEATURE-FLAG.mdadded#548 — Expose build git sha in health endpoint
HealthControllerreadsGIT_SHAviaConfigService(default"unknown"), mergesbuild.gitShainto success and 503 failure responsesDockerfile—ARG GIT_SHA=unknown/ENV GIT_SHA=$GIT_SHA, injectable via--build-arg GIT_SHA=$(git rev-parse HEAD).env.exampledocuments the new varhealth.controller.spec.tscovering success, missing-env default, DB-down 503 (with gitSha still present), and non-Terminus errors passing through unchanged#550 — Consolidate external auth error messages
auth-orchestrator.service.ts: replacedthrow new Error(\Authentication failed: ${error.message}`)(a plainError, only sanitized inNODE_ENV=production) withthrow new ServiceUnavailableException(EXTERNAL_AUTH_FAILURE_MESSAGE)— a single consolidated, generic message, consistent with the filter'sHttpException` handling used everywhere elselogger.error(...)call — never dropped, just never echoed to the callerauth-orchestrator.integration.spec.tsandauth-metrics.integration.spec.ts, which previously asserted on the leaked raw error text as expected behavior, to instead assert the generic message and that the raw cause is absentTest plan
npm ci && npm test— not run in this environment (nonode_modulespresent in the sandbox); please run before mergingPOST /transactions/build,POST /transactions/fee-bump(MAINNET on/off),GET /health,POST /auth/authenticatefailure pathCloses #515
Closes #522
Closes #548
Closes #550