CESARBR / knot-fog-connector-fiware

KNoT fog connector with FIWARE
MIT License
0 stars 3 forks source link

Verify if data is encoded before publishing #10

Closed lcbm closed 4 years ago

lcbm commented 4 years ago

As publishData() doesn't verify if 'data.value' contains characters forbidden by Fiware-Orion) (<, >, ", ', (, ), =, ;), requests sent to Orion with Base64 values (supported by KNoT) will result in a '400 Bad Request' response.

As a result, Base64 values with '=' will not be updated and will remain as is, or with an empty string (" ") as it's value, in Orion. Add isBase64() to verify if the 'data.value' is Base64 encoded and update publishData to decode Base64 values before publishing them.

lcbm commented 4 years ago

@ramonhpr, Made the changes you requested :smile:

Just as a quick heads up, changed these again:

  1. updateSchema(): it also had an await inside Promise.all() which seemed unnecessary. Even still, can you take a look if the change is accurate?
  2. Commit message: given the change above, the message was updated.
  3. isBase64(): same logic, except that with ternary operation.