Skip to content

Trim surrounding whitespace in the Stellar address pipe before validating - #666

Open
thelux134 wants to merge 1 commit into
Refract-Protocol:mainfrom
thelux134:fix/issues-570-571-572-573
Open

thelux134 wants to merge 1 commit into
Refract-Protocol:mainfrom
thelux134:fix/issues-570-571-572-573

Conversation

@thelux134

@thelux134 thelux134 commented Nov 25, 2026 •

Copy link
Copy Markdown

#572: stellar-address.pipe.ts passed the raw @PARAM() value straight to the length/StrKey checks, so a value with leading/trailing whitespace (e.g. from a copy-paste) failed length validation even though the address itself was valid. Trim before validating; StrKey.isValidEd25519PublicKey already rejects any remaining internal whitespace on its own, since space is not part of the base32 charset it decodes, so no separate internal-whitespace check was needed. The error messages already name the field ("address"). Closes #572

#573, #571, #570 are not changed in this commit: investigated each against the real current code and found the described bug does not exist.

#573: src/common/pagination.ts and list-claims.dto.ts use keyset-cursor pagination with a 1-based page field already validated by @Min(1) - there is no Math.floor(offset / limit) page computation anywhere in the codebase (grepped for it). ListClaimsDto itself has no callers.

#571: coverage-limits.validator.ts already rejects a coverageAmount of 0 (and any negative value) via its existing coverageAmount < limits.minCoverageAmount check, since minCoverageAmount is hardcoded to 100 for every coverage type - 0 can never satisfy >= 100. Same for durationDays against minDurationDays=1.

#570: both real fixed-decimal parsers in this codebase (src/common/fixed-point.ts's parseFixed and
src/oracle/oracle-encoding.ts's parseFixedDecimal) use the regex /^-?\d+(\.\d+)?$/, which already requires at least one digit before any decimal point - "." and "-.5" already throw today. Note this regex also currently rejects a bare trailing-dot input like "5." (no digits after the dot), which the issue explicitly says must keep working; no test pins this down for either parser (no test file exists for fixed-point.ts), so I did not touch it rather than guess at an untested edge case while the issue's core premise (lone "." silently becoming 0) does not reproduce.

Summary

…ting

Refract-Protocol#572: stellar-address.pipe.ts passed the raw @PARAM() value straight to the
length/StrKey checks, so a value with leading/trailing whitespace (e.g. from
a copy-paste) failed length validation even though the address itself was
valid. Trim before validating; StrKey.isValidEd25519PublicKey already rejects
any remaining internal whitespace on its own, since space is not part of the
base32 charset it decodes, so no separate internal-whitespace check was
needed. The error messages already name the field ("address").
Closes Refract-Protocol#572

Refract-Protocol#573, Refract-Protocol#571, Refract-Protocol#570 are not changed in this commit: investigated each against
the real current code and found the described bug does not exist.

Refract-Protocol#573: src/common/pagination.ts and list-claims.dto.ts use keyset-cursor
pagination with a 1-based `page` field already validated by `@Min(1)` -
there is no `Math.floor(offset / limit)` page computation anywhere in the
codebase (grepped for it). ListClaimsDto itself has no callers.

Refract-Protocol#571: coverage-limits.validator.ts already rejects a coverageAmount of 0 (and
any negative value) via its existing `coverageAmount < limits.minCoverageAmount`
check, since minCoverageAmount is hardcoded to 100 for every coverage type -
0 can never satisfy `>= 100`. Same for durationDays against minDurationDays=1.

Refract-Protocol#570: both real fixed-decimal parsers in this codebase
(src/common/fixed-point.ts's parseFixed and
src/oracle/oracle-encoding.ts's parseFixedDecimal) use the regex
`/^-?\d+(\.\d+)?$/`, which already requires at least one digit before any
decimal point - "." and "-.5" already throw today. Note this regex also
currently rejects a bare trailing-dot input like "5." (no digits after the
dot), which the issue explicitly says must keep working; no test pins this
down for either parser (no test file exists for fixed-point.ts), so I did
not touch it rather than guess at an untested edge case while the issue's
core premise (lone "." silently becoming 0) does not reproduce.
@drips-wave

drips-wave Bot commented Nov 25, 2026

Copy link
Copy Markdown

@thelux134 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

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.

Stellar address pipe trims whitespace before validating

1 participant