Skip to content

Unsafe interface casts in DecoceControl may result PANICs #561

@tmorlando

Description

@tmorlando

Description
DecodeControl function does not check if interface casts are possible. Impossible cast will cause panics. In particular the default case on switch controlType is prone to this, as the (misbehaving) server may return non-string values.

Expected behavior

No panics in the library.

Alternative approaches:

  • Catch PANIC on DecodeControl and turn them into error responses
  • Check interface cast return values

In addition expecting unknown controlType data to contain string values feels odd. Maybe it would be better to leave interpretation of this unsafe data to the application?

This may relate to #538

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions