This is an automated email from the ASF dual-hosted git repository. tomaswolf pushed a commit to branch rc-2.20.0 in repository https://gitbox.apache.org/repos/asf/mina-sshd.git
commit 530dbdb8ef5de803e84adbb554cad1826640a1be Author: Thomas Wolf <[email protected]> AuthorDate: Wed Sep 23 23:52:57 2026 +0200 ServerUserAuthService: early return for unknown auth methods Return SSH_MSG_USERAUTH_FAILURE early - for unknown authentication methods or - for methods not in the advertised set of methods that can continue. Previous code would in the second case run the authentication method, but then always return a failure. Returning an early failure avoids even running the method. --- .../org/apache/sshd/server/session/ServerUserAuthService.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/sshd-core/src/main/java/org/apache/sshd/server/session/ServerUserAuthService.java b/sshd-core/src/main/java/org/apache/sshd/server/session/ServerUserAuthService.java index 4e43e931f..b9bac54dc 100644 --- a/sshd-core/src/main/java/org/apache/sshd/server/session/ServerUserAuthService.java +++ b/sshd-core/src/main/java/org/apache/sshd/server/session/ServerUserAuthService.java @@ -317,7 +317,13 @@ public class ServerUserAuthService extends AbstractCloseable implements Service, return false; } - // TODO: verify that the service is supported + if ("none".equals(method)) { + return true; + } else if (!authMethods.stream().filter(GenericUtils::isNotEmpty).map(l -> l.get(0)).anyMatch(s -> method.equals(s))) { + log.warn("handleUserAuthRequestMessage({}) client sent method={} not in methods that can proceed {}", session, + method, authMethods); + return true; + } this.authMethod = method; if (debugEnabled) { log.debug(
