Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 Bug Report: ClamAv::fileScanInStream does not detect eicar.com file #26

Open
2 tasks done
vagiguere opened this issue May 24, 2023 · 2 comments · May be fixed by #27 or #32
Open
2 tasks done

🐛 Bug Report: ClamAv::fileScanInStream does not detect eicar.com file #26

vagiguere opened this issue May 24, 2023 · 2 comments · May be fixed by #27 or #32
Labels
bug Something isn't working

Comments

@vagiguere
Copy link

👟 Reproduction steps

Download the "eicar.com" or the "eicar.com.txt" file from https://www.eicar.org/download-anti-malware-testfile/

$clam = new Network($host, $port);
$is_clean = $clam->fileScanInStream('path/to/eicar/file');

The function is supposed to return false, instead it returns true.
This behavior happen with both "eicar.com" and "eicar.com.txt" files but not with zip files.

The problem seem to happen with text files of less than 8192 bytes.

In Appwrite\ClamAv\ClamAv:107 the fread return an empty string which is sent to the socket. The problem is ClamAv does not detect the eicar file if this empty string is packed and send through the socket.

👍 Expected behavior

in the example above the $is_clean variable should be false.

👎 Actual Behavior

In the exemple above the $is_clean variable is true.

🎲 PHP ClamAV version

Different version (specify in environment)

💻 Operating system

Linux

🧱 Your Environment

Version : appwrite/php-clamav:2.0.0
PHP 8.2 (also with 8.1) in a docker container
Clamav in another docker container : https://hub.docker.com/r/clamav/clamav/

👀 Have you spent some time to check if this issue has been raised before?

  • I checked and didn't find similar issue

🏢 Have you read the Code of Conduct?

@vagiguere vagiguere added the bug Something isn't working label May 24, 2023
SoftCreatR added a commit to SoftCreatR/php-clamav that referenced this issue Oct 10, 2023
This PR introduces support for DSN connection strings to simplify the configuration process. Users can now use a single string to determine the type of connection (`Network` or `Pipe`) and its details.

This PR resolves appwrite#28, closes appwrite#25, resolves appwrite#26, closes appwrite#27, closes appwrite#31

### Changes:

1. Added a static `createFromDSN` method to the `ClamAV` abstract class. This method parses the provided DSN string and returns an appropriate instance (`Network` or `Pipe`).
2. Updated the `ClamAVTest` unit test to cover the new DSN creation functionality.
3. Updated composer dependencies
4. Applied smaller code, and documentation optimizations
5. Updated README

### Usage:

Users can now initialize a connection using a DSN string:

```php
$clam = ClamAV::createFromDSN('tcp://localhost:3310');
$version = $clam->version();
```

This approach provides a more flexible and user-friendly way to set up a connection.

### Testing:

The existing unit tests have been updated accordingly.
@SoftCreatR SoftCreatR linked a pull request Oct 10, 2023 that will close this issue
SoftCreatR added a commit to SoftCreatR/php-clamav that referenced this issue Oct 10, 2023
This PR introduces support for DSN connection strings to simplify the configuration process. Users can now use a single string to determine the type of connection (`Network` or `Pipe`) and its details.

This PR resolves appwrite#28, closes appwrite#25, resolves appwrite#26, closes appwrite#27, closes appwrite#31

1. Added a static `createFromDSN` method to the `ClamAV` abstract class. This method parses the provided DSN string and returns an appropriate instance (`Network` or `Pipe`).
2. Updated the `ClamAVTest` unit test to cover the new DSN creation functionality.
3. Updated composer dependencies
4. Applied smaller code, and documentation optimizations
5. Improved code coverage
6. Updated README

Users can now initialize a connection using a DSN string:

```php
$clam = ClamAV::createFromDSN('tcp://localhost:3310');
$version = $clam->version();
```

This approach provides a more flexible and user-friendly way to set up a connection.

The existing unit tests have been updated accordingly.
SoftCreatR added a commit to SoftCreatR/php-clamav that referenced this issue Oct 10, 2023
This PR introduces support for DSN connection strings to simplify the configuration process. Users can now use a single string to determine the type of connection (`Network` or `Pipe`) and its details.

This PR resolves appwrite#28, closes appwrite#25, resolves appwrite#26, closes appwrite#27, closes appwrite#31

1. Added a static `createFromDSN` method to the `ClamAV` abstract class. This method parses the provided DSN string and returns an appropriate instance (`Network` or `Pipe`).
2. Updated the `ClamAVTest` unit test to cover the new DSN creation functionality.
3. Updated composer dependencies
4. Applied smaller code, and documentation optimizations
5. Improved code coverage
6. Updated README

Users can now initialize a connection using a DSN string:

```php
$clam = ClamAV::createFromDSN('tcp://localhost:3310');
$version = $clam->version();
```

This approach provides a more flexible and user-friendly way to set up a connection.

The existing unit tests have been updated accordingly.
@pehbehbeh
Copy link

Same problem here. Have you been able to find a solution?

@vagiguere
Copy link
Author

Yes, the PR here (#27).
I'm gonna test the changes from #27 (comment) and hope the appwrite team will accept the PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
2 participants