You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If a developer extends Object.prototype in their project by adding a custom function, this property gets copied into the ParamType object during its creation. This results in breaking the checkType method, as it attempts to process the inherited property as part of the expected data.
Proposed solution:
Add a filter using Object.prototype.hasOwnProperty to ensure only the object's own properties are processed when creating ParamType or invoking checkType. This will prevent inherited properties from being mistakenly copied.
Additional information:
In version 5, the similar issue also causes an error during RPC requests:
Error: could not detect network (event="noNetwork", code=NETWORK_ERROR, version=providers/5.7.0)
This occurs because the chainId cannot be retrieved due to an incorrect header object that includes a custom prototype property. Fixing the header iteration logic as described above will also resolve this issue. It can be fixed by
replacing number 1:
for (var key of [...Object.getOwnPropertyNames(connection.headers), ...Object.getOwnPropertySymbols(connection.headers)]) {
Ethers Version
6.13.4
Search Terms
utils, properties, defineProperties, ParamType, checkType, keys
Describe the Problem
Description:
If a developer extends
Object.prototype
in their project by adding a custom function, this property gets copied into the ParamType object during its creation. This results in breaking thecheckType
method, as it attempts to process the inherited property as part of the expected data.Proposed solution:
Add a filter using
Object.prototype.hasOwnProperty
to ensure only the object's own properties are processed when creatingParamType
or invokingcheckType
. This will prevent inherited properties from being mistakenly copied.Additional information:
In version 5, the similar issue also causes an error during RPC requests:
This occurs because the
chainId
cannot be retrieved due to an incorrect header object that includes a custom prototype property. Fixing the header iteration logic as described above will also resolve this issue. It can be fixed byCode Snippet
Environment
No response
Environment (Other)
No response
The text was updated successfully, but these errors were encountered: