Third party node able to make a transaction of an external smart contract code
System information
Geth
Version: 1.7.2-stable
Git Commit: 159d813f355c19849abc0024e98f08ae7bf2fad0
Quorum Version: 2.0.2
Architecture: amd64
Go Version: go1.9.3
Operating System: linux
OS & Version: Ubuntu 16.04.5 LTS
It happens with both versions of quourum:
Master Branch at 159d813f355c19849abc0024e98f08ae7bf2fad0 commit
tags/v2.0.2
I am using Vagrant and 7nodes example to set up the network.
Scenario
There are 3 nodes, an account per node ( nodes A, B, C; accounts A, B, C). I deployed an smart contract from node A with the privateFor key of B, so this contract its supposed to be private for A and B. Node C is supposed to cannot send transactions to the smart contract.
SimpleStorage.sol https://pastebin.com/v2PV2qFM
Expected behaviour
Transaction should not be minted, getting a 0x0 status on the TransactionReceipt. The transaction should fail, because it is trying to make a transaction into a private contract.
Actual behaviour
Transaction is minted, getting a 0x1 status on the TransactionReceipt. The node (as a 3rd party) is able to call a code of the private smart contract and set a value. (This node is not included on the privateFor of the smart contract deployment).
Steps to reproduce the behaviour
- Deploy a private smart contract from node A, using privateFor key of node B. https://pastebin.com/uh7MeTfq
- Access to the smart contract from node C (which is a third party, not included on the private smart contract). https://pastebin.com/JgzdH931
- Call the set function of the private smart contract, from node C:
simple.set(112, {from: eth.accounts[0], privateFor: ["BULeR8JyUWhiuuCMU/HLA0Q5pzkYT+cHII3ZKBey3Bo=", "QfeDAys9MPDs2XHExtc84jKGHxZg/aj52DTh0vtA3Xc="]}) - Transaction is minted, getting 0x1 on the status of the TransactionReceipt.
Is this a bug? Thanks in advance
@miguelmartinezinf - Thanks for your feedback. We know about this bug where sender is able to interact with private contract when it is not participant to the contract in first place. A fix is being worked upon and will be included in future Quorum release.
To add, smart contracts should also police which account is allowed to execute methods on it. This is the common pattern we advise to use.