[ 
https://issues.apache.org/jira/browse/CAMEL-27031?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18145693#comment-18145693
 ] 

Guillaume Nodet commented on CAMEL-27031:
-----------------------------------------

This issue is being investigated by a coding agent (on behalf of gnodet).

Code analysis confirms the bug: in MinaSftpOperations.tryConnect(), the catch 
(IOException e) block at line 210 catches all IOExceptions indiscriminately, 
including authentication failures thrown by session.auth().verify() inside 
authenticateSession(). When tryConnect returns false, the connect() method's 
BlockingTask retry loop retries up to maximumReconnectAttempts (default 3) 
times, creating a new session each time and re-sending the wrong password. The 
fix should distinguish SshException auth failures from transient transport 
IOExceptions and propagate them without retrying, following the pattern from 
CAMEL-27019.

_Note: This comment was generated by an AI coding agent and requires manual 
verification._

> camel-mina-sftp - a rejected login is retried maximumReconnectAttempts times, 
> so a wrong password is sent 3 to 6 times per poll
> -------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-27031
>                 URL: https://issues.apache.org/jira/browse/CAMEL-27031
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-mina-sftp
>            Reporter: Federico Mariani
>            Assignee: Guillaume Nodet
>            Priority: Major
>
> With a wrong password, the mina-sftp consumer sends the password 3 times per 
> poll, and 6 times when the server offers both the {{password}} and the 
> {{keyboard-interactive}} methods. {{MinaSftpOperations.tryConnect}} catches 
> any {{IOException}}, including the one that {{session.auth().verify()}} 
> throws when the server rejects the login, so {{connect}} opens a new session 
> for each of the {{maximumReconnectAttempts}} (3). With {{autoCreate=true}} 
> the consumer also connects when it starts, which adds the same count once. 
> Each rejected login counts towards the lockout policy of a server, such as 
> one that locks the account after a few failures.
> {code:java}
> from("mina-sftp://localhost:2222/inbox?username=admin&password=wrong&autoCreate=false&delay=1000";)
>     .to("mock:result");
> {code}
> The passwords that an Apache SSHD server checks, with this route:
> ||Methods of the server||autoCreate||after poll 1||after poll 2||
> |password|false|3|6|
> |keyboard-interactive|false|3|6|
> |password, keyboard-interactive|false|6|12|
> |password, keyboard-interactive|true|12|18|
> Expected: a rejected login ends the reconnect attempts, which still apply to 
> the other connection failures, as CAMEL-27019 does for camel-sftp. With the 
> fix, decide whether the password is also given once per session when the 
> server offers both methods (CAMEL-27019 gives it once per connection in 
> camel-sftp).
> _Claude Code on behalf of Federico Mariani_



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to