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

Fixes CVE-2024-42459 #168

Merged
merged 3 commits into from
Oct 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .mocharc.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
require:
- "./test/setup.mjs"
import: "tsx"
exit: true
timeout: 0
spec: "test/**/*.test.ts"
Expand Down
4,499 changes: 2,325 additions & 2,174 deletions package-lock.json

Large diffs are not rendered by default.

35 changes: 17 additions & 18 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,39 +29,38 @@
"@toruslabs/eccrypto": "^5.0.4",
"@toruslabs/http-helpers": "^7.0.0",
"bn.js": "^5.2.1",
"elliptic": "^6.5.6",
"elliptic": "^6.5.7",
"ethereum-cryptography": "^2.2.1",
"json-stable-stringify": "^1.1.1",
"loglevel": "^1.9.1"
"loglevel": "^1.9.2"
},
"devDependencies": {
"@babel/register": "^7.24.6",
"@babel/runtime": "^7.25.0",
"@babel/register": "^7.25.7",
"@babel/runtime": "^7.25.7",
"@toruslabs/config": "^2.2.0",
"@toruslabs/eslint-config-typescript": "^3.3.3",
"@toruslabs/eslint-config-typescript": "^3.3.4",
"@toruslabs/fetch-node-details": "^14.0.1",
"@toruslabs/torus-scripts": "^6.1.1",
"@types/chai": "^4.3.17",
"@toruslabs/torus-scripts": "^6.1.5",
"@types/chai": "^5.0.0",
"@types/elliptic": "^6.4.18",
"@types/faker": "^5.5.3",
"@types/json-stable-stringify": "^1.0.36",
"@types/jsonwebtoken": "^9.0.6",
"@types/mocha": "^10.0.7",
"@types/jsonwebtoken": "^9.0.7",
"@types/mocha": "^10.0.9",
"@types/sinon": "^17.0.3",
"chai": "^4.3.10",
"chai": "^5.1.1",
"cross-env": "^7.0.3",
"dotenv": "^16.4.5",
"eslint": "^8.57.0",
"faker": "^5.5.3",
"husky": "^9.1.4",
"@faker-js/faker": "^9.0.3",
"husky": "^9.1.6",
"jsonwebtoken": "^9.0.2",
"lint-staged": "^15.2.8",
"mocha": "^10.7.0",
"lint-staged": "^15.2.10",
"mocha": "^10.7.3",
"prettier": "^3.3.3",
"rimraf": "^6.0.1",
"sinon": "^18.0.0",
"ts-node": "^10.9.2",
"typescript": "^5.5.4"
"sinon": "^19.0.2",
"tsx": "^4.19.1",
"typescript": "^5.6.3"
},
"repository": {
"type": "git",
Expand Down
2 changes: 1 addition & 1 deletion test/aqua.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { faker } from "@faker-js/faker";
import { TORUS_LEGACY_NETWORK } from "@toruslabs/constants";
import { NodeDetailManager } from "@toruslabs/fetch-node-details";
import BN from "bn.js";
import { expect } from "chai";
import faker from "faker";

import { keccak256, TorusPublicKey } from "../src";
import TorusUtils from "../src/torus";
Expand Down
2 changes: 1 addition & 1 deletion test/celeste.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { faker } from "@faker-js/faker";
import { TORUS_LEGACY_NETWORK } from "@toruslabs/constants";
import { NodeDetailManager } from "@toruslabs/fetch-node-details";
import BN from "bn.js";
import { expect } from "chai";
import faker from "faker";

import { keccak256 } from "../src";
import TorusUtils from "../src/torus";
Expand Down
2 changes: 1 addition & 1 deletion test/cyan.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { faker } from "@faker-js/faker";
import { TORUS_LEGACY_NETWORK } from "@toruslabs/constants";
import { NodeDetailManager } from "@toruslabs/fetch-node-details";
import BN from "bn.js";
import { expect } from "chai";
import faker from "faker";

import { keccak256 } from "../src";
import TorusUtils from "../src/torus";
Expand Down
2 changes: 1 addition & 1 deletion test/mainnet.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { faker } from "@faker-js/faker";
import { TORUS_LEGACY_NETWORK } from "@toruslabs/constants";
import { NodeDetailManager } from "@toruslabs/fetch-node-details";
import BN from "bn.js";
import { expect } from "chai";
import faker from "faker";

import { keccak256 } from "../src";
import TorusUtils from "../src/torus";
Expand Down
2 changes: 1 addition & 1 deletion test/onekey.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { faker } from "@faker-js/faker";
import { TORUS_LEGACY_NETWORK } from "@toruslabs/constants";
import { NodeDetailManager } from "@toruslabs/fetch-node-details";
import BN from "bn.js";
import { expect } from "chai";
import faker from "faker";

import { keccak256, TorusPublicKey } from "../src";
import TorusUtils from "../src/torus";
Expand Down
2 changes: 1 addition & 1 deletion test/sapphire_devnet.test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { faker } from "@faker-js/faker";
import { TORUS_LEGACY_NETWORK, TORUS_SAPPHIRE_NETWORK } from "@toruslabs/constants";
import { NodeDetailManager } from "@toruslabs/fetch-node-details";
import BN from "bn.js";
import { expect } from "chai";
import { ec as EC } from "elliptic";
import faker from "faker";

import { generatePrivateKey, keccak256 } from "../src";
import TorusUtils from "../src/torus";
Expand Down
2 changes: 1 addition & 1 deletion test/sapphire_devnet_ed25519.test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { faker } from "@faker-js/faker";
import { bs58 as base58 } from "@toruslabs/bs58";
import { TORUS_SAPPHIRE_NETWORK } from "@toruslabs/constants";
import { NodeDetailManager } from "@toruslabs/fetch-node-details";
import BN from "bn.js";
import { expect } from "chai";
import faker from "faker";

import { keccak256 } from "../src";
import TorusUtils from "../src/torus";
Expand Down
2 changes: 1 addition & 1 deletion test/sapphire_mainnet.test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { faker } from "@faker-js/faker";
import { TORUS_SAPPHIRE_NETWORK } from "@toruslabs/constants";
import { NodeDetailManager } from "@toruslabs/fetch-node-details";
import BN from "bn.js";
import { expect } from "chai";
import { ec as EC } from "elliptic";
import faker from "faker";

import { generatePrivateKey, keccak256 } from "../src";
import TorusUtils from "../src/torus";
Expand Down
18 changes: 0 additions & 18 deletions test/setup.mjs

This file was deleted.

4 changes: 2 additions & 2 deletions test/testnet.test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { faker } from "@faker-js/faker";
import { TORUS_LEGACY_NETWORK } from "@toruslabs/constants";
import { NodeDetailManager } from "@toruslabs/fetch-node-details";
import { fail } from "assert";
import BN from "bn.js";
import { expect } from "chai";
import faker from "faker";
import { useFakeTimers } from "sinon";

import { keccak256, TorusPublicKey } from "../src";
Expand Down Expand Up @@ -287,7 +287,7 @@ describe("torus utils migrated testnet on sapphire", function () {
});

it("should pass at get pub nonce when system time is incorrect", async function () {
const clock = useFakeTimers();
const clock = useFakeTimers({ toFake: ["Date"] });
const fakeTime = new Date("2023-05-05T12:00:00").getTime();

// Mock the system clock time to be a specific time
Expand Down
2 changes: 1 addition & 1 deletion test/tssPubKey.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { faker } from "@faker-js/faker";
import { TORUS_SAPPHIRE_NETWORK } from "@toruslabs/constants";
import { NodeDetailManager } from "@toruslabs/fetch-node-details";
import { expect } from "chai";
import faker from "faker";

import { GetOrSetTssDKGPubKey } from "../src";

Expand Down