deviceGet() needs to validate request by decoding it
|Status:||Closed||Start date:||02 Sep 2018|
|Target version:||Iron Man - 0.5.0|
|Severity:||02 - High|
Currently the deviceGet() function in imlightsw doesn't validate the request by decoding it, to make sure the sender is actually the monitor it's paired to.
This requires adding a decodeMessage() alternative to encodeMessage(), as imlightsw has not decoded any messages from the monitor yet.
RM #672: Fix root cronjob to set the Accept-Version header when running the getdevices request.
RM #672: Implement getDevices (/query/devices API on monitor and on sensor).
Generalize decoding so it can be called in multiple ways.
Strip ipv6 header from ipv4 addresses when using them as filenames.
Add utility function to examine IP address to to see if it's ours or not.
Add utility function to send a POST request to sensors.
RM #672: Must use a callback for call to http.request in order to process async response.
RM #672: Use text/plain mime type when returning data to monitor from POST request.
RM #672: Send back all configuration data instead of just state with /query/device so monitor doesn't have to parse anything or know anything about specific devices.
#1 Updated by Hammel about 2 years ago
- Status changed from New to In Progress
- % Done changed from 0 to 50
This is getting very close. The monitor now supports the /query/devices API and sends POST /query/device to each sensor to get updated information. And the sensor gets/decrypts the request and looks to be sending back a JSON response packet with it's current state (but just state right now). However, this message does not appear to be showing up at the monitor as a response to it's POST request. I'm probably either not really sending it or it's not actually being extracted on the monitor side from the response packet.
#2 Updated by Hammel about 2 years ago
- Status changed from In Progress to Closed
- % Done changed from 50 to 100
Everything is working here now. A query to a device causes the device to send back it's current configuration data which the monitor simply uses to replace the old data.
Verified on hardware. All code committed and pushed.