Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use JitsiXmppStringprep, update smack #1151

Merged
merged 5 commits into from
Apr 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ class XmppConfig private constructor() {
.convertFrom<List<String>> { l -> l.map { JidCreate.domainBareFrom(it) } }
}

val useJitsiJidValidation: Boolean by config {
"jicofo.xmpp.use-jitsi-jid-validation".from(newConfig)
}

companion object {
@JvmField
val service = XmppServiceConnectionConfig()
Expand Down
3 changes: 3 additions & 0 deletions jicofo-selector/src/main/resources/reference.conf
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,9 @@ jicofo {
}

xmpp {
// Whether to use JitsiXmppStringprep to validate JIDs. If set to false uses the default validation in Smack.
use-jitsi-jid-validation = true

// The separate XMPP connection used for communication with clients (endpoints).
client {
enabled = true
Expand Down
19 changes: 1 addition & 18 deletions jicofo/src/main/kotlin/org/jitsi/jicofo/xmpp/Smack.kt
Original file line number Diff line number Diff line change
Expand Up @@ -51,29 +51,12 @@ import org.jitsi.xmpp.extensions.jitsimeet.UserInfoPacketExt
import org.jitsi.xmpp.extensions.jitsimeet.VideoMutedExtension
import org.jitsi.xmpp.extensions.rayo.RayoIqProvider
import org.jivesoftware.smack.SmackConfiguration
import org.jivesoftware.smack.parsing.ExceptionLoggingCallback
import org.jivesoftware.smack.provider.ProviderManager
import org.jivesoftware.smackx.bytestreams.socks5.Socks5Proxy
import org.jxmpp.JxmppContext
import org.jxmpp.stringprep.rocksxmppprecis.RocksXmppPrecisStringprep

fun initializeSmack() {
System.setProperty("jdk.xml.entityExpansionLimit", "0")
System.setProperty("jdk.xml.maxOccurLimit", "0")
System.setProperty("jdk.xml.elementAttributeLimit", "524288")
System.setProperty("jdk.xml.totalEntitySizeLimit", "0")
System.setProperty("jdk.xml.maxXMLNameLimit", "524288")
System.setProperty("jdk.xml.entityReplacementLimit", "0")

// The default SimpleXmppStringrep is very permissive and allows some invalid JIDs that we don't want to allow.
JxmppContext.setDefaultXmppStringprep(RocksXmppPrecisStringprep.INSTANCE)
org.jitsi.xmpp.Smack.initialize(XmppConfig.config.useJitsiJidValidation)

SmackConfiguration.setDefaultReplyTimeout(15000)
// if there is a parsing error, do not break the connection to the server(the default behaviour) as we need it for
// the other conferences.
SmackConfiguration.setDefaultParsingExceptionCallback(ExceptionLoggingCallback())

Socks5Proxy.setLocalSocks5ProxyEnabled(false)

registerXmppExtensions()
}
Expand Down
121 changes: 0 additions & 121 deletions jicofo/src/test/kotlin/org/jitsi/jicofo/xmpp/JidTest.kt

This file was deleted.

4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<!-- Make sure this matches the version of the jxmpp artifacts inheriteb from smack. -->
<jxmpp.version>1.0.3</jxmpp.version>
<smack.version>4.4.6</smack.version>
<smack.version>4.4.8</smack.version>
<kotlin.version>1.9.10</kotlin.version>
<kotest.version>5.7.2</kotest.version>
<slf4j.version>1.7.32</slf4j.version>
Expand Down Expand Up @@ -175,7 +175,7 @@
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>jitsi-xmpp-extensions</artifactId>
<version>1.0-79-gdc9285e</version>
<version>1.0-80-g0ce9883</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
Expand Down
Loading