Skip to content
This repository was archived by the owner on Sep 11, 2026. It is now read-only.

chore: bump @ts-bridge/cli to v0.6.4 and drop unused shims - #320

Closed
cryptodev-2s wants to merge 1 commit into
migrate/pr2e-jest30from
migrate/pr2f-tsbridge
Closed

cryptodev-2s wants to merge 1 commit into
migrate/pr2e-jest30from
migrate/pr2f-tsbridge

Conversation

@cryptodev-2s

@cryptodev-2s cryptodev-2s commented Sep 4, 2026 •

Copy link
Copy Markdown
Contributor

Top of stack #315, on #319.

Dep From To
@ts-bridge/cli ^0.1.2 ^0.6.4
@ts-bridge/shims ^0.1.1 removed

Output diff

This builds the published artifacts, so dist/ was diffed rather than just checked for a zero exit. 216 files before and after, none added or removed, and only two changed:

versions.mjs switches from a default import plus destructuring to direct named imports:

- import $semver from "semver";
- const { gt: gtSemver, ... } = $semver;
+ import { gt as gtSemver, ... } from "semver";

semver is CJS, so this now leans on Node's cjs-module-lexer resolving those names.

logging.mjs gains an $importDefault helper honouring __esModule when importing debug, which is more correct than the old plain default import.

Why that needed checking by hand

The semver change cannot be caught by the test suite: tests run against src/ through ts-jest and never touch dist/. If the lexer failed to resolve a name, it would surface as a runtime SyntaxError for consumers, not a test failure.

So both entry points were imported directly from the built output, in ESM and CJS, on every Node version we support:

Node ESM CJS
18.20.6 pass pass
20.20.2 pass pass
22.22.1 pass pass
24.20.0 pass pass

Dropping shims

@ts-bridge/shims was never referenced by src/ or by the build output, and core does not carry it. Removing it produces a byte identical dist/.


Note

Medium Risk
Build-tool upgrade can change published dist/ ESM/CJS interop at runtime without failing existing unit tests.

Overview
Upgrades the ts-bridge build dev dependency from ^0.1.2 to ^0.6.4 and drops @ts-bridge/shims, which was not referenced by source or scripts. The lockfile picks up the new CLI stack (@ts-bridge/resolver, cjs-module-lexer) and drops resolve.exports.

The newer CLI emits slightly different dist/ interop for CommonJS dependencies (e.g. named imports from semver, safer default imports for debug via __esModule). That behavior is not exercised by Jest against src/, so reviewers should treat a clean rebuild and smoke imports of built entry points as the main validation signal alongside this dependency bump.

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

@socket-security

socket-security Bot commented Sep 4, 2026 •

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Updated@​ts-bridge/​cli@​0.1.2 ⏵ 0.6.483 +510080 +281100

View full report

@socket-security

socket-security Bot commented Sep 4, 2026 •

Copy link
Copy Markdown

Warning

MetaMask internal reviewing guidelines:

  • Do not ignore-all
  • Each alert has instructions on how to review if you don't know what it means. If lost, ask your Security Liaison or the supply-chain group
  • Copy-paste ignore lines for specific packages or a group of one kind with a note on what research you did to deem it safe.
    @SocketSecurity ignore npm/PACKAGE@VERSION
Action Severity Alert  (click "▶" to expand/collapse)
Warn Low
Potential code anomaly (AI signal): npm cjs-module-lexer is 66.0% likely to have a medium risk anomaly

Notes: This module is a WebAssembly-backed parser wrapper that extracts export/re-export identifiers from a source string. The most significant security issue is that it calls (0, eval) on substrings derived from the input whenever they begin with quotes, creating a potential arbitrary code execution risk if an attacker can influence the parsed source. It also throws errors that embed excerpts/line context from the input, which may leak source content into logs or consuming applications. No clear indicators of network exfiltration or system-level malware behavior are visible in this JS wrapper alone, but the eval usage warrants strong scrutiny and sandboxing or removal of dynamic evaluation.

Confidence: 0.66

Severity: 0.65

From: package.json → npm/@ts-bridge/cli@0.6.4 → npm/cjs-module-lexer@1.4.3

ℹ Read more on: This package | This alert | What is an AI-detected potential code anomaly?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: An AI system found a low-risk anomaly in this package. It may still be fine to use, but you should check that it is safe before proceeding.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/cjs-module-lexer@1.4.3. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

View full report

@cryptodev-2s
cryptodev-2s force-pushed the migrate/pr2f-tsbridge branch 2 times, most recently from 124f717 to 743cee8 Compare September 4, 2026 12:02
@cryptodev-2s
cryptodev-2s force-pushed the migrate/pr2f-tsbridge branch 2 times, most recently from 743cee8 to 361c13c Compare September 7, 2026 12:31
@cryptodev-2s
cryptodev-2s removed this pull request from stack #329 September 9, 2026 11:46
@cryptodev-2s
cryptodev-2s added this pull request to stack #331 September 9, 2026 11:47
@Mrtenz

Mrtenz commented Sep 10, 2026

Copy link
Copy Markdown
Member

We don't use ts-bridge anymore in core. Do we still need to do this here?

  @ts-bridge/cli    ^0.1.2  -> ^0.6.4
  @ts-bridge/shims  ^0.1.1  -> removed

This builds the published artifacts, so the output was diffed rather than
just checked for a zero exit. 216 files before and after, none added or
removed, and only two of them changed:

  versions.mjs  switches from a default import of semver plus destructuring
                to direct named imports. semver is CJS, so this now leans on
                Node's cjs-module-lexer resolving the names.

  logging.mjs   gains an $importDefault helper that honours __esModule when
                importing debug, which is more correct than the old plain
                default import.

The semver change is the risky one, and the test suite cannot catch it
because tests run against src/ through ts-jest, never against dist/. Both
entry points were therefore imported directly from the built output on Node
18, 20, 22 and 24, in ESM and CJS. All pass, so the named imports resolve
everywhere we support.

@ts-bridge/shims was never referenced by src/ or by the build output, and
core does not carry it. Removing it produces a byte identical dist/.
@cryptodev-2s
cryptodev-2s removed this pull request from stack #331 September 10, 2026 10:40
@cryptodev-2s
cryptodev-2s deleted the migrate/pr2f-tsbridge branch September 10, 2026 10:42
cryptodev-2s added a commit that referenced this pull request Sep 10, 2026
Top of stack #315, on #320. Last of the PR#2 bumps.

| Dep | From | To |
| --- | --- | --- |
| `@ethereumjs/tx` | `^4.2.0` | `^5.4.0` |

## This is not breaking, but only because of a one word change

The bump compiles with **no source change at all**, which is the trap.
`@ethereumjs/tx@5` reuses the name `TxData` for something entirely
different:

```ts
// v4
interface TxData { nonce?, gasPrice?, gasLimit?, to?, value?, data?, v?, r?, s? }

// v5
interface TxData {
  [TransactionType.Legacy]: LegacyTxData;
  [TransactionType.AccessListEIP2930]: AccessListEIP2930TxData;
  ...
}
```

v4's meaning is now called `LegacyTxData`. `keyring.ts` declares
`signTransaction` as returning `Promise<TxData>`, so bumping alone would
silently change that public type from "a signed legacy transaction" into
"an object carrying every transaction type at once", **and still build
clean**.

Typechecking a v4 era consumer against the unpatched build confirms it:

```
Type '{ nonce, gasPrice, gasLimit, to, value, data, v, r, s }' is missing the following
properties from type 'TxData': [TransactionType.Legacy], [TransactionType.AccessListEIP2930], ...
```

Mapping `TxData` to `LegacyTxData` restores the original contract
exactly, and that same consumer typechecks again.

`TypedTxData` would also accept it, but it is a union, so callers would
have to narrow the result. `LegacyTxData` keeps the API identical to v4.

Note `Keyring` is already deprecated in favour of
`@metamask/keyring-utils`, so the blast radius is small either way.

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Medium Risk**
> Touches transaction typing on a deprecated but public Keyring API; the
explicit LegacyTxData fix avoids a silent type break, but downstream
packages must align with @ethereumjs/tx v5.
> 
> **Overview**
> Upgrades **`@ethereumjs/tx`** from `^4.2.0` to **`^5.4.0`** (with
transitive bumps to `@ethereumjs/common`, `util`, `rlp`, and related
crypto packages in the lockfile).
> 
> Because v5 redefines **`TxData`** as a per–transaction-type map
instead of a single legacy field bag, the deprecated
**`Keyring.signTransaction`** return type is updated from
**`Promise<TxData>`** to **`Promise<LegacyTxData>`**, preserving the
same runtime shape and v4-era TypeScript contract for consumers. No
implementation changes are required for keyring authors.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
7d78cba. 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 subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants