fix(payment): validate subscription periods and tighten amount parsing#330
Open
faisalnugroho wants to merge 1 commit into
Open
fix(payment): validate subscription periods and tighten amount parsing#330faisalnugroho wants to merge 1 commit into
faisalnugroho wants to merge 1 commit into
Conversation
- Add validatePeriodInDays() and validatePeriodInSeconds() to reject zero, negative, non-integer, NaN, and Infinity values - Fix validateStringAmount() to use regex before parseFloat(), preventing malformed strings like '1abc' or '1.2.3' from passing validation - Apply period validation in subscribe() for both periodInDays and overridePeriodInSecondsForTestnet Closes base#314 Closes base#313
Collaborator
🟡 Heimdall Review Status
|
Author
|
Hi! I'd love to get this PR reviewed when you have a moment. This PR addresses validate subscription periods and tighten amount parsing. Happy to make any adjustments based on your feedback. Let me know if there's anything I can do to help move this forward. |
Author
|
Hi! I'd love to get this PR reviewed when you have a moment. This PR addresses validate subscription periods and tighten amount parsing. Happy to make any adjustments based on your feedback. Thank you! |
kostyandragun1107-lang
approved these changes
Jun 5, 2026
Collaborator
|
Review Error for kostyandragun1107-lang @ 2026-06-05 02:13:18 UTC |
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.
Closes #314
Closes #313
Changes
1. Tightened
validateStringAmount()(#313)/^-?\d+(\.\d+)?$/) beforeparseFloat()to reject malformed strings like"1abc","1.2.3","1foo"isFinite()check to rejectInfinityvalues2. Added period validation functions (#314)
validatePeriodInDays()— rejects zero, negative, non-integer, NaN, and Infinity valuesvalidatePeriodInSeconds()— same validation for seconds-based periods3. Applied period validation in
subscribe()periodInDaysbefore creating spend permission typed dataoverridePeriodInSecondsForTestnetwhen present (testnet mode)Testing