fix(tm2/client): segfault on requests containing nil ID#5114
fix(tm2/client): segfault on requests containing nil ID#5114Davphla wants to merge 10 commits intognolang:masterfrom
Conversation
🛠 PR Checks SummaryAll Automated Checks passed. ✅ Manual Checks (for Reviewers):
Read More🤖 This bot helps streamline PR reviews by verifying automated checks and providing guidance for contributors and reviewers. ✅ Automated Checks (for Contributors):🟢 Maintainers must be able to edit this pull request (more info) ☑️ Contributor Actions:
☑️ Reviewer Actions:
📚 Resources:Debug
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
|
I think the more appropriate fix is to return an error in the UnmarshalJSON method of RPCResponse, which looks to be the real culprit: gno/tm2/pkg/bft/rpc/lib/types/types.go Lines 176 to 180 in cd0c845 In fact, we already return an error in the equivalent case of unmarshaling into a RPCRequest. |
Agreed, easier to manage. Just a note on the nullability of the ID: |
|
The CI check of TM2 failed for "TestWALCrash". This happens on many PRs, maybe 25% of the time. After running again it may pass. |
|
I've simplified the fix by generalizing the error in |
tm2/pkg/bft/rpc/lib/types/types.go
Outdated
| if unsafeReq.ID == nil { | ||
| return nil | ||
| return errors.New("request ID cannot be nil") | ||
| } |
There was a problem hiding this comment.
question: maybe we can remove this and let the parseID return the error ?
fix: https://github.com/gnolang/gno/security/advisories/GHSA-83x9-8m84-6fgj
I also fixed the missing nil verification on the non-exploitable client-controlled functions.
Single request test: