avstack / gst-meet

Connect GStreamer pipelines to Jitsi Meet conferences
Apache License 2.0
69 stars 25 forks source link

XMPP parser error when JWT auth token is enabled #77

Closed daimoc closed 5 months ago

daimoc commented 1 year ago

Hi, I made some test with the last gst-meet version and a Jitsi-Meet instance with JWT auth token enabled. I can connect the gst-meet user on a running meeting if I add a valid JWT token on the wss url and it works well.

But if a new moderator joins the room, gst-meet failed to parse the presence message, and it leaves the room with this error :

2023-06-08T14:11:58.704482Z ERROR error=parse error: Either 'jid' or 'nick' attribute is required. 2023-06-08T14:11:58.704628Z ERROR fatal (in read loop): parse error: Either 'jid' or 'nick' attribute is required.

Here is the XMPP message that generate the error :

<presence xmlns='jabber:client' 
          to='vzjvp7wktrsctkfna_yzij1f@preprod-rendez-vous.renater.fr/8Ybnc4ddCpuN' 
          xml:lang='en' 
          from='bob0@conference.preprod-rendez-vous.renater.fr/82b6ed8f'>
    <stats-id>Aaliyah-Uo5</stats-id>
    <c hash='sha-1' ver='p1SSmeQ82gSAjXEw+FlBmWtBv2k=' node='https://jitsi.org/jitsi-meet' xmlns='http://jabber.org/protocol/caps'/>
    <features>
        <feature var='https://jitsi.org/meet/e2ee'/>
    </features>
    <SourceInfo>
        {}
    </SourceInfo>
    <jitsi_participant_codecType>
        vp8
    </jitsi_participant_codecType>
    <avatar-url>
        https://www.gravatar.com/avatar/XXXXXX
    </avatar-url>
    <email>
        XXXXX@test.fr
    </email>
    <nick xmlns='http://jabber.org/protocol/nick'>
        BOB
    </nick>
    <jitsi_participant_e2ee.idKey.curve25519>GtXeEe0YKDGaSJy+VcEjjfZ6+znz7B1HRU7l/Gp45y0</jitsi_participant_e2ee.idKey.curve25519>
    <jitsi_participant_e2ee.idKey.ed25519>bGZlraoA8K0AdWvx3+aaQuaVJRpfweG7tHJHQkYL4D8</jitsi_participant_e2ee.idKey.ed25519>
    <occupant-id id='yhfk8wkTJwdRwbXaxvDEzTNcuW1Kk/xE8XIPncpghdM=' xmlns='urn:xmpp:occupant-id:0'/>
    <x xmlns='http://jabber.org/protocol/muc#user'>
        <item jid='31lbx99ty20veyex8lhw0wtv@preprod-rendez-vous.renater.fr/PHf-3zr0rLUt' affiliation='owner' role='moderator'>
            <actor jid='focus@auth.preprod-rendez-vous.renater.fr/focus' nick='focus'/>
        </item>
    </x>
</presence>

After digging the gst-meet code, I think the error "parse error: Either 'jid' or 'nick' attribute is required." came from the rust xmp-parser library on the actor element but I'm not sure.

Does anyone has already see this error with Gst-Meet ?

jbg commented 1 year ago

Yes, it seems to come from here: https://docs.rs/xmpp-parsers/latest/src/xmpp_parsers/muc/user.rs.html#107

xmpp-parsers validates that exactly one of jid or nick is set on the actor element. Since Jicofo is setting both, the error occurs.

xmpp-parsers seems to deviate from the spec here, which allows both to be set (https://xmpp.org/extensions/xep-0045.html#schemas-user), meaning it probably should not have been modelled as an enum.

jbg commented 1 year ago

Filed an issue upstream: https://gitlab.com/xmpp-rs/xmpp-rs/-/issues/88

jbg commented 1 year ago

I've implemented a workaround in https://github.com/avstack/gst-meet/commit/a42e069d282db43fc8ed088db79be1b3ec6a3557

If you can confirm that current master works for you, I'll make a release with the workaround.

I'll keep this issue open until it's fixed upstream and I can remove the workaround.

daimoc commented 1 year ago

Hi @jbg, Your workaround works fine. I don't know if xmpp-rs will be fixed or if someone must ask prosody to change its implementation (see the Jitsi Forum post). But now Gst-Meet works with my JItsi-Meet environment, so thank you.