Skip to content

fix(ftp): honor FTPS security type and connect arg order - #2990

Open
Elitex07 wants to merge 2 commits into
Acode-Foundation:mainfrom
Elitex07:fix/ftps-security-type
Open

Elitex07 wants to merge 2 commits into
Acode-Foundation:mainfrom
Elitex07:fix/ftps-security-type

Conversation

@Elitex07

Copy link
Copy Markdown
Contributor

Fixes #2979

What

Ftp.java read the connect args at the wrong indexes. JS sends host, port, username, password, connectionMode, securityType, encoding, but Java read connectionMode from index 6 and never used securityType. Result: FTPS was ignored (always plain FTP) and active mode could never be enabled.

Fix

  • Read args at the correct indexes.
  • Create FTPSClient(false) (explicit FTPS, AUTH TLS) when securityType is ftps, otherwise FTPClient.
  • After login, send PBSZ 0 + PROT P so the data channel is encrypted too.

No new dependency (FTPSClient ships with commons-net 3.12.0) and no JS change.

Testing

On an emulator against a local pyftpdlib server requiring TLS on control + data:

  • Before: login rejected (550 SSL/TLS required on the control channel).
  • After: AUTH TLS / PBSZ / PROT succeed; login, list, read and write work.
  • Plain FTP still works.
  • Active mode now sends PORT (full transfer not checked, emulator networking can't accept the back-connection).

Not covered (possible follow-ups)

  • Certificate validation (FTPSClient trusts any cert by default).
  • TLS session reuse for servers that require it (e.g. vsftpd require_ssl_reuse=YES).
  • Implicit FTPS (port 990).

Ftp.java read the connect args at the wrong indexes (JS sends host,
port, username, password, connectionMode, securityType, encoding), so
active mode could never be enabled, and securityType was read but never
used, so every connection was plain FTP.

Use explicit FTPSClient (AUTH TLS) when securityType is "ftps" and send
PBSZ 0 / PROT P after login so the data channel is encrypted too.

Fixes Acode-Foundation#2979
@greptile-apps

greptile-apps Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; the previous cached-connection issue is fixed.

Summary

Fixes FTP connection arguments and enables explicit FTPS.

  • FTP connections now honor the requested mode and security.

Elitex07 explicitly leaves certificate validation, TLS session reuse, and implicit FTPS for possible follow-ups.

Reviews (2) · Last reviewed commit: "fix(ftp): don't reuse cached client acro..." · Reviewed by Greptile

Comment thread src/plugins/ftp/src/android/com/foxdebug/ftp/Ftp.java
The profile id ignores security type and editing a profile does not disconnect, so switching FTP to FTPS could keep returning the old plain client. Only reuse the cached client when its type matches.
@Elitex07

Copy link
Copy Markdown
Contributor Author

@greptile review again

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

FTPS option in "Add FTP" is ignored by the native plugin – connections always use plain FTP

1 participant