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

chore: updating dependencies for elliptic advisory #912

Merged
merged 8 commits into from
Aug 5, 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: 3 additions & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@

- ci: removing headless browser tests pending a rewrite
- ci: changing token for creating release
- feat: replaces hdkey and bip32 implementations with `@scure/bip39` and `@scure/bip32` due to vulnerability and lack of maintenance for `elliptic`
- chore: bumps dev dependency versions to remove warnings
- chore: addresses eslint errors uncovered by bumping eslint version

### Added

Expand Down
10 changes: 4 additions & 6 deletions e2e/node/basic/identity.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import { Actor, SignIdentity } from '@dfinity/agent';
import { IDL } from '@dfinity/candid';
import { Principal } from '@dfinity/principal';
import {
DelegationChain,
Expand Down Expand Up @@ -28,7 +27,7 @@ function createSecpIdentity(seed: number): SignIdentity {
async function createIdentityActor(
seed: number,
canisterId: Principal,
idl: IDL.InterfaceFactory,
idl,
): Promise<any> {
const identity = createIdentity(seed);
const agent1 = await makeAgent({ identity });
Expand All @@ -40,7 +39,7 @@ async function createIdentityActor(

async function createSecp256k1IdentityActor(
canisterId: Principal,
idl: IDL.InterfaceFactory,
idl,
seed?: number,
): Promise<any> {
let seed1: Uint8Array | undefined;
Expand All @@ -59,10 +58,9 @@ async function createSecp256k1IdentityActor(

async function createEcdsaIdentityActor(
canisterId: Principal,
idl: IDL.InterfaceFactory,
idl,
identity?: SignIdentity,
): Promise<any> {
global.crypto;
let effectiveIdentity: SignIdentity;
if (identity) {
effectiveIdentity = identity;
Expand All @@ -80,7 +78,7 @@ async function createEcdsaIdentityActor(

async function installIdentityCanister(): Promise<{
canisterId: Principal;
idl: IDL.InterfaceFactory;
idl;
}> {
const { canisterId, idl } = await identityCanister();
return {
Expand Down
7 changes: 4 additions & 3 deletions e2e/node/basic/mainnet.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ const createWhoamiActor = async (identity: Identity) => {
const idlFactory = () => {
return IDL.Service({
whoami: IDL.Func([], [IDL.Principal], ['query']),
});
// eslint-disable-next-line @typescript-eslint/no-explicit-any
}) as unknown as any;
};
vi.useFakeTimers();
new Date(Date.now());
Expand Down Expand Up @@ -136,7 +137,7 @@ describe('call forwarding', () => {
requestId,
defaultStrategy(),
);
certificate; // Certificate
reply; // ArrayBuffer
expect(certificate).toBeTruthy();
expect(reply).toBeTruthy();
}, 15_000);
});
3 changes: 0 additions & 3 deletions e2e/node/basic/watermark.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ function indexOfQueryResponse(history: Response[]) {

test('basic', async () => {
const fetchProxy = new FetchProxy();
global.fetch;

const actor = await createActor({
fetch: fetchProxy.fetch.bind(fetchProxy),
Expand All @@ -60,7 +59,6 @@ test('basic', async () => {

test('replay queries only', async () => {
const fetchProxy = new FetchProxy();
global.fetch;

const actor = await createActor({
fetch: fetchProxy.fetch.bind(fetchProxy),
Expand All @@ -83,7 +81,6 @@ test('replay queries only', async () => {

test('replay attack', async () => {
const fetchProxy = new FetchProxy();
global.fetch;

const actor = await createActor({
verifyQuerySignatures: true,
Expand Down
5 changes: 2 additions & 3 deletions e2e/node/canisters/counter.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Actor, ActorSubclass, HttpAgentOptions, Agent } from '@dfinity/agent';
import { IDL } from '@dfinity/candid';
import { Principal } from '@dfinity/principal';
import { readFileSync } from 'fs';
import path from 'path';
Expand All @@ -12,7 +11,7 @@ let cache: {
actor: any;
} | null = null;

const idl: IDL.InterfaceFactory = ({ IDL }) => {
const idl = ({ IDL }) => {
return IDL.Service({
inc: IDL.Func([], [], []),
inc_read: IDL.Func([], [IDL.Nat], []),
Expand Down Expand Up @@ -58,7 +57,7 @@ export const createActor = async (options?: HttpAgentOptions, agent?: Agent) =>
if (!options?.host?.includes('icp-api')) {
await effectiveAgent.fetchRootKey();
}
} catch (_) {
} catch {
//
}

Expand Down
6 changes: 1 addition & 5 deletions e2e/node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
},
"devDependencies": {
"@peculiar/webcrypto": "^1.4.0",
"@trust/webcrypto": "^0.9.2",
"@tsconfig/node16": "^1.0.3",
"@tsconfig/node17": "^1.0.1",
"@types/base64-js": "^1.3.0",
Expand All @@ -34,16 +33,13 @@
"@typescript-eslint/parser": "^5.30.5",
"agent1": "npm:@dfinity/agent@^1.4.0",
"esbuild": "^0.15.16",
"eslint": "^8.19.0",
"eslint-plugin-jsdoc": "^39.3.3",
"isomorphic-fetch": "^3.0.0",
"locus": "^2.0.4",
"node-webcrypto-p11": "^2.5.0",
"size-limit": "^8.2.6",
"text-encoding": "^0.7.0",
"ts-node": "^10.8.2",
"typescript": "^5.2.2",
"vitest": "^0.34.6",
"webcrypto-core": "^1.7.5"
"vitest": "^0.34.6"
}
}
2 changes: 1 addition & 1 deletion e2e/node/utils/agent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export const makeAgent = async (options?: HttpAgentOptions) => {
});
try {
await agent.fetchRootKey();
} catch (_) {
} catch {
//
}
return agent;
Expand Down
Loading
Loading