owntracks / json-schema

OwnTracks messages JSON schema for validation and maybe documentation
MIT License
3 stars 0 forks source link

schema for _type=lwt is requiring data #3

Open jpmens opened 10 months ago

jpmens commented 10 months ago

As reported in https://github.com/owntracks/ios/issues/755 (but likely not the reason for the crash):

2023-12-15T14:37:58.693Z  Validation error: Error Domain=com.argentumko.JSONSchemaValidationError Code=300 "JSON instance validation against the schema failed." UserInfo={path=, object={
  "_type" : "lwt",
  "tst" : 1702479180
}, NSLocalizedDescription=JSON instance validation against the schema failed., validator=<DSJSONSchemaObjectValidator: 0x2820b7260>{ maximum properties: none, minimum properties: 0, required properties: _type, data }, NSLocalizedFailureReason=Object is missing required properties: 'data'.} with {"_type":"lwt","tst":1702479180}
ckrey commented 10 months ago

This is probably when using application level encryption. I guess lwt is not encrypted

jpmens commented 10 months ago

Looking at #755 again regarding the not-encrypted lwt message: I think it's fine and logical that it's not encrypted (and it can't really be as the broker doesn't know anything about encryption), but I wonder whether it would be feasable to give the broker an LWT to transmit which has encrypted data ... ? IIRC libsodium isn't time sensitive, so technically it ought to be possible to

  1. encrypt a payload for LWT
  2. submit the LWT on connect to the broker
  3. have the broker transmit the pre-encrypted LWT when the client dies

I'm definitely not saying we should do this; I'm rather thinking out loud whether it could make sense?

A disadvantage would be that monitors (other than, say, Recorder) for LWT would not be able to decrypt the payload.

yantoz commented 10 months ago

This is probably when using application level encryption. I guess lwt is not encrypted

@ckrey yes, application level encryption is enabled.

ckrey commented 10 months ago

I learned a lot about how app level encryption is used with OwnTracks...

ckrey commented 10 months ago

Basically, old versions process encrypted and unencrypted messages well. In the newer versions, non encrypted messages cause a crash. Will revert the change. I believed if app level encryption is enabled everything outgoing or incoming is encrypted...