[Snyk] Security upgrade web3 from 6.20.4 to 7.15.0#631
Open
revan-zhang wants to merge 1 commit intotouchfrom
Open
[Snyk] Security upgrade web3 from 6.20.4 to 7.15.0#631revan-zhang wants to merge 1 commit intotouchfrom
revan-zhang wants to merge 1 commit intotouchfrom
Conversation
The following vulnerabilities are fixed by pinning transitive dependencies: - https://snyk.io/vuln/SNYK-PYTHON-WEB3-15907867
Contributor
Author
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
| @@ -1,5 +1,5 @@ | |||
| hidapi >= 0.7.99.post20 | |||
| web3 >= 4.8 | |||
| web3>=7.15.0 | |||
There was a problem hiding this comment.
🔴 web3 version bumped to >=7.15.0 but code uses removed camelCase API methods
Bumping web3 to >=7.15.0 breaks all Ethereum CLI functionality because web3.py v7 removed all camelCase method aliases that the code depends on. I verified by installing web3 7.15.0 that isConnected, estimateGas, getTransactionCount, sendRawTransaction, encodeABI no longer exist (all return False for hasattr).
All broken call sites
python/src/trezorlib/cli/ethereum.py:158-159:contract.encodeABI(...)→ should becontract.encode_abi(...)python/src/trezorlib/cli/ethereum.py:393:_get_web3().isConnected()→ should be_get_web3().is_connected()python/src/trezorlib/cli/ethereum.py:428:.eth.estimateGas(...)→ should be.eth.estimate_gas(...)python/src/trezorlib/cli/ethereum.py:438:.eth.getTransactionCount(...)→ should be.eth.get_transaction_count(...)python/src/trezorlib/cli/ethereum.py:467:.eth.gasPrice→ should be.eth.gas_pricepython/src/trezorlib/cli/ethereum.py:522:.eth.sendRawTransaction(...)→ should be.eth.send_raw_transaction(...)python/src/trezorlib/cli/ethereum_onekey.py:143:contract.encodeABI(...)→ should becontract.encode_abi(...)python/src/trezorlib/cli/ethereum_onekey.py:280:_get_web3().isConnected()→ should be_get_web3().is_connected()python/src/trezorlib/cli/ethereum_onekey.py:306:.eth.estimateGas(...)→ should be.eth.estimate_gas(...)python/src/trezorlib/cli/ethereum_onekey.py:316:.eth.getTransactionCount(...)→ should be.eth.get_transaction_count(...)python/src/trezorlib/cli/ethereum_onekey.py:339:.eth.gasPrice→ should be.eth.gas_pricepython/src/trezorlib/cli/ethereum_onekey.py:393:.eth.sendRawTransaction(...)→ should be.eth.send_raw_transaction(...)
Prompt for agents
The web3 version requirement was bumped from >=4.8 to >=7.15.0 in requirements-optional.txt, but the code in python/src/trezorlib/cli/ethereum.py and python/src/trezorlib/cli/ethereum_onekey.py still uses the old camelCase web3 API that was removed in web3.py v6+. All 12 call sites need to be updated to use the new snake_case API:
1. isConnected() -> is_connected()
2. eth.estimateGas() -> eth.estimate_gas()
3. eth.getTransactionCount() -> eth.get_transaction_count()
4. eth.sendRawTransaction() -> eth.send_raw_transaction()
5. eth.gasPrice -> eth.gas_price
6. contract.encodeABI() -> contract.encode_abi()
Additionally, python/setup.py line 30 still has web3>=4.8 in the ethereum extras_require, which is inconsistent with the new requirements-optional.txt. The setup.py should also be updated to web3>=7.15.0.
Note that there may be other breaking API changes in web3 v7 beyond the method renames (e.g., changes to the Web3() constructor, middleware API, etc.) that should also be reviewed.
Was this helpful? React with 👍 or 👎 to provide feedback.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Snyk has created this PR to fix 1 vulnerabilities in the pip dependencies of this project.
Snyk changed the following file(s):
python/requirements-optional.txtImportant
Note: You are seeing this because you or someone else with access to this repository has authorized Snyk to open fix PRs.
For more information:
🧐 View latest project report
📜 Customise PR templates
🛠 Adjust project settings
📚 Read about Snyk's upgrade logic
Learn how to fix vulnerabilities with free interactive lessons:
🦉 Server-side Request Forgery (SSRF)