-
-
Notifications
You must be signed in to change notification settings - Fork 201
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 controllers with missing or incorrect messenger action/event types #4633
Merged
Conversation
This file contains 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
8 tasks
AugmentedMode
approved these changes
Aug 23, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
3 tasks
packages/profile-sync-controller/src/controllers/user-storage/UserStorageController.ts
Show resolved
Hide resolved
MajorLift
added a commit
that referenced
this pull request
Aug 28, 2024
…ion/events (#4641) ## Explanation Fixes various errors in the `NotificationServicesPushController`: - [Define the `*:getState` action using the `ControllerGetStateAction` utility type](https://github.com/MetaMask/core/blob/add-controller-guidelines/docs/writing-controllers.md#define-the-getstate-action-using-the-controllergetstateaction-utility-type) - [Define the `*:stateChange` event using the `ControllerStateChangeEvent` utility type](https://github.com/MetaMask/core/blob/add-controller-guidelines/docs/writing-controllers.md#define-the-statechange-event-using-the-controllerstatechangeevent-utility-type) - [Define and export a type union for internal action types](https://github.com/MetaMask/core/blob/add-controller-guidelines/docs/writing-controllers.md#define-and-export-a-type-union-for-internal-action-types) - [Define and export a type union for internal event types](https://github.com/MetaMask/core/blob/add-controller-guidelines/docs/writing-controllers.md#define-and-export-a-type-union-for-internal-event-types) - [Define and export a type for the controller's messenger](https://github.com/MetaMask/core/blob/add-controller-guidelines/docs/writing-controllers.md#define-and-export-a-type-for-the-controllers-messenger) ## References - Fixes #4579 - See #4633 ## Changelog ### `@metamask/notification-services-controller` (major) ### Added - Add and export types `NotificationServicesPushControllerGetStateAction`, `NotificationServicesPushControllerStateChangeEvent` ([#4641](#4641)) ### Changed - **BREAKING:** Rename `NotificationServicesPushControllerPushNotificationClicked` type to `NotificationServicesPushControllerPushNotificationClickedEvent` ([#4641](#4641)) - **BREAKING:** Narrow `AllowedEvents` type for `NotificationServicesPushControllerMessenger` to `never` ([#4641](#4641)) - `NotificationServicesPushControllerMessenger` must allow internal event `NotificationServicesPushControllerStateChangeEvent` ([#4641](#4641)) ### Fixed - **BREAKING:** Fix package-level export for `NotificationServicesPushController` from "NotificationsServicesPushController" to "NotificationsServicesPushController" ([#4641](#4641)) - **BREAKING:** Replace incorrectly-defined `getState` action in the `Actions` type for `NotificationServicesPushControllerMessenger` with new `NotificationServicesPushControllerGetStateAction` type ([#4641](#4641)) ## Checklist - [x] I've updated the test suite for new or updated code as appropriate - [x] I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate - [x] I've highlighted breaking changes using the "BREAKING" category above as appropriate
AugmentedMode
added a commit
that referenced
this pull request
Aug 28, 2024
## Explanation ### Dependency Updates: - **BREAKING**: Added `@noble/hashes` dependency version `^1.4.0`. - **BREAKING**: Added `ethereum-cryptography` dependency version `^2.1.2`. These dependencies were added to support hashing C2 requests for comparison against a C2 blocklist, enhancing the security and cryptographic capabilities within the package. ## Changelog ### `@metamask/phishing-controller` #### Breaking - **BREAKING**: Added `@noble/hashes` dependency version `^1.4.0`. - **BREAKING**: Added `ethereum-cryptography` dependency version `^2.1.2`. - **BREAKING**: `PhishingControllerMessenger` must allow internal events defined in the `PhishingControllerEvents` type ([#4633](#4633)). #### Added - **ADDED**: Added the ability to block Client Side C2 Requests by managing a hashed C2 Request Blocklist. - **ADDED**: Defined and exported new types: `PhishingControllerGetStateAction`, `PhishingControllerStateChangeEvent`, `PhishingControllerEvents` ([#4633](#4633)). - Added `requestBlocklist` type to `ListTypes`. - **ADDED**: `isBlockedRequest` method to `PhishingController`. - **ADDED**: Logic to update and check `requestBlocklist` in `#updateStalelist`. - **ADDED**: `isMaliciousRequestDomain` method to `PhishingDetector`. - **ADDED**: Handling of `requestBlocklist` in `PhishingDetector` configuration. - **ADDED**: `sha256` and `toHex` imports from `ethereum-cryptography`. - **ADDED**: `sha256Hash` function to generate SHA-256 hash of a domain. - **ADDED**: Allowlist functionality to the C2 domain detection system. #### Changed - `PhishingControllerActions` is widened to include the `PhishingController:getState` action ([#4633](#4633)). - Bumped `@metamask/base-controller` from `^6.0.2` to `^6.0.3` ([#4625](#4625)). - Bumped `@metamask/controller-utils` from `^11.0.2` to `^11.1.0` ([#4639](#4639)). ## Checklist - [x] I've updated the test suite for new or updated code as appropriate. - [x] I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate. - [x] I've highlighted breaking changes using the "BREAKING" category above as appropriate. --------- Co-authored-by: Jongsun Suh <[email protected]>
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.
Explanation
Fixes controllers and messengers in the core repo that do not fulfill their intended specifications correctly:
*:getState
action using theControllerGetStateAction
utility type*:stateChange
event using theControllerStateChangeEvent
utility typeThis also resolves downstream errors in mobile caused by
composable-controller
expecting all of its child controllers to have astateChange
event.ComposableController
fix with no type error suppression metamask-mobile#10374References
@metamask/composable-controller
from^3.0.0
to^10.0.0
metamask-mobile#10441Changelog
@metamask/logging-controller
(major)@metamask/phishing-controller
(major)@metamask/notification-services-controller
(minor)@metamask/authentication-controller
(major)@metamask/user-storage-controller
(major)Checklist