Skip to content

expose safety number messages over unix socket?

Hi there. I am trying to solve the problem of trusting updated safety numbers for users subscribed to a message broadcast system I have built on top of signalboost. To be more precise, I am trying to resolve this issue.

Thanks to your lovely API, it is trivial to to trust a changed safety number (just combine list_identities and trust messages.) However, I currently have no way of positively identifying when a safety number has changed. I belive it is the case that these messages are not exposed over the unix socket. Could they be? Or... if there is another workaround to this problem, or code I could write to help workaround it... could you share? I'd be happy to pitch in!

Here is my debugging setup:

  1. Run an instance of my signald-dependent service locally
  2. Log all messages that come off the wire on the unix socket exposed by signald
  3. Send a message between a test phone (let's call it alice) and my service, which is listening/sending messages over signald (lets call it bob)
  4. Verify that alice receives the message from bob
  5. Reinstall signalboost on alice's phone
  6. Send another message to the bob service
  7. Observe that (a) bob dos not receive the message, (b) no JSON message regarding key updates is logged, (c) no error is logged by signald
  8. Send a message from alice to bob
  9. Observe that (a) the following error is logged by signald:
signald    | 18:15:53.448 [socketlistener] ERROR io.finn.signald.SocketHandler - Catching
signald    | org.whispersystems.signalservice.api.push.exceptions.EncapsulatedExceptions: null
signald    |    at io.finn.signald.Manager.sendMessage(Manager.java:1008) ~[signald.jar:unspecified]
signald    |    at io.finn.signald.Manager.sendMessage(Manager.java:965) ~[signald.jar:unspecified]
signald    |    at io.finn.signald.Manager.sendMessage(Manager.java:858) ~[signald.jar:unspecified]
signald    |    at io.finn.signald.Manager.sendMessage(Manager.java:846) ~[signald.jar:unspecified]
signald    |    at io.finn.signald.SocketHandler.send(SocketHandler.java:240) ~[signald.jar:unspecified]
signald    |    at io.finn.signald.SocketHandler.handleRequest(SocketHandler.java:134) [signald.jar:unspecified]
signald    |    at io.finn.signald.SocketHandler.run(SocketHandler.java:119) [signald.jar:unspecified]
signald    |    at java.lang.Thread.run(Thread.java:748) [?:1.8.0_222]

and that (b) the following message is sent over the unix socket:

app_1      | {"type":"unexpected_error","data":{"msg_number":0,"error":true,"request":{"type":"send","username":"+1<REDACTED>","messageBody":"[TEST_WELCOME]\nHi","recipientNumber":"+1<REDACTED>","attachments":[],"expiresInSeconds":0}}}

From this it is possible to deduce when a safety number has changed by looking for failed sent messages from alice to bob, and this is my current planned workaround.

However, I cannot detect when messages from bob to alice fail. In my case, messages that "bob" might send to "alice" include commands that are important for the upkeep of the broadcast channel that alice is and which bob is administering. So I would like to be able to detect such failures. Absetnt being able to do so, my best course of action is to run a chron job that detects any untrusted safety numbers every day and trust all numbers that have changed.

Ideally, I would be able to detect when safety numbers changed at the application layer (by inspecting the unix socket) to (1) prevent any non-sent messages, (2) prevent the need for chron-jobs, (3) eventuall extend the code to give the choice of whether or not to trust the new safety numbers to users (which, after all, is the point of "safety numbers").

I would certainly like to avoid digging into the keystore to accomplish any of this. Do you think it would be possible to expose changed safety number messages over the unix socket? How hard would it be? Could I help?

Edited by aguestuser