Security Advisories (1)
CVE-2026-94140 (2026-10-21)

Rex versions through 1.16.1 for Perl accept an unknown SSH host key for remote rsync transfers because sync hardcodes StrictHostKeyChecking=no. Every remote branch of sync builds its ssh command with that option, for password authentication, for private-key authentication and for the fallback. The ssh options a caller sets through set_openssh_opt reach the OpenSSH transport but not this command, so there is no configuration that restores host key checking for the transfer. An attacker who can redirect the connection before the real host key is known presents their own and the transfer proceeds: under password authentication sync sends the connection password to that server, an upload writes the selected local files to it, and a download writes what it returns to the local destination.

NAME

Rex::FS::File - File Class

DESCRIPTION

This is the File Class used by file_write and file_read.

SYNOPSIS

use Rex::Interface::File;
my $fh = Rex::Interface::File->create('Local');
$fh->open( '<', 'filename' );

my $file = Rex::FS::File->new(fh => $fh);
$file->read($len);
$file->read_all;
$file->write($buf);
$file->close;

CLASS METHODS

new

This is the constructor. You need to set the filehandle which the object should work on or pass a filename. If you pass a filehandle, it has to be a Rex::Interface::File::* object

my $fh = Rex::Interface::File->create('Local');
$fh->open( '<', 'filename' );

my $file = Rex::FS::File->new(fh => $fh);

Create a Rex::FS::File object with a filename

# open a local file in read mode
my $file = Rex::FS::File->new(
  filename => 'filename',
  mode     => 'r', # or '<'
  type     => 'Local',
);

# or shorter
my $file = Rex::FS::File->new( filename => 'filename' );

# open a local file in write mode
my $file = Rex::FS::File->new(
  filename => 'filename',
  mode     => 'w', # or '>'
);

Allowed modes:

<  read
r  read
>  write
w  write
>> append
a  append

For allowed types see documentation of Rex::Interface::File.

write($buf)

Write $buf into the filehandle.

$file->write("Hello World");

seek($offset)

Seek to the file position $offset.

Set the file pointer to the 5th byte.

$file->seek(5);

read($len)

Read $len bytes out of the filehandle.

my $content = $file->read(1024);

read_all

Read everything out of the filehandle.

my $content = $file->read_all;

close

Close the file.

$file->close;