Skip to content

refactor: add .js import extensions to Product Safety packages - #9620

Merged
Mrtenz merged 1 commit into
mainfrom
mrtenz/esm-import-extensions-product-safety
Jul 24, 2026
Merged

refactor: add .js import extensions to Product Safety packages#9620
Mrtenz merged 1 commit into
mainfrom
mrtenz/esm-import-extensions-product-safety

Conversation

@Mrtenz

@Mrtenz Mrtenz commented Jul 23, 2026

Copy link
Copy Markdown
Member

Summary

This PR adds .js import extensions to all relative imports in the
Product Safety packages, in preparation for the ESM refactor.

The ESLint rule that enforces this (n/file-extension-in-import +
import-x/extensions) has been added for these packages in
eslint.config.mjs.

Packages

  • @metamask/phishing-controller

Note

Low Risk
Mechanical import-path and tooling updates only; no changes to security-sensitive runtime logic in the phishing controller.

Overview
Prepares @metamask/phishing-controller for the ESM refactor by appending .js to every relative import/export across src/ (including tests, index.ts, and generated method-action types). No phishing, scanning, or caching behavior changes—only module specifiers.

eslint.config.mjs now includes packages/phishing-controller/** in the shared block that enforces n/file-extension-in-import and import-x/extensions. package.json messenger-action-type scripts gain the --esm flag so generated types stay aligned with ESM import paths.

Reviewed by Cursor Bugbot for commit 6476503. Bugbot is set up for automated code reviews on this repo. Configure here.

@Mrtenz
Mrtenz requested review from a team as code owners July 23, 2026 09:17
@Mrtenz
Mrtenz temporarily deployed to default-branch July 23, 2026 09:18 — with GitHub Actions Inactive
@Mrtenz
Mrtenz enabled auto-merge July 23, 2026 10:11
@Mrtenz
Mrtenz force-pushed the mrtenz/esm-import-extensions-product-safety branch from cde9818 to 6476503 Compare July 23, 2026 21:10
@Mrtenz
Mrtenz added this pull request to the merge queue Jul 24, 2026
Merged via the queue into main with commit 2b137f6 Jul 24, 2026
427 checks passed
@Mrtenz
Mrtenz deleted the mrtenz/esm-import-extensions-product-safety branch July 24, 2026 09:44
@adonesky1 adonesky1 mentioned this pull request Jul 31, 2026
4 tasks
pull Bot pushed a commit to Reality2byte/core that referenced this pull request Jul 31, 2026
## Explanation

Phishing controller

## [17.3.1]

### Changed

- Bump `@metamask/transaction-controller` from `^69.0.0` to `^69.4.0`
([MetaMask#9568](MetaMask#9568),
[MetaMask#9589](MetaMask#9589),
[MetaMask#9593](MetaMask#9593),
[MetaMask#9693](MetaMask#9693),
[MetaMask#9735](MetaMask#9735))

### Fixed

- Address poisoning known recipients now use the actual token recipient
decoded from calldata for confirmed ERC-20/ERC-721/ERC-1155 token
transfers, instead of the token contract address from `txParams.to`
([MetaMask#9699](MetaMask#9699))

### Notes for reviewers

**Why a patch.** Nothing here extends the package's surface area, so per
[reviewing-release-prs.md](https://github.com/MetaMask/core/blob/main/docs/processes/reviewing-release-prs.md#4-review-new-version-strings)
this lands on patch. The only code change since `17.3.0` is one line in
`PhishingController` (`transaction.txParams.to` →
`getEffectiveRecipient(transaction)`); the rest of the diff to this
package is `.js` import-extension churn from MetaMask#9620 and the Jest 30
migration. No new exports, types, or arguments.

The `@metamask/transaction-controller` range bump doesn't push this to a
minor either — the same doc lists "adding or upgrading a runtime
dependency" under "Everything else" rather than as an addition.

Note that `checkAddressPoisoning` output does shift in both directions:
lookalikes of the real ERC-20/721/1155 recipient now match, and
lookalikes of the token contract address no longer do. That's captured
in the `Fixed` entry above.

**`@metamask/transaction-controller` needs no release here.** The
`getEffectiveRecipient` export this fix depends on already shipped in
`69.4.0`, published as part of release 1163.0.0.

**Intentionally skipped.** `@metamask/address-book-controller`,
`@metamask/base-controller`, `@metamask/controller-utils`, and
`@metamask/messenger` all have unreleased changes and are dependencies
of `@metamask/phishing-controller`, so the release tool flagged them.
Their pending entries are pre-existing chore/refactor/deprecation work
unrelated to this fix (and still uncategorized), so releasing them is a
separate call for their codeowners.

**Dependent bumps.** `@metamask/assets-controller` and
`@metamask/assets-controllers` had their `@metamask/phishing-controller`
range bumped to `^17.3.1` by the release tooling; both are recorded in
their changelogs under `Unreleased`.

## References

- Releases the fix from MetaMask#9699
- Unblocks pulling the fix into the mobile and extension clients

## 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 communicated my changes to consumers by [updating changelogs
for packages I've
changed](https://github.com/MetaMask/core/tree/main/docs/contributing.md#updating-changelogs),
highlighting breaking changes as necessary
- [x] I've prepared draft pull requests for clients and consumer
packages to resolve any breaking changes

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Medium Risk**
> The released phishing-controller fix alters security-sensitive
address-poisoning heuristics for token transfers; this PR is
dependency/version churn but ships that behavior to extension/mobile
consumers.
> 
> **Overview**
> **Monorepo release 1167.0.0** publishes
**`@metamask/phishing-controller@17.3.1`** and wires consumers to that
version.
> 
> The new phishing-controller patch (documented in its changelog, not in
this diff’s source) fixes **address-poisoning “known recipient”
tracking** for confirmed ERC-20/721/1155 transfers: recipients are taken
from **decoded calldata via `getEffectiveRecipient`** instead of
**`txParams.to`** (the token contract). That can change which lookalike
warnings fire—real transfer recipients match; token contract addresses
no longer do.
> 
> **`@metamask/assets-controller`** and
**`@metamask/assets-controllers`** bump their
**`@metamask/phishing-controller`** dependency from **`^17.3.0`** to
**`^17.3.1`**, with matching **Unreleased** changelog entries.
**`yarn.lock`** and root **`package.json`** version are updated
accordingly.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
1f778f9. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants