Skip to content

Commit

Permalink
[FAB-5150] remove bin data from install error
Browse files Browse the repository at this point in the history
Authorization error contains bin data (package) which is useless
for error reporting and would get in the way of SDKs and other
tools's reporting. This CR removes the bin data. Further we don't
want to peek into the data on auth. failure and so will _not_
attempt to read the package to enhance the reported error.

. patch 2 fixed lscc unit test to look for right error string

Change-Id: Ic55eba8d890aa2489488fdbd54d4ccc3a8483fed
Signed-off-by: Srinivasan Muralidharan <muralisr@us.ibm.com>
  • Loading branch information
Srinivasan Muralidharan committed Jul 2, 2017
1 parent bdd4a96 commit b5f26a0
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion core/scc/lscc/lscc.go
Original file line number Diff line number Diff line change
Expand Up @@ -721,7 +721,7 @@ func (lscc *LifeCycleSysCC) Invoke(stub shim.ChaincodeStubInterface) pb.Response

// 2. check local MSP Admins policy
if err = lscc.policyChecker.CheckPolicyNoChannel(mgmt.Admins, sp); err != nil {
return shim.Error(fmt.Sprintf("Authorization for INSTALL on %s has been denied with error %s", args[1], err))
return shim.Error(fmt.Sprintf("Authorization for INSTALL has been denied (error-%s)", err))
}

depSpec := args[1]
Expand Down
2 changes: 1 addition & 1 deletion core/scc/lscc/lscc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ func TestInstall(t *testing.T) {
testInstall(t, "example02.go", "0", path, InvalidChaincodeNameErr("example02.go").Error(), "Alice")
testInstall(t, "", "0", path, EmptyChaincodeNameErr("").Error(), "Alice")
testInstall(t, "example02", "1{}0", path, InvalidVersionErr("1{}0").Error(), "Alice")
testInstall(t, "example02", "0", path, "Authorization for INSTALL on", "Bob")
testInstall(t, "example02", "0", path, "Authorization for INSTALL has been denied", "Bob")
}

func testInstall(t *testing.T, ccname string, version string, path string, expectedErrorMsg string, caller string) {
Expand Down

0 comments on commit b5f26a0

Please sign in to comment.