Skip to content

chore(deps): drop 16 dependencies that nothing in the repo references - #167

Open
Shitikyan wants to merge 4 commits into
mainfrom
chore/deps-audit
Open

Shitikyan wants to merge 4 commits into
mainfrom
chore/deps-audit

Conversation

@Shitikyan

@Shitikyan Shitikyan commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

First step of the dependency clean-up that the pre-launch audit asked for. Consumers of @kynesyslabs/demosdk (wallet extension, incentives) inherit hundreds of advisories from this package's tree; bun audit on this repo reports 223 findings (8 critical), 187 of them in the production closure of 1777 packages (about 1.1 GB).

This PR removes 16 direct dependencies with no import, require, config, script, export or peer reference anywhere in the repository: @coral-xyz/anchor (Solana uses @project-serum/anchor), @metaplex-foundation/js, @roamhq/wrtc, simple-peer and its types, @simplewebauthn/server and /browser, sigstore, falcon-js, mlkem, ntru, pqcrypto, sphincs (Falcon is falcon-sign, ML-DSA/ML-KEM are @noble/post-quantum, SHA-3 is @noble/hashes), js-sha3, libsodium-wrappers-sumo, lodash. Production closure 1777 → 1583 packages, about 100 MB less per install; audit 223 → 209 (critical 8 → 7). No remaining package changes its resolved version; only hoisting moves in bun.lock. superdilithium stays because the typedoc workflow patches it.

Verified on a clean bun install --frozen-lockfile of the commit: build OK, tsc --noEmit clean, all 41 exports targets present and the 37 non-wildcard ones importable under node, pqc.spec 18/18 (ml-dsa, falcon, ml-kem, sha3), txSignatureDomain.spec 8/8. test:package-esm (npm pack install) left to CI.

Next steps, each needing a product decision (full audit in the review notes): rubic-sdk is an optionalDependency, installed by default by every consumer, used only by the bridge/rubic subpath, and alone accounts for 935 packages, 516 MB, 49 findings and 4 of the 6 critical ones; moving it to an optional peer takes the closure to about 500 packages and 94 findings. A lockfile refresh within current ranges takes this repo's own audit from 223 to 96. @ton/core should move to ^0.63 to match @ton/ton 16. cosmjs 0.32 → 0.39 drops the last critical (protobufjs 6.11). The dead ten.ts module is the only user of web3.

Lockfile refresh (second part of this PR). bun.lock is regenerated within the declared ranges (kept at lockfileVersion 1 so the bun 1.2.19 pinned in CI still reads it): lodash → 4.18.1, tmp → 0.2.7, fast-xml-parser no longer resolves, xrpl → 3.2.0, tronweb → 6.5.1, @ton/core → ^0.63.0 (required by @ton/ton 16). bun audit on this repo goes 223 → 56 findings (critical 8 → 3; the remaining ones are protobufjs 6.11 via cosmjs/ics23 and the rubic-sdk tree, which are the next plan items). Two consumer-facing notes: the direct axios range moves to ^1.20.0 and an overrides entry pins axios to that range, because tronweb 6.5.1 pins axios 1.18.0 (GHSA-r4gj-5m52-g5wh); the override applies only to installs of this repository, so consumers keep tronweb's nested copy until tronweb moves. jest.config.ts now transforms nested @noble/@scure copies (xrpl 3.2.0 pulls an ESM-only @noble/hashes). Verified: frozen installs with bun 1.2.19 and 1.4, build, tsc, exports, pqc/txSignatureDomain/xrpl specs; the packed-ESM (Node 20 and 22) and messaging packed-consumer CI jobs pass.

Supply-chain note on the refreshed lock. bitcoinjs-lib 6.1.9 and bip39 3.1.2 were published on 2026-10-13 by a new npm publisher without provenance attestations. Both tarballs were diffed against 6.1.7 / 3.1.0 before this PR: only hardening changes (bip39 entropy-hex validation and a wordlist hasOwnProperty guard; bitcoinjs-lib Merkle mutation check, PSBT cache invalidation, UTXO consistency check in getUtxoForInput), no install scripts, no network access, no new dependencies. A BTC PSBT sign smoke test is worth running before the next release.

@coral-xyz/anchor, @metaplex-foundation/js, @roamhq/wrtc, simple-peer,
@types/simple-peer, @simplewebauthn/server, @simplewebauthn/browser,
sigstore, falcon-js, mlkem, ntru, pqcrypto, sphincs, js-sha3,
libsodium-wrappers-sumo and lodash have no import, require, config or
script reference anywhere in the repository. Falcon is implemented with
falcon-sign and ML-DSA / ML-KEM with @noble/post-quantum, which stay.

The lockfile was regenerated without installing; no remaining package
changes its resolved version (only hoisting moves). bun.lock entries go
from 2118 to 1926 and the production closure from 1777 to 1583
packages, about 100 MB less for every consumer. superdilithium stays
because the typedoc workflow patches it; dotenv stays for the jest setup.

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Claude Code Review

This repository is configured for manual code reviews. Comment @claude review for a one-time review, or @claude review always to subscribe this PR to a review on every future push.

Tip: disable this comment in your organization's Code Review settings.

@qodo-code-review

Copy link
Copy Markdown
Contributor

ⓘ Qodo reviews are paused because the subscription is no longer active. Ask your workspace admin to reactivate the subscription to resume reviews. Manage billing

@coderabbitai

coderabbitai Bot commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 55f951e3-87a3-477a-8abb-9fdb49f55caa
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@greptile-apps

greptile-apps Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[High impact] The latest changes appear safe to merge, with the previous npm install blocker fixed.

Summary

Removes 16 unused direct dependencies, refreshes bun.lock, and lets Jest transform nested @noble and @scure packages.

  • The SDK installs fewer packages by dropping unused direct dependencies.
  • TON Core and Axios use newer declared version ranges.
  • Jest transforms nested copies of Noble and Scure packages.

Reviews (4) · Last reviewed commit: "fix(deps): make the axios override match..." · Reviewed by Greptile

Re-resolve bun.lock inside the existing package.json ranges. No declared
range changed except @ton/core (below), so the published dependency
metadata is unchanged. Lockfile entries drop from 2118 to 1842; 263
name@version identities are new or moved, 441 are gone.

Audit (bun audit, same advisory database): 223 findings (8 critical,
105 high, 96 moderate, 14 low) on main -> 80 (3 critical, 38 high,
36 moderate, 3 low).

Hoisting fix for the security gate: the copies the gate flagged as new
are now at fixed versions: lodash 4.18.1 (was 4.17.21), tmp 0.2.7 (was
0.2.5), fast-xml-parser no longer resolves at all. Against main's lock
no (package, advisory) pair is added by this change.

Override added: "tronweb": { "axios": "1.20.0" }. tronweb 6.5.1 (the
latest release) pins axios to exactly 1.18.0, which is affected by
GHSA-r4gj-5m52-g5wh (range >=1.17.0 <1.20.0) while the root axios
resolves to 1.20.0. Overrides only apply to installs of this repository;
consumers of the package still get tronweb's own pin until tronweb
moves.

@ton/core is raised from ^0.62.1 to ^0.63.0 because @ton/ton 16 declares
a peer range of >=0.63.0 <1.0.0; bun warned "incorrect peer dependency"
with 0.62.1. The lock now has @ton/core 0.63.1 and @ton/ton 16.3.0.

jest.config.ts: transformIgnorePatterns now also transforms @noble and
@Scure copies nested under another package. xrpl 3.2.0 pulls its own
@xrplf/isomorphic with an ESM-only @noble/hashes, which made every suite
that imports the multichain barrel fail with "Unexpected token export".

Checks in a clean archive of this commit: bun install --frozen-lockfile,
bun run build, tsc --noEmit, all 38 export targets exist and 37 import
(the remaining one is the wasm wildcard), pqc.spec, txSignatureDomain.spec
and xrpl.spec pass; ton.spec and ibc.spec fail on network access exactly
as on main.
Comment thread bun.lock Outdated
… a whole

The messaging-export workflow installs with bun 1.2.19 and --frozen-lockfile.
The previous commit's lockfile was written by bun 1.4 as lockfileVersion 3
with a nested override ("tronweb": { "axios": ... }), which bun 1.2.19 does
not parse ("Unknown lockfile version", then a frozen-lockfile failure).

- bun.lock is back to lockfileVersion 1 with the same resolutions. It was
  checked with bun 1.2.19 (bun install --frozen-lockfile) and with bun 1.4.
- The override is now flat: "axios": "1.20.0". Nested overrides are not
  understood by 1.2.19. tronweb 6.5.1 (the latest release) pins axios to
  exactly 1.18.0, which is affected by GHSA-r4gj-5m52-g5wh (range
  >=1.17.0 <1.20.0), and the old 0.2x axios copies inside rubic-sdk and
  its dependencies carry about 35 more advisories. One axios everywhere
  removes the advisory the gate reported as new and the old ones. Overrides
  apply to installs of this repository only; consumers resolve axios from
  the dependency ranges as before. All axios users here use the plain
  default-import request API, which is the same in 0.2x and 1.x.

bun audit on this lockfile: 223 findings on main -> 56 (3 critical,
28 high, 23 moderate, 2 low). Against main's lockfile no (package,
advisory) pair is added.
Comment thread package.json Outdated
npm pack (used by the packed-consumer checks) rejects an override that
differs from the direct dependency spec: "EOVERRIDE: Override for
axios@^1.16.1 conflicts with direct dependency". Use the same range in
both places: axios ^1.20.0 as the direct dependency and as the override.

Raising the direct floor to 1.20.0 also helps consumers, since axios
1.17 to 1.19 are affected by GHSA-r4gj-5m52-g5wh and several older
advisories; the resolved version in bun.lock stays 1.20.0, so nothing
else changes. The lockfile stays at lockfileVersion 1 and installs with
bun 1.2.19 and bun 1.4 under --frozen-lockfile.
@sonarqubecloud

Copy link
Copy Markdown

@hackobi hackobi added the request-chef-review Request an automated launch review at the current head label Oct 20, 2026
@hackobi

hackobi commented Oct 20, 2026

Copy link
Copy Markdown
Contributor

Automated launch review: safe at 310bebd

An automated reviewer checked this PR for the Demos mainnet launch, using public research on how established chains handle the same problem. Each finding cites the code at this head. If a finding is wrong, reply here with the reason.

  1. [low] Undeclared imports in IBC/multichain code (pre-existing, not introduced by this PR)

    ibc.ts imports @cosmjs/encoding, cosmjs-types, @cosmjs/crypto and @scure/bip32, and none of them is in package.json. They resolve only through hoisted transitive copies. This PR leaves those lock entries in place (ibc.ts is unchanged and no matching lock line is removed), so it introduces no regression. Strict or PnP installs could still break ./xmcore/ibc. Follow-up: declare these as direct dependencies.

    Code: src/multichain/core/ibc.ts:10-11, src/multichain/core/ibc.ts:24-26, package.json:119-120

  2. [low] axios overrides only applies to this repo's own install, not to npm consumers of the package

    npm applies overrides only at the root project, so consumers of the published tarball ignore it. Their axios floor comes only from the direct axios: ^1.20.0 dependency, while @ton/ton still declares ^1.15.0. The packed-consumer script does not check which axios version gets installed.

    Code: package.json:174-176, bun.lock:639-639

  3. [info] Lockfile refresh goes beyond the 16 removals

    bun.lock moves many resolved versions unrelated to the removals, e.g. @ton/ton 16.3.0 and libsodium-wrappers-sumo 0.8.4 now resolved for superdilithium's "*" range. This only affects the repo's own CI and dev installs; npm consumers resolve the ranges themselves. superdilithium is not imported by src, so the libsodium jump is not on a used signing path.

    Code: bun.lock:1627-1627, bun.lock:2107-2107

  4. [info] Stale NTRU reference in Enigma header comment

    The comment still lists NTRU as the encryption scheme. The code uses ML-KEM, and the ntru package is now dropped. This is documentation drift only.

    Code: src/encryption/PQC/enigma.ts:4-4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

request-chef-review Request an automated launch review at the current head

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants