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

chore: add Sentry snapshot with masked data #10241

Merged
merged 16 commits into from
Jul 15, 2024
Merged

Conversation

tommasini
Copy link
Contributor

@tommasini tommasini commented Jul 3, 2024

Description

This PR introduces snapshot with masked data for metamask mobile.
Here is an example of masked data on sentry

{"accounts": {"reloadAccounts": false}, "alert": {"autodismiss": null, "content": null, "data": null, "isVisible": false}, "bookmarks": [], "browser": {"activeTab": null, "favicons": [], "history": [], "tabs": [], "visitedDappsByHostname": {}, "whitelist": []}, "collectibles": {"favorites": {}, "isNftFetchingProgress": false}, "engine": {"backgroundState": {"AccountTrackerController": [Object], "AccountsController": [Object], "AddressBookController": [Object], "ApprovalController": [Object], "AssetsContractController": [Object], "CurrencyRateController": [Object], "GasFeeController": [Object], "KeyringController": [Object], "LoggingController": [Object], "NetworkController": [Object], "NftController": [Object], "NftDetectionController": "object", "PPOMController": [Object], "PermissionController": [Object], "PhishingController": [Object], "PreferencesController": [Object], "SmartTransactionsController": [Object], "SnapController": [Object], "SubjectMetadataController": [Object], "SwapsController": [Object], "TokenBalancesController": "object", "TokenDetectionController": [Object], "TokenListController": [Object], "TokenRatesController": [Object], "TokensController": [Object], "TransactionController": [Object]}}, "experimentalSettings": {"securityAlertsEnabled": true}, "fiatOrders": "object", "infuraAvailability": {"isBlocked": false}, "inpageProvider": {"networkId": "1"}, "legalNotices": {"newPrivacyPolicyToastClickedOrClosed": true, "newPrivacyPolicyToastShownDate": null}, "modals": {"collectibleContractModalVisible": false, "dappTransactionModalVisible": false, "networkModalVisible": false, "receiveAsset": undefined, "receiveModalVisible": false, "shouldNetworkSwitchPopToWallet": true, "signMessageModalVisible": true}, "navigation": {"currentBottomNavRoute": "Wallet", "currentRoute": "Login"}, "networkOnboarded": {"networkOnboardedState": {}, "networkState": {"nativeToken": "", "networkType": "", "networkUrl": "", "showNetworkOnboarding": false}, "switchedNetwork": {"networkStatus": false, "networkUrl": ""}}, "notification": {"notification": {"notificationsSettings": [Object]}, "notifications": []}, "onboarding": {"events": []}, "privacy": {"approvedHosts": {}, "revealSRPTimestamps": []}, "rpcEvents": {"signingEvent": {"eventStage": "idle", "rpcName": ""}}, "sdk": {"approvedHosts": {}, "connections": {}, "dappConnections": {}, "wc2Metadata": undefined}, "security": {"allowLoginWithRememberMe": false, "automaticSecurityChecksEnabled": false, "dataCollectionForMarketing": null, "hasUserSelectedAutomaticSecurityCheckOption": false, "isAutomaticSecurityChecksModalOpen": false, "isNFTAutoDetectionModalViewed": false}, "settings": {"basicFunctionalityEnabled": true, "hideZeroBalanceTokens": false, "lockTime": 30000, "primaryCurrency": "ETH", "searchEngine": "DuckDuckGo", "useBlockieIcon": true}, "signatureRequest": "object", "smartTransactions": {"optInModalAppVersionSeen": null}, "swaps": "object", "transaction": "object", "transactionMetrics": "object", "user": {"ambiguousAddressEntries": "object", "appTheme": "os", "backUpSeedphraseVisible": false, "gasEducationCarouselSeen": false, "initialScreen": "", "isAuthChecked": false, "loadingMsg": "", "loadingSet": false, "passwordSet": true, "protectWalletModalVisible": false, "seedphraseBackedUp": true, "userLoggedIn": true}, "wizard": {"step": 1}}

image

Related issues

Fixes: https://github.com/MetaMask/mobile-planning/issues/1843

Manual testing steps

  1. Go to this page...

Screenshots/Recordings

Before

After

Pre-merge author checklist

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.

@tommasini tommasini requested a review from a team as a code owner July 3, 2024 18:19
Copy link
Contributor

github-actions bot commented Jul 3, 2024

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

@tommasini tommasini added No QA Needed Apply this label when your PR does not need any QA effort. team-mobile-platform needs-dev-review PR needs reviews from other engineers (in order to receive required approvals) labels Jul 3, 2024
@tommasini
Copy link
Contributor Author

The failed quality gate do not seem accurate maskKey === undefined it's needed and not redundant!

@NicolasMassart
Copy link
Contributor

The failed quality gate do not seem accurate maskKey === undefined it's needed and not redundant!

The maskKey === undefined check might not be necessary if you want to handle it in the same way as false. So if you use maskKey == false both false and undefined values will be covered. At least that's my understanding.

@tommasini
Copy link
Contributor Author

That would mean that maskKey == false would cover for both? It's not what it seems, but most likely !maskKey would cover for both, but since there is an else scenario, Im not sure if we should do that, we are not accounting for key that are null or empty strings or 0, those values would fall into the else and throw an error!

image

I bring that method from extension

app/util/sentry/utils.js Outdated Show resolved Hide resolved
app/util/sentry/utils.js Outdated Show resolved Hide resolved
app/util/sentry/utils.js Show resolved Hide resolved
app/util/sentry/utils.js Show resolved Hide resolved
app/util/sentry/utils.js Show resolved Hide resolved
app/util/sentry/utils.test.ts Outdated Show resolved Hide resolved
app/util/sentry/utils.test.ts Outdated Show resolved Hide resolved
app/util/sentry/utils.js Outdated Show resolved Hide resolved
app/util/sentry/utils.test.ts Outdated Show resolved Hide resolved
@codecov-commenter
Copy link

codecov-commenter commented Jul 9, 2024

Codecov Report

Attention: Patch coverage is 66.66667% with 7 lines in your changes missing coverage. Please review.

Project coverage is 49.68%. Comparing base (ea14ef7) to head (bb06e5c).
Report is 29 commits behind head on main.

Files Patch % Lines
app/util/sentry/utils.js 66.66% 7 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #10241      +/-   ##
==========================================
+ Coverage   49.50%   49.68%   +0.17%     
==========================================
  Files        1438     1450      +12     
  Lines       34674    34909     +235     
  Branches     3853     3950      +97     
==========================================
+ Hits        17166    17344     +178     
- Misses      16426    16463      +37     
- Partials     1082     1102      +20     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@jpcloureiro jpcloureiro self-requested a review July 9, 2024 15:26
app/util/sentry/utils.js Outdated Show resolved Hide resolved
app/util/sentry/utils.test.ts Show resolved Hide resolved
app/util/sentry/utils.js Show resolved Hide resolved
app/util/sentry/utils.js Outdated Show resolved Hide resolved
app/util/sentry/utils.js Outdated Show resolved Hide resolved
app/util/sentry/utils.js Show resolved Hide resolved
app/util/sentry/utils.js Outdated Show resolved Hide resolved
app/util/sentry/utils.js Outdated Show resolved Hide resolved
@tommasini
Copy link
Contributor Author

@jpcloureiro Thanks for the review!!!! I believe I addressed/answered everything!

@jpcloureiro jpcloureiro self-requested a review July 11, 2024 10:40
jpcloureiro
jpcloureiro previously approved these changes Jul 11, 2024
Copy link
Contributor

@jpcloureiro jpcloureiro left a comment

Choose a reason for hiding this comment

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

lgtm

NicolasMassart
NicolasMassart previously approved these changes Jul 12, 2024
Copy link
Contributor

@NicolasMassart NicolasMassart left a comment

Choose a reason for hiding this comment

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

Looks good to me.

Copy link
Contributor

@NicolasMassart NicolasMassart left a comment

Choose a reason for hiding this comment

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

Looks good to me.

Copy link

sonarqubecloud bot commented Jul 12, 2024

@sethkfman sethkfman removed the needs-dev-review PR needs reviews from other engineers (in order to receive required approvals) label Jul 15, 2024
@sethkfman sethkfman merged commit 70d0fcc into main Jul 15, 2024
34 checks passed
@sethkfman sethkfman deleted the chore/1843-sentry-snapshot branch July 15, 2024 22:14
@github-actions github-actions bot locked and limited conversation to collaborators Jul 15, 2024
@metamaskbot metamaskbot added the release-7.28.0 Issue or pull request that will be included in release 7.28.0 label Jul 15, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
No QA Needed Apply this label when your PR does not need any QA effort. release-7.28.0 Issue or pull request that will be included in release 7.28.0 team-mobile-platform
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

6 participants