Open marcus-pousette opened 1 year ago
Low
Creating a libp2p instance with services that are undefined creates a null pointer exception even if it is allowed by the types
createLibp2p({ ..., services: { abc: undefined } })
To mitigate this I think there needs to be a null check before this https://github.com/libp2p/js-libp2p/blob/710da918a89b6f6ee5d03c0d14a311efd40a1b8f/src/libp2p.ts#L167 to check if createService is a function.
createService
I ended up with this error because I am generating different configs based on conditions, and this leads me to assign "undefined" to services relay occasionally
relay
Related: https://github.com/libp2p/js-libp2p/issues/1573
A runtime check seems reasonable but this really shouldn't be allowed by the types.
Will be closed by #2133 when that lands.
no new updates
Severity:
Low
Description:
Creating a libp2p instance with services that are undefined creates a null pointer exception even if it is allowed by the types
To mitigate this I think there needs to be a null check before this https://github.com/libp2p/js-libp2p/blob/710da918a89b6f6ee5d03c0d14a311efd40a1b8f/src/libp2p.ts#L167 to check if
createService
is a function.I ended up with this error because I am generating different configs based on conditions, and this leads me to assign "undefined" to services
relay
occasionally