Skip to content

Commit

Permalink
[FAB-2341] Fix validation logic with empty CodePackage
Browse files Browse the repository at this point in the history
The recently added platform::ValidateDeploymentSpec did not account
for the possibility that the CodePackage may be optional under
certain scenarios.

This patch fixes this by checking for this condition and handling
gracefully.

Fixes FAB-2341

Change-Id: I83791dbf04c420e42b087805de668f0405b0214a
Signed-off-by: Greg Haskins <[email protected]>
  • Loading branch information
ghaskins committed Feb 17, 2017
1 parent 22795e3 commit d4b5649
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions core/chaincode/platforms/golang/platform.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,11 @@ func (goPlatform *Platform) ValidateSpec(spec *pb.ChaincodeSpec) error {

func (goPlatform *Platform) ValidateDeploymentSpec(cds *pb.ChaincodeDeploymentSpec) error {

if cds.CodePackage == nil || len(cds.CodePackage) == 0 {
// Nothing to validate if no CodePackage was included
return nil
}

// FAB-2122: Scan the provided tarball to ensure it only contains source-code under
// /src/$packagename. We do not want to allow something like ./pkg/shady.a to be installed under
// $GOPATH within the container. Note, we do not look deeper than the path at this time
Expand Down

0 comments on commit d4b5649

Please sign in to comment.