You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mina.apache.org by tw...@apache.org on 2026/03/23 18:10:43 UTC

(mina-sshd) branch dev_3.0 updated (f07a27a0a -> e7f66e756)

This is an automated email from the ASF dual-hosted git repository.

twolf pushed a change to branch dev_3.0
in repository https://gitbox.apache.org/repos/asf/mina-sshd.git


 discard f07a27a0a Post-release documentation updates
 discard 149ebbf42 [maven-release-plugin] prepare for next development iteration
    omit 2e380eb53 [maven-release-plugin] prepare release sshd-3.0.0-M3
    omit d0be41a75 [releng] Pre-release updates
     new e7f66e756 GH-891: Fix format of injected SSH_MSG_IGNORE

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (f07a27a0a)
            \
             N -- N -- N   refs/heads/dev_3.0 (e7f66e756)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 CHANGES.md                                         | 12 ++++-------
 docs/changes/3.0.0-M3.md                           | 23 ----------------------
 docs/changes/version2.md                           |  2 --
 pom.xml                                            |  2 +-
 .../common/session/filters/InjectIgnoreFilter.java |  4 +++-
 .../session/filters/InjectIgnoreFilterTest.java    |  7 ++++++-
 sshd-git/pom.xml                                   |  3 +++
 sshd-ldap/pom.xml                                  |  3 +++
 sshd-mina/pom.xml                                  |  3 +++
 sshd-netty/pom.xml                                 |  3 +++
 sshd-scp/pom.xml                                   |  3 +++
 sshd-sftp/pom.xml                                  |  3 +++
 sshd-site/src/site/markdown/index.md               |  1 -
 sshd-spring-sftp/pom.xml                           |  3 +++
 14 files changed, 35 insertions(+), 37 deletions(-)
 delete mode 100644 docs/changes/3.0.0-M3.md


(mina-sshd) 01/01: GH-891: Fix format of injected SSH_MSG_IGNORE

Posted by tw...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

twolf pushed a commit to branch dev_3.0
in repository https://gitbox.apache.org/repos/asf/mina-sshd.git

commit e7f66e75600d67d00d01ceeb989f6adadb7bcfd7
Author: Thomas Wolf <tw...@apache.org>
AuthorDate: Mon Mar 23 19:05:37 2026 +0100

    GH-891: Fix format of injected SSH_MSG_IGNORE
    
    The message was constructed wrongly as SSH_MSG_IGNORE + (random data)
    instead of as SSH_MSG_IGNORE + (length of random data) + (random data).
    
    This is a bug only in the 3.0 branch; in the 2.x branch the packet is
    constructed correctly.
    
    Our regression tests failed to catch this because neither Apache MINA
    SSHD nor openSSH look at the body of an SSH_MSG_IGNORE packet. Some
    other servers do.
    
    Tighten the InjectIgnoreFilterTest to also verify the full packet
    format.
---
 CHANGES.md                                                         | 1 +
 .../org/apache/sshd/common/session/filters/InjectIgnoreFilter.java | 4 +++-
 .../apache/sshd/common/session/filters/InjectIgnoreFilterTest.java | 7 ++++++-
 3 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/CHANGES.md b/CHANGES.md
index 673920bea..17b8fd673 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -33,6 +33,7 @@ newer Java versions the already built-in cryptographic algorithms for ChaCha20,
 ## Bug Fixes
 
 * [GH-852](https://github.com/apache/mina-sshd/issues/852) Fix wrong import
+* [GH-891](https://github.com/apache/mina-sshd/issues/891) (Regression in 3.0.0-M1) Fix format of injected SSH_MSG_IGNORE
 
 ## Major Code Re-factoring
 
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/session/filters/InjectIgnoreFilter.java b/sshd-core/src/main/java/org/apache/sshd/common/session/filters/InjectIgnoreFilter.java
index dec81bf2b..91ef3a7f8 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/session/filters/InjectIgnoreFilter.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/session/filters/InjectIgnoreFilter.java
@@ -141,10 +141,12 @@ public class InjectIgnoreFilter extends IoFilter {
 
         private Buffer createIgnoreBuffer(int length) {
             int size = length + random.random(length + 1);
-            Buffer buffer = new ByteArrayBuffer(SshConstants.SSH_PACKET_HEADER_LEN + 1 + size + CryptFilter.MAX_PADDING + 64);
+            Buffer buffer = new ByteArrayBuffer(
+                    SshConstants.SSH_PACKET_HEADER_LEN + 1 + Integer.BYTES + size + CryptFilter.MAX_PADDING + 64);
             buffer.rpos(SshConstants.SSH_PACKET_HEADER_LEN);
             buffer.wpos(SshConstants.SSH_PACKET_HEADER_LEN);
             buffer.putByte(SshConstants.SSH_MSG_IGNORE);
+            buffer.putUInt(size);
             int start = buffer.wpos();
             buffer.wpos(buffer.wpos() + size);
             random.fill(buffer.array(), start, size);
diff --git a/sshd-core/src/test/java/org/apache/sshd/common/session/filters/InjectIgnoreFilterTest.java b/sshd-core/src/test/java/org/apache/sshd/common/session/filters/InjectIgnoreFilterTest.java
index d26a29dd9..2a64b06e4 100644
--- a/sshd-core/src/test/java/org/apache/sshd/common/session/filters/InjectIgnoreFilterTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/common/session/filters/InjectIgnoreFilterTest.java
@@ -76,15 +76,20 @@ class InjectIgnoreFilterTest extends FilterTestSupport {
         }
         assertEquals((frequency + 1) * rounds, outputs.outputs.size());
         List<IoWriteFutureWithData> out = outputs.outputs;
+        int foundIgnore = 0;
         for (int i = 0; i < outputs.outputs.size();) {
             for (int j = 0; j < frequency - 1; j++) {
                 Buffer data = out.get(i++).data;
                 assertEquals(-1, data.rawByte(data.rpos()));
             }
             Buffer data = out.get(i++).data;
-            assertEquals(SshConstants.SSH_MSG_IGNORE, data.rawByte(data.rpos()));
+            assertEquals(SshConstants.SSH_MSG_IGNORE, data.getByte());
+            foundIgnore++;
+            long dataLength = data.getUInt();
+            assertEquals(data.available(), dataLength);
             data = out.get(i++).data;
             assertEquals(-1, data.rawByte(data.rpos()));
         }
+        assertEquals(rounds, foundIgnore);
     }
 }