-
Notifications
You must be signed in to change notification settings - Fork 773
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
Address security vulnerabilities #2912
Changes from all commits
0eea681
43f2f3d
24cfa59
31d9702
2829e87
8d787b0
5c7242b
877dc20
95f3307
b09e40a
1332042
fedd246
59a46a2
f22bc58
f51119a
11b250f
791255b
81e4ed0
e8ed662
35228cf
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
declare module 'multiaddr/src/convert.js' |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,15 +2,14 @@ import { RLP } from '@ethereumjs/rlp' | |
import { bytesToUtf8, utf8ToBytes } from '@ethereumjs/util' | ||
import { base32, base64url } from '@scure/base' | ||
import { ecdsaVerify } from 'ethereum-cryptography/secp256k1-compat.js' | ||
import { Multiaddr } from 'multiaddr' | ||
import { protocols } from 'multiaddr' | ||
import { toString } from 'multiaddr/src/convert.js' | ||
import { sscanf } from 'scanf' | ||
|
||
import { keccak256, toNewUint8Array } from '../util.js' | ||
|
||
import type { PeerInfo } from '../types.js' | ||
|
||
const Convert = require('multiaddr/src/convert') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah, another require gone, great! 😃 |
||
|
||
type ProtocolCodes = { | ||
ipCode: number | ||
tcpCode: number | ||
|
@@ -83,9 +82,9 @@ export class ENR { | |
const { ipCode, tcpCode, udpCode } = this._getIpProtocolConversionCodes(obj.id) | ||
|
||
const peerInfo: PeerInfo = { | ||
address: Convert.toString(ipCode, obj.ip) as string, | ||
tcpPort: Number(Convert.toString(tcpCode, toNewUint8Array(obj.tcp))), | ||
udpPort: Number(Convert.toString(udpCode, toNewUint8Array(obj.udp))), | ||
address: toString(ipCode, obj.ip) as string, | ||
tcpPort: Number(toString(tcpCode, toNewUint8Array(obj.tcp))), | ||
udpPort: Number(toString(udpCode, toNewUint8Array(obj.udp))), | ||
} | ||
|
||
return peerInfo | ||
|
@@ -185,19 +184,19 @@ export class ENR { | |
|
||
switch (bytesToUtf8(protocolId)) { | ||
case 'v4': | ||
ipCode = Multiaddr.protocols.names.ip4.code | ||
ipCode = protocols(4).code | ||
break | ||
case 'v6': | ||
ipCode = Multiaddr.protocols.names.ip6.code | ||
ipCode = protocols(41).code | ||
break | ||
default: | ||
throw new Error("IP protocol must be 'v4' or 'v6'") | ||
} | ||
|
||
return { | ||
ipCode, | ||
tcpCode: Multiaddr.protocols.names.tcp.code, | ||
udpCode: Multiaddr.protocols.names.udp.code, | ||
tcpCode: protocols('tcp').code, | ||
udpCode: protocols('udp').code, | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -61,7 +61,6 @@ | |
}, | ||
"devDependencies": { | ||
"@ethereumjs/genesis": "0.1.0-rc.1", | ||
"0x": "^4.9.1", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am personally ok with dropping the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it wasn't in use anywhere that i could find 🤷 and it was responsible for like 9 vulnerabilities 😆 |
||
"@types/benchmark": "^1.0.33", | ||
"abstract-level": "^1.0.3", | ||
"level": "^8.0.0", | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe @acolytec3 can confirm, but we removed libp2p completely from the core build, so I would think these two dependencies shouldn't show up here at all? 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Depends on how we're using
peer-id
. That library got radically changed a while back so you might need that factory for even our limited usage.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mostly found in
client/libp2pBrowserBuild