#1259 [muc_mam] forwarded stanza has a "to" attribute while spec says it MUST NOT
Reporter
Goffi
Owner
Zash
Created
Updated
Stars
★ (1)
Tags
Status-Fixed
Priority-Medium
Type-Defect
Compliance
Milestone-0.11
Goffi
on
Hello,
mod_muc_mam is using a "to" attribute in forwarded message stanza while requiring MAM archive, which is forbidden by spec. Here is a copy of the stream during a MAM request to a prosody MUC:
=== begin stream ===
==== OUT ====>>> (goffi)
<iq to="test@conference.tazar2.int" type="set" id="H_71">
<query xmlns="urn:xmpp:mam:2" queryid="7c5614f2-7b08-4224-80f5-0607a7ce99e7">
<set xmlns="http://jabber.org/protocol/rsm">
<max>20</max>
</set>
</query>
</iq>
<<<===== IN ==== (goffi)
<message xmlns="jabber:client" to="goffi@tazar2.int/sat" from="test@conference.tazar2.int">
<result xmlns="urn:xmpp:mam:2" queryid="7c5614f2-7b08-4224-80f5-0607a7ce99e7" id="x_VTrY7rQoPY0USq">
<forwarded xmlns="urn:xmpp:forward:0">
<delay xmlns="urn:xmpp:delay" stamp="2018-12-04T07:35:45Z"/>
<message xmlns="jabber:client" to="test@conference.tazar2.int" type="groupchat" id="11ba8430-456d-40d7-af7b-6afd206cb180" from="test@conference.tazar2.int/louise">
<body>test hors ligne 1</body>
<origin-id xmlns="urn:xmpp:sid:0" id="11ba8430-456d-40d7-af7b-6afd206cb180"/>
<active xmlns="http://jabber.org/protocol/chatstates"/>
</message>
</forwarded>
</result>
</message>
<<<===== IN ==== (goffi)
<message xmlns="jabber:client" to="goffi@tazar2.int/sat" from="test@conference.tazar2.int">
<result xmlns="urn:xmpp:mam:2" queryid="7c5614f2-7b08-4224-80f5-0607a7ce99e7" id="E9qAX8Cckv-BJJOT">
<forwarded xmlns="urn:xmpp:forward:0">
<delay xmlns="urn:xmpp:delay" stamp="2018-12-04T07:35:50Z"/>
<message xmlns="jabber:client" to="test@conference.tazar2.int" type="groupchat" id="8fd59af5-1c68-468f-a673-ce36ebec2a40" from="test@conference.tazar2.int/louise">
<body>test hors ligne 2</body>
<origin-id xmlns="urn:xmpp:sid:0" id="8fd59af5-1c68-468f-a673-ce36ebec2a40"/>
<active xmlns="http://jabber.org/protocol/chatstates"/>
</message>
</forwarded>
</result>
</message>
<<<===== IN ==== (goffi)
<iq xmlns="jabber:client" from="test@conference.tazar2.int" type="result" id="H_71" to="goffi@tazar2.int/sat">
<fin xmlns="urn:xmpp:mam:2" queryid="7c5614f2-7b08-4224-80f5-0607a7ce99e7" complete="true">
<set xmlns="http://jabber.org/protocol/rsm">
<count>2</count>
<first>x_VTrY7rQoPY0USq</first>
<last>E9qAX8Cckv-BJJOT</last>
</set>
</fin>
</iq>
=== end stream ===
As you can see, the "to" attribute is set to "test@conference.tazar2.int" while is must not be set at all.
https://xmpp.org/extensions/xep-0313.html#business-storeret-muc-archives says:
> When sending out the archives to a requesting client, the forwarded stanza MUST NOT have a 'to' attribute, and the 'from' MUST be the occupant JID of the sender of the archived message.
Zash
on
I hadn't seen that part of the spec. I suspect this code predates any mention of MUC in the XEP.
Is there a rationale for the MUST NOT? I couldn't find one. I don't see what's wrong with setting it to the room JID.
Hello, mod_muc_mam is using a "to" attribute in forwarded message stanza while requiring MAM archive, which is forbidden by spec. Here is a copy of the stream during a MAM request to a prosody MUC: === begin stream === ==== OUT ====>>> (goffi) <iq to="test@conference.tazar2.int" type="set" id="H_71"> <query xmlns="urn:xmpp:mam:2" queryid="7c5614f2-7b08-4224-80f5-0607a7ce99e7"> <set xmlns="http://jabber.org/protocol/rsm"> <max>20</max> </set> </query> </iq> <<<===== IN ==== (goffi) <message xmlns="jabber:client" to="goffi@tazar2.int/sat" from="test@conference.tazar2.int"> <result xmlns="urn:xmpp:mam:2" queryid="7c5614f2-7b08-4224-80f5-0607a7ce99e7" id="x_VTrY7rQoPY0USq"> <forwarded xmlns="urn:xmpp:forward:0"> <delay xmlns="urn:xmpp:delay" stamp="2018-12-04T07:35:45Z"/> <message xmlns="jabber:client" to="test@conference.tazar2.int" type="groupchat" id="11ba8430-456d-40d7-af7b-6afd206cb180" from="test@conference.tazar2.int/louise"> <body>test hors ligne 1</body> <origin-id xmlns="urn:xmpp:sid:0" id="11ba8430-456d-40d7-af7b-6afd206cb180"/> <active xmlns="http://jabber.org/protocol/chatstates"/> </message> </forwarded> </result> </message> <<<===== IN ==== (goffi) <message xmlns="jabber:client" to="goffi@tazar2.int/sat" from="test@conference.tazar2.int"> <result xmlns="urn:xmpp:mam:2" queryid="7c5614f2-7b08-4224-80f5-0607a7ce99e7" id="E9qAX8Cckv-BJJOT"> <forwarded xmlns="urn:xmpp:forward:0"> <delay xmlns="urn:xmpp:delay" stamp="2018-12-04T07:35:50Z"/> <message xmlns="jabber:client" to="test@conference.tazar2.int" type="groupchat" id="8fd59af5-1c68-468f-a673-ce36ebec2a40" from="test@conference.tazar2.int/louise"> <body>test hors ligne 2</body> <origin-id xmlns="urn:xmpp:sid:0" id="8fd59af5-1c68-468f-a673-ce36ebec2a40"/> <active xmlns="http://jabber.org/protocol/chatstates"/> </message> </forwarded> </result> </message> <<<===== IN ==== (goffi) <iq xmlns="jabber:client" from="test@conference.tazar2.int" type="result" id="H_71" to="goffi@tazar2.int/sat"> <fin xmlns="urn:xmpp:mam:2" queryid="7c5614f2-7b08-4224-80f5-0607a7ce99e7" complete="true"> <set xmlns="http://jabber.org/protocol/rsm"> <count>2</count> <first>x_VTrY7rQoPY0USq</first> <last>E9qAX8Cckv-BJJOT</last> </set> </fin> </iq> === end stream === As you can see, the "to" attribute is set to "test@conference.tazar2.int" while is must not be set at all. https://xmpp.org/extensions/xep-0313.html#business-storeret-muc-archives says: > When sending out the archives to a requesting client, the forwarded stanza MUST NOT have a 'to' attribute, and the 'from' MUST be the occupant JID of the sender of the archived message.
I hadn't seen that part of the spec. I suspect this code predates any mention of MUC in the XEP. Is there a rationale for the MUST NOT? I couldn't find one. I don't see what's wrong with setting it to the room JID.
ChangesFixed in https://hg.prosody.im/trunk/rev/a44f562e01a5
Changes