Hyperledger Fabric: Initial integration (#5888)

* Hyperledger Fabric: Initial integration

* Update project.yaml

* Update build.sh

* Update Dockerfile

Co-authored-by: jonathanmetzman <31354670+jonathanmetzman@users.noreply.github.com>
This commit is contained in:
AdamKorcz 2022-06-09 16:09:37 +01:00 committed by GitHub
parent 3930a7c522
commit a0d248312d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 81 additions and 0 deletions

View File

@ -0,0 +1,20 @@
# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
################################################################################
FROM gcr.io/oss-fuzz-base/base-builder-go
RUN git clone --depth 1 https://github.com/hyperledger/fabric
COPY build.sh persistence_fuzzer.go $SRC/
WORKDIR $SRC/fabric

19
projects/fabric/build.sh Normal file
View File

@ -0,0 +1,19 @@
#!/bin/bash -eu
# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
################################################################################
cp $SRC/persistence_fuzzer.go ./core/chaincode/persistence/mock/
compile_go_fuzzer github.com/hyperledger/fabric/core/chaincode/persistence/mock FuzzPersistence fuzz_persistence

View File

@ -0,0 +1,29 @@
// Copyright 2022 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package mock
import (
"github.com/hyperledger/fabric/core/chaincode/persistence"
tm "github.com/stretchr/testify/mock"
)
func FuzzPersistence(data []byte) int {
var ccpp persistence.ChaincodePackageParser
mockMetaProvider := &MetadataProvider{}
mockMetaProvider.On("GetDBArtifacts", tm.Anything).Return([]byte("DB artefacts"), nil)
ccpp.MetadataProvider = mockMetaProvider
_, _ = ccpp.Parse(data)
return 1
}

View File

@ -0,0 +1,13 @@
homepage: "https://www.hyperledger.org"
main_repo: "https://github.com/hyperledger/fabric"
primary_contact: "ale.linux@sopit.net"
auto_ccs:
- "gari.r.singh@gmail.com"
vendor_ccs:
- "adam@adalogics.com"
- "david@adalogics.com"
language: go
fuzzing_engines:
- libfuzzer
sanitizers:
- address