Repository navigation
fix(fabric): guard remaining unsafe protobuf field accesses - #1906
SaidAltury-ibm merged 2 commits into
Conversation
Replace direct pointer-field dereferences with nil-safe Get*() accessors (or an explicit nil guard, matching each file's existing sibling style) so a malformed or partially-populated protobuf message is reported as an error instead of panicking: - chaincode/invoke.go: ProposalResponse.Response - rwset/loader.go and fabricx/ledger.go and fabricx/transaction/envelope.go: Payload.Header - generic/transaction/envelope.go: Payload.Header (explicit guard) - protoutil/txutils.go: ProposalResponse.Response Add regression tests for each fix, and fix a pre-existing assertion in chaincode_test.go that expected a non-empty txID on a Submit() failure path that always returns "". Part of hyperledger-labs#1861 Signed-off-by: Marcus Brandenburger <bur@zurich.ibm.com>
|
Hey @mbrandenburger 👋 thanks for the PR! This comment updates automatically as you push changes -- think of it as your PR's live scoreboard! PR Checks✅ DCO Sign-off -- All commits have valid sign-offs. Nice work! ❌ GPG Signature -- Heads up! The following commits don't have a verified GPG signature:
You'll need to sign your commits with GPG (e.g. ✅ Merge Conflicts -- No merge conflicts detected. Smooth sailing! ✅ Issue Link -- Linked to #1905 (assigned to you). ⏳ All checks must pass before this PR can be reviewed. You've got this! |
|
This pull request does not currently match the merge queue conditions, so it cannot be queued from here. The box comes back if it matches again. |
Summary
Get*()accessors (or an explicit nil guard, matching each file's existing sibling style), so a malformed or partially-populated protobuf message is reported as an error instead of panicking:chaincode/invoke.go:ProposalResponse.Responserwset/loader.go,fabricx/ledger.go,fabricx/transaction/envelope.go:Payload.Headergeneric/transaction/envelope.go:Payload.Header(explicit guard)protoutil/txutils.go:ProposalResponse.Responsechaincode_test.gothat expected a non-emptytxIDon aSubmit()failure path that always returns""Fixes #1905.
Test plan
go testpasses for every touched package (protoutil,rwset,generic/transaction,generic/chaincode,fabricx/ledger,fabricx/transaction)make lintreports 0 issuesrequire.NotPanicsregression test demonstrating the historical panic no longer occurs