Skip to content

Panicky, non-validating conversions involving protobuf types and/or domain types #1037

@mzabaluev

Description

@mzabaluev

After #1022 has landed, there is a number of conversions between protobuf types and so-called domain types that do not validate their input, are prone to panic when the input does not conform to expectations on the destination value, or produce a protobuf message struct value that falls afoul of the specification on well-known protobuf types.

Here's why this is problematic for protobuf ⭢ domain type:
As the most likely origin of protobuf DTO values is by having been parsed from an incoming message by prost without any validation as to its contents, this is an easy DoS bomb under application developers who would make use of these conversions. Please consider using fallible conversions when dealing with untrusted values originating from the network.

Here's why this is problematic for domain type ⭢ protobuf:
Aside from the low-level tendermint-proto crate, tendermint-rs should never produce protocol messages that do not comply with the specification. The alternative of panicking makes for poor API usability. The tendermint API should provide true domain types where the From-type conversion to their protobuf DTOs is a total function always resulting in valid messages.

List of problematic conversions

The list of identified conversions that exhibit the problems described above, along with the PR addressing them:

Homespun domain types

Domain types to be provided in tendermint for lack of a suitable alternative:

Originally posted by @mzabaluev in #1030 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingcode-qualityIssues relating to linting configuration and general code qualitydomain-typesAnything relating to the creation, modification or removal of domain typesrpcsecurity

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions