Project

General

Profile

test-suite sends IQ:Version before authenticating

Tomasz Sterna
Added over 2 years ago

First thing that tigase-testsuite/scripts/all-xmpp-tests.xmpt does is requesting server version:

This cannot work according to RFC6120 8.1.2.1. Client-to-Server Streams:

"1. When a server receives an XML stanza from a connected client, the server MUST add a 'from' attribute to the stanza or override the 'from' attribute specified by the client, where the value of the 'from' attribute MUST be the full JID () determined by the server for the connected resource that generated the stanza (see Section 4.3.6) [...]"

and 4.3.6. Determination of Addresses:

"For client-to-server communication, both SASL negotiation and resource binding MUST be completed before the server can determine the client's address."

So, it is impossible to comply with 8.1.2.1. pt.1 before authenticating the user.


Replies (3)

Added by Wojciech Kapcia TigaseTeam over 2 years ago

Thank you for the report.

Please note, that we are moving away form current TestSuide implementation towards TTS-NG (which is based on jaxmpp library).

As for the issue at hand - I've changed iq:version implementation and added both auth and bind as required tests to run before:

tigase-testsuite$ cat /home/jenkins/nightlies/tests/files/static/tests/7.1.0-SNAPSHOT-b4218/func/derby/Version.xml
<test-history test='Version'>
<OUTPUT test='Version'>
<stream:stream xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams' to='test-d' version='1.0'/>
</OUTPUT>
<INPUT test='Version'>
<stream:stream from="test-d" xmlns="jabber:client" id="13f4471d-6d65-45ba-9aee-6854c4db3c5a" xml:lang="en" xmlns:stream="http://etherx.jabber.org/streams" version="1.0"/>
</INPUT>
<INPUT test='Version'>
<stream:features><auth xmlns="http://jabber.org/features/iq-auth"/><register xmlns="http://jabber.org/features/iq-register"/><mechanisms xmlns="urn:ietf:params:xml:ns:xmpp-sasl"><mechanism>PLAIN</mechanism><mechanism>ANONYMOUS</mechanism></mechanisms><ver xmlns="urn:xmpp:features:rosterver"/><starttls xmlns="urn:ietf:params:xml:ns:xmpp-tls"/><compression xmlns="http://jabber.org/features/compress"><method>zlib</method></compression></stream:features>
</INPUT>
<OUTPUT test='Version'>
<auth xmlns='urn:ietf:params:xml:ns:xmpp-sasl' mechanism='PLAIN'>AGFkbWluAHN0YXRz</auth>
</OUTPUT>
<INPUT test='Version'>
<success xmlns="urn:ietf:params:xml:ns:xmpp-sasl"/>
</INPUT>
<OUTPUT test='Version'>
<stream:stream xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams' to='test-d' version='1.0'>
</OUTPUT>
<INPUT test='Version'>
<stream:stream from="test-d" xmlns="jabber:client" id="13f4471d-6d65-45ba-9aee-6854c4db3c5a" xml:lang="en" xmlns:stream="http://etherx.jabber.org/streams" version="1.0"/>
</INPUT>
<INPUT test='Version'>
<stream:features><register xmlns="http://jabber.org/features/iq-register"/><ver xmlns="urn:xmpp:features:rosterver"/><starttls xmlns="urn:ietf:params:xml:ns:xmpp-tls"/><compression xmlns="http://jabber.org/features/compress"><method>zlib</method></compression><bind xmlns="urn:ietf:params:xml:ns:xmpp-bind"/><session xmlns="urn:ietf:params:xml:ns:xmpp-session"/></stream:features>
</INPUT>
<OUTPUT test='Version'>
<iq type='set' id='bind1'><bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'><resource>def-user-resource</resource></bind></iq>
</OUTPUT>
<INPUT test='Version'>
<iq type="result" xmlns="jabber:client" id="bind1" to="admin@test-d/def-user-resource"><bind xmlns="urn:ietf:params:xml:ns:xmpp-bind"><jid>admin@test-d/def-user-resource</jid></bind></iq>
</INPUT>
<OUTPUT test='Version'>
<iq type='get' to='test-d' from='admin@test-d/def-user-resource' id='version_1'><query xmlns='jabber:iq:version'/></iq>
</OUTPUT>
<INPUT test='Version'>
<iq from="test-d" type="result" xmlns="jabber:client" id="version_1" to="admin@test-d/def-user-resource"><query xmlns="jabber:iq:version"><name>Tigase</name><version>7.1.0-SNAPSHOT-b4218/5756fbb7 (2016-05-08/23:05:26)</version><os>Linux-amd64-3.5.0-23-generic, Java HotSpot(TM) 64-Bit Server VM-25.20-b05-Oracle Corporation</os></query></iq>
</INPUT>

</test-history>

Added by Tomasz Sterna over 2 years ago

I think you should leave that test in-place, but change the expectation to fail, and add another test for proper version implementation.

Replacing the failing test makes it possible to introduce this bug again, and it will pass unnoticed.

Added by Wojciech Kapcia TigaseTeam over 2 years ago

I've decided to leave it as-is, Resource Binding states:

Informational Note: The client could exchange stanzas with the server itself or the client's account before binding a resource since the full JID is needed only for addressing outside the context of the stream negotiated between the client and the server, but this is not commonly done.

therefore while binding is required it's possible to "live without it".

    (1-3/3)