Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: validate asset id from deeplinks #5973

Merged
merged 3 commits into from Feb 27, 2023

Conversation

jeeanribeiro
Copy link
Contributor

Summary

Deeplink's assetId already has a validation that checks for the account assets being held, but it needs a validation of format and this PR implements this solution

Changelog

- Creates validateAssetId function
- Adds validateAssetId function in handleDeepLinkSendConfirmationOperation

Testing

Platforms

  • Desktop
    • MacOS
    • Linux
    • Windows
  • Mobile
    • iOS
    • Android

Instructions

  • Test deeplinks using developer tools:
  • Should show asset id not valid error
    firefly-alpha://wallet/sendConfirmation?address=rms1qpwed3kpaju5rwe4nhplaj3ya6tujzvyuepypya4us95yf2rkp80u5ja230&amount=1&assetId=trololololo10
  • Should show the asset is not known to this account error
    firefly-alpha://wallet/sendConfirmation?address=rms1qpwed3kpaju5rwe4nhplaj3ya6tujzvyuepypya4us95yf2rkp80u5ja230&amount=1&assetId=4218
  • Should show the asset is not known to this account error
    firefly-alpha://wallet/sendConfirmation?address=rms1qpwed3kpaju5rwe4nhplaj3ya6tujzvyuepypya4us95yf2rkp80u5ja230&amount=1&assetId=0x08952e6fa7235d6a9f58b5e2e2ba2fd07bba7bc684dad5b47873d35e98fffe58a10100000000
  • Should not show any error
    firefly-alpha://wallet/sendConfirmation?address=rms1qpwed3kpaju5rwe4nhplaj3ya6tujzvyuepypya4us95yf2rkp80u5ja230&amount=1&assetId=4219
  • Should not show any error
    firefly-alpha://wallet/sendConfirmation?address=rms1qpwed3kpaju5rwe4nhplaj3ya6tujzvyuepypya4us95yf2rkp80u5ja230&amount=1
  • Should not show any error
    firefly-alpha://wallet/sendConfirmation?address=rms1qpwed3kpaju5rwe4nhplaj3ya6tujzvyuepypya4us95yf2rkp80u5ja230&amount=1&assetId=<A_NATIVE_TOKEN_ID_THAT_THE_ACCOUNT_IS_HOLDING

Checklist

  • I have followed the contribution guidelines for this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or modified tests that prove my changes work as intended
  • I have verified that new and existing unit tests pass locally with my changes
  • I have verified that my latest changes pass CI workflows for testing and linting
  • I have made corresponding changes to the documentation

@jeeanribeiro jeeanribeiro added type:fix Fix for bug package:shared stardust Related to the Stardust Protocol labels Feb 25, 2023
@jeeanribeiro jeeanribeiro self-assigned this Feb 25, 2023
@jeeanribeiro jeeanribeiro linked an issue Feb 25, 2023 that may be closed by this pull request
4 tasks
Copy link
Contributor

@MarkNerdi996 MarkNerdi996 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@MarkNerdi996 MarkNerdi996 merged commit 895324d into develop Feb 27, 2023
@MarkNerdi996 MarkNerdi996 deleted the fix/validate-assetId-deeplinks branch February 27, 2023 13:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stardust Related to the Stardust Protocol type:fix Fix for bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Task]: Validate assetId on deeplinks
2 participants