unfoldedcircle / feature-and-bug-tracker

Feature and bug tracker repository for Unfolded Circle products
22 stars 0 forks source link

[bug] Json decode error when using special characters in command parameters #153

Closed kennymc-c closed 8 months ago

kennymc-c commented 8 months ago

Is there an existing issue for this?

Description

When using special character such as ?, §, $ or German umlauts like ö, ä or ü in a command parameters like the select_source command from a media_player entity the remote doesn't seem to send anything to the integration websockets server and this results in a timeout. I can only find a Unknown response message: json decode error message in the remote log. Is this a bug or a known limitation?

How to Reproduce

  1. Create an activity and add the select source or select sound mode command to the ui
  2. Manually enter the parameter name which includes special characters
  3. Start the activity and execute the command

Expected behavior

A command with a parameter that includes special characters should be executed with an error or a timeout

System version

1.4.3

What part of the system affected by the problem?

Core, Integration

Additional context

Core & UI debug logs: UCR2_logs_2023-10-28.txt

zehnm commented 8 months ago

I cannot reproduce this. From the attached logs it looks like that this is an error from an external custom integration, since we don't provide an fhem integration:

core    WARN    [fhem] Unknown response message: json decode error

I asssume this is your integration?

This error message is printed, if the response message name in field msg is unknown. For example if the value is Result instead of result. The json decode error text seems like something went wrong inside the integration and that exact text was set for msg. If the json message couldn't be deserialized, another error would be logged.

Testing with one of our integrations, the special characters don't cause any json errors.

image

Since the integration doesn't know what to do with an invalid input, it returns an error, but there's no JSON encoding or decoding issue:

[127.0.0.1:59561] -> {"id":100,"kind":"req","msg":"execute_entity_command","msg_data":{"cmd_id":"media_player.select_source","entity_id":"uc_denon_driver.main.media_player.DBBZ012118361","params":{"source":"äöü"}}}
[127.0.0.1:59561] <- {"kind":"resp","req_id":100,"msg":"result","code":500,"msg_data":{"code":"ERROR","message":"Internal server error, please try later"}}
[127.0.0.1:59561] -> {"id":104,"kind":"req","msg":"execute_entity_command","msg_data":{"cmd_id":"media_player.select_source","entity_id":"uc_denon_driver.main.media_player.DBBZ012118361","params":{"source":"?$§\"{}'"}}}
[127.0.0.1:59561] <- {"kind":"resp","req_id":104,"msg":"result","code":500,"msg_data":{"code":"ERROR","message":"Internal server error, please try later"}}
kennymc-c commented 8 months ago

It's not my own integration but I contacted the developer. I first got this issue also with a different integration that's why I posted it here but i can't reproduce this anymore with the other integration.

zehnm commented 8 months ago

I don't see this as a bug in our software. Please reopen the issue if you can provide a reproducable test case.

kennymc-c commented 8 months ago

It was indeed a bug in the integration itself