-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
SASL 2 #3113
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
base: main
Are you sure you want to change the base?
SASL 2 #3113
Changes from all commits
611fbd2
86e4a24
8edbaf5
92407f2
c75543e
2eecb2d
d6bbce3
b216ada
fef20b6
00902b3
2168470
bbdf000
81a0f06
db78de0
41a45bd
b68fa0a
213a90f
778b6ac
c3498b0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -74,6 +74,7 @@ public abstract class StanzaHandler { | |||||||||||||||||
| // Flag that indicates that the client requested to be authenticated. Once the | ||||||||||||||||||
| // authentication process is over the value will return to false. | ||||||||||||||||||
| protected boolean startedSASL = false; | ||||||||||||||||||
| protected boolean usingSASL2 = false; | ||||||||||||||||||
| /** | ||||||||||||||||||
| * SASL status based on the last SASL interaction | ||||||||||||||||||
| */ | ||||||||||||||||||
|
|
@@ -202,10 +203,23 @@ else if ("auth".equals(tag)) { | |||||||||||||||||
| // User is trying to authenticate using SASL | ||||||||||||||||||
| startedSASL = true; | ||||||||||||||||||
| // Process authentication stanza | ||||||||||||||||||
| saslStatus = SASLAuthentication.handle(session, doc); | ||||||||||||||||||
| saslStatus = SASLAuthentication.handle(session, doc, usingSASL2); | ||||||||||||||||||
| } else if ("authenticate".equals(tag)) { | ||||||||||||||||||
| // User is trying to authenticate using SASL2. | ||||||||||||||||||
| startedSASL = true; | ||||||||||||||||||
| usingSASL2 = true; | ||||||||||||||||||
| saslStatus = SASLAuthentication.handle(session, doc, usingSASL2); | ||||||||||||||||||
|
Comment on lines
+208
to
+211
|
||||||||||||||||||
| // User is trying to authenticate using SASL2. | |
| startedSASL = true; | |
| usingSASL2 = true; | |
| saslStatus = SASLAuthentication.handle(session, doc, usingSASL2); | |
| // User is trying to authenticate using SASL2. | |
| startedSASL = true; | |
| usingSASL2 = true; | |
| saslStatus = SASLAuthentication.handle(session, doc, usingSASL2); |
Copilot
AI
Dec 18, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The condition on line 212 has incorrect operator precedence. It will evaluate as (startedSASL && "response".equals(tag)) || "abort".equals(tag), meaning "abort" will be processed even when startedSASL is false. This should be startedSASL && ("response".equals(tag) || "abort".equals(tag)).
| } else if (startedSASL && "response".equals(tag) || "abort".equals(tag)) { | |
| } else if (startedSASL && ("response".equals(tag) || "abort".equals(tag))) { |
Copilot
AI
Dec 18, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,103 @@ | ||||||
| /* | ||||||
| * Copyright (C) 2025 Ignite Realtime Foundation. All rights reserved. | ||||||
| * | ||||||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||||||
| * you may not use this file except in compliance with the License. | ||||||
| * You may obtain a copy of the License at | ||||||
| * | ||||||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||||||
| * | ||||||
| * Unless required by applicable law or agreed to in writing, software | ||||||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||||||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||||
| * See the License for the specific language governing permissions and | ||||||
| * limitations under the License. | ||||||
| */ | ||||||
| package org.jivesoftware.openfire.net; | ||||||
|
|
||||||
| import org.dom4j.Element; | ||||||
| import org.slf4j.Logger; | ||||||
| import org.slf4j.LoggerFactory; | ||||||
|
|
||||||
| import java.util.UUID; | ||||||
|
|
||||||
| /** | ||||||
| * Represents user agent information provided by XMPP clients during authentication. | ||||||
| * This information includes an optional UUID v4 identifier, software description, | ||||||
| * and device description. This information is not exposed to other entities. | ||||||
| */ | ||||||
| public class UserAgentInfo { | ||||||
| private static final Logger Log = LoggerFactory.getLogger(UserAgentInfo.class); | ||||||
|
|
||||||
| private String id; // UUID v4 | ||||||
| private String software; // Software description | ||||||
| private String device; // Device description | ||||||
|
|
||||||
| /** | ||||||
| * Extracts and validates user agent information as from authentication element. | ||||||
|
||||||
| * Extracts and validates user agent information as from authentication element. | |
| * Extracts and validates user agent information from authentication element. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The usingSASL2 flag is hardcoded to false and never updated based on the actual authentication method being used. This means SASL2-specific logic (lines 146-148) will never execute. The code should determine if SASL2 is being used by checking the document element (e.g., "authenticate" vs "auth").