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
{{ message }}
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.
disallow eth_subscribe on HTTP server.
Possibly mitigation for users until the code is changed: disable ws server (not possible in ganache-cli)
Connect using WS rather than HTTP.
Change client to not attempt to use subscriptions if connection is not WS.
Steps to Reproduce (for bugs)
docker run -it -v --rm --name ganache trufflesuite/ganache-cli:latest
From another terminal connect to ganache server by HTTP, make eth_subscribe request
After that trigger an event that subscription was listening to.
Observe server crash with stacktrace outline below.
The actual code for steps (2) and (3) in my case is rather complex, but I hope my verbal explanation, and links to the suspected code is sufficient :)
Context
Deploying test instances of Augur contracts using third-party code, and it appears that code subscribes to the ethereum node (possibly expecting that if we do it over HTTP, the subscription will fail, and it will back to polling).
After that when I attempt to use those contracts, Ganache server crashes due to orphaned subscription.
Your Environment
Linux.
Docker trufflesuite/ganache-cli:latest
Also trufflesuite/ganache-cli:v6.1.8
Also latest master of ganache-cli (590b856e9b2dfa92b9491925fcb663dcd4a355b2)
Stack trace:
TypeError: Cannot read property 'connection' of undefined
at ConnectionManager._updateSubscriptions (/src/node_modules/ganache-core/lib/webSocketServer.js:134:70)
at Provider.<anonymous> (/src/node_modules/ganache-core/lib/webSocketServer.js:32:31)
at emitTwo (events.js:126:13)
at Provider.emit (events.js:214:7)
at SubscriptionSubprovider.<anonymous> (/src/node_modules/ganache-core/lib/provider.js:48:10)
at emitTwo (events.js:126:13)
at SubscriptionSubprovider.emit (events.js:214:7)
at SubscriptionSubprovider._notificationHandler (/src/node_modules/ganache-core/node_modules/web3-provider-engine/subproviders/subscriptions.js:96:8)
at Array.forEach (<anonymous>)
at BlockFilter.<anonymous> (/src/node_modules/ganache-core/node_modules/web3-provider-engine/subproviders/subscriptions.js:62:15)
at emitOne (events.js:116:13)
at BlockFilter.emit (events.js:211:7)
at BlockFilter.update (/src/node_modules/ganache-core/node_modules/web3-provider-engine/subproviders/filters.js:319:8)
at emitOne (events.js:121:20)
at Web3ProviderEngine.emit (events.js:211:7)
at Web3ProviderEngine._setCurrentBlock (/src/node_modules/ganache-core/node_modules/web3-provider-engine/index.js:165:8)
at GanacheBlockTracker.Web3ProviderEngine.self._blockTracker.on (/src/node_modules/ganache-core/node_modules/web3-provider-engine/index.js:35:10)
at emitOne (events.js:121:20)
at GanacheBlockTracker.emit (events.js:211:7)
at GanacheBlockTracker._setCurrentBlock (/src/node_modules/ganache-core/lib/block_tracker.js:63:8)
at emitOne (events.js:116:13)
at BlockchainDouble.emit (events.js:211:7)
The text was updated successfully, but these errors were encountered:
Expected Behavior
eth_subscribe
to be rejected on HTTP connection with a message that it is only supported on websockets.Current Behavior
eth_subscribe
is accepted in http server and forwarded to provider: https://github.com/trufflesuite/ganache-core/blob/develop/lib/httpServer.js#L56TypeError: Cannot read property 'connection' of undefined
(see stack trace below): https://github.com/trufflesuite/ganache-core/blob/develop/lib/webSocketServer.js#L126Possible Solution
disallow
eth_subscribe
on HTTP server.Possibly mitigation for users until the code is changed: disable ws server (not possible in ganache-cli)
Connect using WS rather than HTTP.
Change client to not attempt to use subscriptions if connection is not WS.
Steps to Reproduce (for bugs)
docker run -it -v --rm --name ganache trufflesuite/ganache-cli:latest
eth_subscribe
requestThe actual code for steps (2) and (3) in my case is rather complex, but I hope my verbal explanation, and links to the suspected code is sufficient :)
Context
Deploying test instances of Augur contracts using third-party code, and it appears that code subscribes to the ethereum node (possibly expecting that if we do it over HTTP, the subscription will fail, and it will back to polling).
After that when I attempt to use those contracts, Ganache server crashes due to orphaned subscription.
Your Environment
Linux.
Docker
trufflesuite/ganache-cli:latest
Also
trufflesuite/ganache-cli:v6.1.8
Also latest master of
ganache-cli
(590b856e9b2dfa92b9491925fcb663dcd4a355b2)Stack trace:
The text was updated successfully, but these errors were encountered: