Uploaded image for project: 'Fabric'
  1. Fabric
  2. FAB-18445

Any organization in channel can overwrite or corrupt private data without sufficient permissions

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • High
    • Resolution: Invalid: Works as Expected
    • v1.4.11
    • None
    • fabric-peer
    • Hide
      Note that the following command will use our open source tool to start and manage the network. It requires running Docker.

      1. git clone --branch issue-155/private-data-fixes https://github.com/softwaremill/fabrica && cd fabrica
      2. run ./e2e-network/test-03-private-data.sh (this script starts the network and performs the tests that follow the test flow from issue description)

      After the script execution all Hyperledger Fabric configuration can be found in e2e-network/test-03-private-data.sh.tmpdir/fabrica-target

      Node chaincode is in directory ./samples/chaincode-kv-node

      I am attaching the logs after execution of the script with test cases: https://github.com/softwaremill/fabrica/blob/issue-155/private-data-fixes/e2e-network/test-03-private-data.sh
      Show
      Note that the following command will use our open source tool to start and manage the network. It requires running Docker. 1. git clone --branch issue-155/private-data-fixes https://github.com/softwaremill/fabrica && cd fabrica 2. run ./e2e-network/test-03-private-data.sh (this script starts the network and performs the tests that follow the test flow from issue description) After the script execution all Hyperledger Fabric configuration can be found in e2e-network/test-03-private-data.sh.tmpdir/fabrica-target Node chaincode is in directory ./samples/chaincode-kv-node I am attaching the logs after execution of the script with test cases: https://github.com/softwaremill/fabrica/blob/issue-155/private-data-fixes/e2e-network/test-03-private-data.sh

    Description

      Hyperledger Fabric 1.4 introduced memberOnlyRead parameter for private data collections. Even if the parameter is set and organization cannot read the private data, it can overwrite or corrupt it.

      I have the following configuration:

      • Hyperledger Fabric 1.4.11 (tested on 1.4.6 as well, probably all 1.4.x versions affected)
      • Solo orderer (for RAFT with chaincode endorsement OR the bug occurs as well; I did not test it with AND endorsement on RAFT)
      • Two organizations (org1 and org2).
      • One channel and one chaincode (Node.js) for both ogranizations
      • Private data collection configuration:

      [{
        "name": "org1-collection",
        "policy": "OR('Org1MSP.member')",
        "requiredPeerCount": 1,
        "maxPeerCount": 1,
        "blockToLive": 0,
        "memberOnlyRead": true
      }]

      Test flow (for OR endorsement policy):

      1. Start the network, install chaincode
      2. Put private message by org1 (OK, as expected)
      3. Get private message by org1 (OK, as expected)
      4. Verify private message with GetPrivateDataHash by org1 (OK, as expected)
      5. Verify private message with GetPrivateDataHash by org2 (OK, as expected)
      6. Get private message by org2 (error, no read access permissions, as expected)
      7. Put private message by org2 (OK, but IMO should fail. It is possible that this is a feature, because we don't have parameter memberOnlyWrite for 1.4 and you should handle write permissions in chaincode directly. It leads however for further corruption of collection state)
      8. Get private message by org1 (if the org1 has one peer in the channel, it fails with MVCC_READ_CONFLICT; if the org1 has more peers in the channel, it returns the value put by org2)

      Similar situation happens with chaincode with AND(Org1MSP, Org2MSP) endorsement policy. Steps 2-6 behaves as expected. In step 7 the org2 can overwrite the private data. In step 8, however, the org1 is not able to get the private data with error: could not assemble transaction: ProposalResponsePayloads do not match

      Attachments

        Activity

          People

            Unassigned Unassigned
            dzikowski Jakub Dzikowski
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: