#1121 When removing roster contact, Prosody should send directed "unavailable" presence but sends global unavailable presence

Reporter JC Brand
Owner Zash
Created
Updated
Stars ★★ (2)
Tags
  • Compliance
  • Status-Fixed
  • Type-Defect
  • Priority-High
  • Milestone-0.12
  1. JC Brand on

    In converse.js (master branch)... We have two users, alba-ross and geeke-groenen. Stanzas below are sent/received by geeke-groenen. alba-ross removes geeke-groenen as a contact from her roster, a "remove" IQ set stanza is sent. This causes Prosody to send a <presence type="unsubscribe"> to geeke-groenen. converse.js:39800 2018-03-27T17:33:28+02:00 DEBUG (Incoming stanza): <body xmlns:stream="http://etherx.jabber.org/streams" xmlns="http://jabber.org/protocol/httpbind" sid="22744efd-1be5-4ca4-a654-cb8848f0797f"> <presence xmlns="jabber:client" type="unsubscribed" to="geeke-groenen@localhost" from="alba-ross@localhost"/> </body> In response, geeke-groenen also sends an IQ stanza with "subscription" set to "remove" for alba-ross. converse.js:39800 2018-03-27T17:33:29+02:00 DEBUG: (Outgoing stanza) <body rid="4226885807" xmlns="http://jabber.org/protocol/httpbind" sid="22744efd-1be5-4ca4-a654-cb8848f0797f"> <presence type="unsubscribe" to="alba-ross@localhost" xmlns="jabber:client"/> <iq type="set" xmlns="jabber:client" id="0410f834-7a2f-4561-883b-2e2ec7f76f91:sendIQ"> <query xmlns="jabber:iq:roster"> <item jid="alba-ross@localhost" subscription="remove"/> </query> </iq> </body> Prosody then replies with the following stanzas: converse.js:39800 2018-03-27T17:33:29+02:00 DEBUG: (Incoming stanza) <body xmlns:stream="http://etherx.jabber.org/streams" xmlns="http://jabber.org/protocol/httpbind" sid="22744efd-1be5-4ca4-a654-cb8848f0797f"> <iq xmlns="jabber:client" id="lx495" type="set"> <query xmlns="jabber:iq:roster" ver="625"> <item jid="alba-ross@localhost" subscription="from" name="alba-ross@localhost"/> </query> </iq> *********** THIS IS WRONG, SHOULD BE A DIRECTED STANZA **************** <presence xmlns="jabber:client" type="unavailable" from="geeke-groenen@localhost/converse.js-101562411"/> ************************************************************************************************* <presence xmlns="jabber:client" type="unsubscribe" to="geeke-groenen@localhost" from="alba-ross@localhost"/> <iq xmlns="jabber:client" id="lx496" type="set"> <query xmlns="jabber:iq:roster" ver="626"> <item jid="alba-ross@localhost" subscription="none" name="alba-ross@localhost"/> </query> </iq> <iq xmlns="jabber:client" id="lx498" type="set"> <query xmlns="jabber:iq:roster" ver="626"> <item jid="alba-ross@localhost" subscription="none" name="alba-ross@localhost"/> </query> </iq> <iq xmlns="jabber:client" id="0410f834-7a2f-4561-883b-2e2ec7f76f91:sendIQ" type="result" to="geeke-groenen@localhost/converse.js-101562411"/> <iq xmlns="jabber:client" id="lx499" type="set"> <query xmlns="jabber:iq:roster" ver="627"> <item jid="alba-ross@localhost" subscription="remove"/> </query> </iq> </body> As shown above, Prosody sends an undirected "unavailable" stanza for geeke-groenen, which is wrong, it should be sending an "unavailable" stanza only to "alba-ross". Please provide a snippet of the part of the specification which we violate if possible: "While the user is still subscribed to the contact's presence (i.e., before the contact's server routes or delivers the presence stanza of type "unsubscribed" to the user), the contact's server MUST send a presence stanza of type "unavailable" from all of the contact's online resources to the user." This presence stanza of type "unavailable" must be sent "to the user" (as per the spec). Instead, Prosody sends an undirected "unavailable" presence, which means that the contact is now treated as offline and doesn't receive presence updates. Please provide a link to the specification: https://xmpp.org/rfcs/rfc6121.html#rfc.section.3.2.2

  2. MattJ on

    Thanks for the report. Ideally we produce tests for this so we can reproduce and confirm the fix.

    Changes
    • tags Status-Accepted Milestone-0.11
  3. MattJ on

    Changes
    • owner Waqas
  4. MattJ on

    It's taken more time than I hoped to produce decent tests to reproduce this in an automated way. I'm pushing it to the next milestone, as it seems to be an edge case that doesn't come up very often.

    Changes
    • tags Milestone-0.11 Milestone-0.12
  5. MattJ on

    Changes
    • tags Priority-High
  6. ge0rg on

    This has happened to me multiple times already. The passive user (the one that gets removed from the other user's roster) is thrown out from all MUCs and all their clients end up in a weird semi-undefined state. I can provide prosody 0.11 debug logs as well as client-side logs of this happening.

  7. Zash on

    Fixed in https://hg.prosody.im/trunk/rev/0b14b541fd27

    Changes
    • owner Waqas Zash
    • tags Status-Fixed

New comment

Not published. Used for spam prevention and optional update notifications.