Bug #672

deviceGet() needs to validate request by decoding it

Added by Hammel 19 days ago. Updated 12 days ago.

Status:ClosedStart date:02 Sep 2018
Priority:ImmediateDue date:
Assignee:Hammel% Done:

100%

Category:Software
Target version:Iron Man - 002 - MVP
Severity:02 - High

Description

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.


Related issues

Related to Iron Man - Feature #669: Add cron job to retrieve device state in monitor. Closed 23 Aug 2018

Associated revisions

Revision 0ed9ca82
Added by Hammel 13 days ago

RM #672: Fix decode function to properly decode the getdevices request.

Revision ea73bdec
Added by Hammel 13 days ago

RM #672: Fix root cronjob to set the Accept-Version header when running the getdevices request.

Revision 0d399aea
Added by Hammel 13 days ago

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.

Revision 50eff763
Added by Hammel 12 days ago

RM #672: Must use a callback for call to http.request in order to process async response.

Revision f5b693e7
Added by Hammel 12 days ago

RM #672: Use text/plain mime type when returning data to monitor from POST request.

Revision d2525ab3
Added by Hammel 12 days ago

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.

Revision 55bf4d3f
Added by Hammel 12 days ago

RM #672: Do nothing if a device has no uuid configured in getDevices. Clean up inbound JSON from sensor in response to getDevices.

History

#1 Updated by Hammel 13 days 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 12 days 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.

Closing issue.

Also available in: Atom PDF