Problem
Payment rows with an invalid asset code pass upload validation and only
fail later, during actual transaction construction — turning what should be
a clear pre-submission rejection into a confusing mid-batch failure.
Severity: Medium
Location: lib/stellar/validator.ts:124-153, lib/stellar/utils.ts:155-169
Description
The asset validator checks that the code portion of CODE:ISSUER is
non-empty and at most 12 characters, and that the issuer address checksum is
valid — but never checks that the code is alphanumeric, which Stellar
requires. A value like "BAD CODE" (8 characters, including a space) passes
validation as valid: true. Later, new Asset(code, issuer) in
stellar-sdk throws when actually building the payment operation, turning a
row that should have been rejected at upload into a failure during batch
execution.
Steps to Reproduce
- Upload a row with asset
BAD CODE:<valid issuer address>.
- Validation reports the row as valid.
- Submit the batch.
stellar-sdk throws "Asset code is invalid" while constructing the
payment operation, failing that row at execution time instead of upload.
Expected Behavior
Any asset accepted by pre-submission validation should be guaranteed
constructible by stellar-sdk — invalid codes should be rejected at upload.
Suggested Fix Approach
Require the code to match Stellar's alphanumeric rule directly in the
validator, or construct a stellar-sdk Asset inside validation itself and
convert any thrown exception into a row-level validation error.
Acceptance Criteria
Problem
Payment rows with an invalid asset code pass upload validation and only
fail later, during actual transaction construction — turning what should be
a clear pre-submission rejection into a confusing mid-batch failure.
Severity: Medium
Location:
lib/stellar/validator.ts:124-153,lib/stellar/utils.ts:155-169Description
The asset validator checks that the code portion of
CODE:ISSUERisnon-empty and at most 12 characters, and that the issuer address checksum is
valid — but never checks that the code is alphanumeric, which Stellar
requires. A value like
"BAD CODE"(8 characters, including a space) passesvalidation as
valid: true. Later,new Asset(code, issuer)instellar-sdkthrows when actually building the payment operation, turning arow that should have been rejected at upload into a failure during batch
execution.
Steps to Reproduce
BAD CODE:<valid issuer address>.stellar-sdkthrows "Asset code is invalid" while constructing thepayment operation, failing that row at execution time instead of upload.
Expected Behavior
Any asset accepted by pre-submission validation should be guaranteed
constructible by
stellar-sdk— invalid codes should be rejected at upload.Suggested Fix Approach
Require the code to match Stellar's alphanumeric rule directly in the
validator, or construct a
stellar-sdkAssetinside validation itself andconvert any thrown exception into a row-level validation error.
Acceptance Criteria
validation time, not execution time
characters