Azure / azure-iot-explorer

Cross-platform UI for interacting with devices attached to Azure IoT Hub. This tool is meant for learning and testing, not for production environment.
MIT License
223 stars 72 forks source link

[BUG] Wrong Connection string could add connection successfully and read the device list. #553

Closed zh0903 closed 1 year ago

zh0903 commented 1 year ago

Describe the bug Wrong Connection string could add connection successfully and read the device list.

To Reproduce Steps to reproduce the behavior:

  1. Get IoT hub connection string, click add connection, fill it into "connection string" text box.
  2. Delete the last character of connection string or add a ' " ' character at its end.
  3. Click save.
  4. You can view the device list by wrong connection string.

Expected behavior Error arises when saving.

If the problem is related to cache of previous connection?

**Desktop (please complete the following information):

YingXue commented 1 year ago

This is not a UI issue. As long as the service confirms that the SAS token we generated through connection string is valid, the API will return results for the UI to show. In this specific senarios, the last letter in the connection string does not seems to matter when we make the call to service. If you delete, say the last two latters, the api will return 'unauthorized' where the UI will display the error accordingly.