From cbf94f18d0e0f917b387b61163aa9d6982649236 Mon Sep 17 00:00:00 2001 From: Swikriti Tripathi Date: Mon, 5 Jun 2023 14:46:07 +0545 Subject: [PATCH 1/8] Add configuration for antivirus in docker compose for tests --- docs/ocis/development/testing.md | 24 ++++++++++++++++++----- tests/acceptance/docker/Makefile | 8 ++++++++ tests/acceptance/docker/src/antivirus.yml | 14 +++++++++++++ tests/acceptance/docker/src/ocis-base.yml | 16 +++++++++++++++ 4 files changed, 57 insertions(+), 5 deletions(-) create mode 100644 tests/acceptance/docker/src/antivirus.yml diff --git a/docs/ocis/development/testing.md b/docs/ocis/development/testing.md index 1d329591533..b6e762df06d 100644 --- a/docs/ocis/development/testing.md +++ b/docs/ocis/development/testing.md @@ -70,11 +70,25 @@ But some test suites that are tagged with `@env-config` require the oCIS server {{< /hint >}} {{< hint info >}} -To run the tests that require an email server (tests tagged with `@email`), you need to provide `START_EMAIL=true` while running the tests. +To run the tests that requires an email server (tests tagged with `@email`), you need to provide `START_EMAIL=true` while running the tests. ```bash START_EMAIL=true \ -BEHAT_FEATURE='tests/acceptance/features/apiEmailNotification/emailNotification.feature' \ +BEHAT_FEATURE='tests/acceptance/features/apiNotification/emailNotification.feature' \ +make -C tests/acceptance/docker test-ocis-feature-ocis-storage +``` + +{{< /hint >}} + +{{< hint info >}} +To run the tests that requires an antivirus service (tests tagged with `@antivirus`), you need to provide following environment variables while running the tests. + +```bash +START_ANTIVIRUS=true \ +OCIS_ASYNC_UPLOADS=true \ +OCIS_ADD_RUN_SERVICES=antivirus \ +POSTPROCESSING_STEPS=virusscan \ +BEHAT_FEATURE='tests/acceptance/features/apiAntivirus/antivirus.feature' \ make -C tests/acceptance/docker test-ocis-feature-ocis-storage ``` @@ -428,7 +442,7 @@ The commands are ubuntu specific and may differ according to your system. You ca #### 2. Setup clamAV With Docker ##### a. Create a Volume -For `clamAV` only local sockets can currently be configured we need to create a volume in order to share the socket with `oCIS server`. Run the following command to do so: +For `clamAV` only local sockets can currently be configured, we need to create a volume in order to share the socket with `oCIS server`. Run the following command to do so: ```bash docker volume create -d local -o device=/your/local/filesystem/path/ -o o=bind -o type=none clamav_vol ``` @@ -442,7 +456,7 @@ The path to the socket i.e. `/var/run/clamav/` may differ as per the image you a {{< /hint>}} ##### b. Change Ownership -Change the ownership of the path of your local filesystem that the volume `clamav_vol` is mounted on. After running `clamav` through docker the ownership of the bound path gets changed. As we need to provide this path to ocis server the ownership should be changed back to $USER or whatever ownership that your server requires. +Change the ownership of the path of your local filesystem that the volume `clamav_vol` is mounted on. After running `clamav` through docker the ownership of the bound path gets changed. As we need to provide this path to ocis server, the ownership should be changed back to $USER or whatever ownership that your server requires. ```bash sudo chown -R $USER:$USER /your/local/filesystem/path/ ``` @@ -451,7 +465,7 @@ Make sure that `clamAV` is fully up before running this command. The command is {{< /hint>}} {{< hint info >}} -If you want to use the same volume after the container is down. Before running the container once again you need to either remove all the data inside `/your/local/filesystem/path/` or give the ownership back. For instance, it ubuntu it might be `sudo chown -R systemd-network:systemd-journal /your/local/filesystem/path/` and repeat step 2 and 3` +If you want to use the same volume after the container is down. Before running the container once again, you either need to remove all the data inside `/your/local/filesystem/path/` or give the ownership back. For instance, on ubuntu it might be `sudo chown -R systemd-network:systemd-journal /your/local/filesystem/path/` and repeat `step 2 and 3` {{< /hint>}} ### Run oCIS diff --git a/tests/acceptance/docker/Makefile b/tests/acceptance/docker/Makefile index eddf0f2314d..2303b5d4ecb 100644 --- a/tests/acceptance/docker/Makefile +++ b/tests/acceptance/docker/Makefile @@ -186,11 +186,19 @@ testSuite: $(OCIS_WRAPPER) build-dev-image clean-docker-container COMPOSE_FILE=src/email.yml \ docker-compose run start_email; \ fi; \ + if [ "${START_ANTIVIRUS}" == "true" ]; then \ + COMPOSE_PROJECT_NAME=$(COMPOSE_PROJECT_NAME) \ + COMPOSE_FILE=src/antivirus.yml \ + docker-compose run start_antivirus; \ + fi; \ COMPOSE_PROJECT_NAME=$(COMPOSE_PROJECT_NAME) \ COMPOSE_FILE=$(COMPOSE_FILE) \ STORAGE_DRIVER=$(STORAGE_DRIVER) \ TEST_SOURCE=$(TEST_SOURCE) \ WITH_WRAPPER=$(WITH_WRAPPER) \ + OCIS_ASYNC_UPLOADS=$(OCIS_ASYNC_UPLOADS) \ + OCIS_ADD_RUN_SERVICES=$(OCIS_ADD_RUN_SERVICES) \ + POSTPROCESSING_STEPS=$(POSTPROCESSING_STEPS) \ OCIS_IMAGE_TAG=$(OCIS_IMAGE_TAG) \ BEHAT_SUITE=$(BEHAT_SUITE) \ BEHAT_FEATURE=$(BEHAT_FEATURE) \ diff --git a/tests/acceptance/docker/src/antivirus.yml b/tests/acceptance/docker/src/antivirus.yml new file mode 100644 index 00000000000..33e2a8259f8 --- /dev/null +++ b/tests/acceptance/docker/src/antivirus.yml @@ -0,0 +1,14 @@ +services: + start_antivirus: + image: dadarek/wait-for-dependencies + depends_on: + - clamav + command: clamav:3310 + clamav: + image: owncloudci/clamavd + volumes: + - clamavSocket:/var/run/clamav/ + +volumes: + clamavSocket: + diff --git a/tests/acceptance/docker/src/ocis-base.yml b/tests/acceptance/docker/src/ocis-base.yml index d6716720dfe..6694dee935b 100644 --- a/tests/acceptance/docker/src/ocis-base.yml +++ b/tests/acceptance/docker/src/ocis-base.yml @@ -22,6 +22,9 @@ services: IDM_CREATE_DEMO_USERS: "true" IDM_ADMIN_PASSWORD: "admin" FRONTEND_SEARCH_MIN_LENGTH: "2" + OCIS_ASYNC_UPLOADS: $OCIS_ASYNC_UPLOADS + OCIS_ADD_RUN_SERVICES: $OCIS_ADD_RUN_SERVICES + # s3ng specific settings STORAGE_USERS_S3NG_ENDPOINT: http://ceph:8080 STORAGE_USERS_S3NG_REGION: default @@ -32,6 +35,19 @@ services: NOTIFICATIONS_SMTP_HOST: email NOTIFICATIONS_SMTP_PORT: 2500 NOTIFICATIONS_SMTP_INSECURE: "true" + + # antivirus + ANTIVIRUS_SCANNER_TYPE: "clamav" + ANTIVIRUS_CLAMAV_SOCKET: "/var/run/clamav/clamd.sock" + + # postprocessing step + POSTPROCESSING_STEPS: $POSTPROCESSING_STEPS volumes: - ../../../config:/drone/src/tests/config - ../../../ociswrapper/bin/ociswrapper:/usr/bin/ociswrapper + - clamavSocket:/var/run/clamav/ + +volumes: + clamavSocket: + external: + name: ocis-acceptance-tests_clamavSocket From 1565868a3069d0f7ebbb821c4eb98f012f4678f6 Mon Sep 17 00:00:00 2001 From: Phil Davis Date: Sat, 10 Jun 2023 09:24:45 +0545 Subject: [PATCH 2/8] Apply suggestions from code review --- docs/ocis/development/testing.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/ocis/development/testing.md b/docs/ocis/development/testing.md index b6e762df06d..4bcc91c6053 100644 --- a/docs/ocis/development/testing.md +++ b/docs/ocis/development/testing.md @@ -70,7 +70,7 @@ But some test suites that are tagged with `@env-config` require the oCIS server {{< /hint >}} {{< hint info >}} -To run the tests that requires an email server (tests tagged with `@email`), you need to provide `START_EMAIL=true` while running the tests. +To run the tests that require an email server (tests tagged with `@email`), you need to provide `START_EMAIL=true` while running the tests. ```bash START_EMAIL=true \ @@ -81,7 +81,7 @@ make -C tests/acceptance/docker test-ocis-feature-ocis-storage {{< /hint >}} {{< hint info >}} -To run the tests that requires an antivirus service (tests tagged with `@antivirus`), you need to provide following environment variables while running the tests. +To run the tests that require an antivirus service (tests tagged with `@antivirus`), you need to provide the following environment variables while running the tests. ```bash START_ANTIVIRUS=true \ @@ -465,7 +465,7 @@ Make sure that `clamAV` is fully up before running this command. The command is {{< /hint>}} {{< hint info >}} -If you want to use the same volume after the container is down. Before running the container once again, you either need to remove all the data inside `/your/local/filesystem/path/` or give the ownership back. For instance, on ubuntu it might be `sudo chown -R systemd-network:systemd-journal /your/local/filesystem/path/` and repeat `step 2 and 3` +If you want to use the same volume after the container is down then before running the container once again, you either need to remove all the data inside `/your/local/filesystem/path/` or give the ownership back. For instance, on Ubuntu it might be `sudo chown -R systemd-network:systemd-journal /your/local/filesystem/path/` and repeat `step 2 and 3` {{< /hint>}} ### Run oCIS From 2445583cbd4653b91c7b08f08e43f4fd79c7540f Mon Sep 17 00:00:00 2001 From: Nalem7 <61624650+nabim777@users.noreply.github.com> Date: Fri, 9 Jun 2023 10:07:15 +0545 Subject: [PATCH 3/8] add test for antivirus public link (#6454) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: nabim777 <“nabinalemagar019@gmail.com”> --- tests/acceptance/config/behat.yml | 1 + .../features/apiAntivirus/antivirus.feature | 45 ++++++++++++++++++- 2 files changed, 45 insertions(+), 1 deletion(-) diff --git a/tests/acceptance/config/behat.yml b/tests/acceptance/config/behat.yml index 2b63ad7e5c7..0631ee4066c 100644 --- a/tests/acceptance/config/behat.yml +++ b/tests/acceptance/config/behat.yml @@ -205,6 +205,7 @@ default: - FilesVersionsContext: - SettingsContext: - OcisConfigContext: + - PublicWebDavContext: extensions: rdx\behatvars\BehatVariablesExtension: ~ diff --git a/tests/acceptance/features/apiAntivirus/antivirus.feature b/tests/acceptance/features/apiAntivirus/antivirus.feature index 0bb5e2b1a19..9049dd14866 100644 --- a/tests/acceptance/features/apiAntivirus/antivirus.feature +++ b/tests/acceptance/features/apiAntivirus/antivirus.feature @@ -4,7 +4,6 @@ Feature: antivirus I want to protect myself and others from known viruses So that I can prevent files with viruses from being uploaded - Background: Given user "Alice" has been created with default attributes and without skeleton files @@ -30,6 +29,7 @@ Feature: antivirus | dav-path-version | | spaces | + Scenario Outline: upload a file with virus Given using DAV path When user "Alice" uploads file "filesForUpload/filesWithVirus/eicar.com" to "/aFileWithVirus.txt" using the WebDAV API @@ -100,3 +100,46 @@ Feature: antivirus Examples: | dav-path-version | | spaces | + + + Scenario Outline: upload a file with the virus to a public share + Given using DAV path + And user "Alice" has created folder "/uploadFolder" + And user "Alice" has created a public link share with settings + | path | /uploadFolder | + | name | sharedlink | + | permissions | change | + | expireDate | 2040-01-01T23:59:59+0100 | + When user "Alice" uploads file "filesForUpload/filesWithVirus/eicar.com" to "/virusFile.txt" using the WebDAV API + Then the HTTP status code should be "201" + And user "Alice" should get a notification with subject "Virus found" and message: + | message | + | Virus found in virusFile.txt. Upload not possible. Virus: Win.Test.EICAR_HDB-1 | + And as "Alice" file "/uploadFolder/virusFile.txt" should not exist + Examples: + | dav-path-version | + | old | + | new | + | spaces | + + + Scenario Outline: upload a file with the virus to a password-protected public share + Given using DAV path + And user "Alice" has created folder "/uploadFolder" + And user "Alice" has created a public link share with settings + | path | /uploadFolder | + | name | sharedlink | + | permissions | change | + | password | newpasswd | + | expireDate | 2040-01-01T23:59:59+0100 | + When user "Alice" uploads file "filesForUpload/filesWithVirus/eicar.com" to "/virusFile.txt" using the WebDAV API + Then the HTTP status code should be "201" + And user "Alice" should get a notification with subject "Virus found" and message: + | message | + | Virus found in virusFile.txt. Upload not possible. Virus: Win.Test.EICAR_HDB-1 | + And as "Alice" file "/uploadFolder/virusFile.txt" should not exist + Examples: + | dav-path-version | + | old | + | new | + | spaces | From 9dc38ee5057d7e39022f2d476ba537ef5c1e38f2 Mon Sep 17 00:00:00 2001 From: Nalem7 <61624650+nabim777@users.noreply.github.com> Date: Mon, 12 Jun 2023 17:12:01 +0545 Subject: [PATCH 4/8] [tests-only][full-ci]add test for antivirus user group sharing (#6463) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * add test for antivirus user and group share * added test for 3 file * deduct of one file --------- Co-authored-by: nabim777 <“nabinalemagar019@gmail.com”> --- .../features/apiAntivirus/antivirus.feature | 85 +++++++++++++++++++ .../features/bootstrap/SpacesContext.php | 22 +++++ 2 files changed, 107 insertions(+) diff --git a/tests/acceptance/features/apiAntivirus/antivirus.feature b/tests/acceptance/features/apiAntivirus/antivirus.feature index 9049dd14866..a2697876e3f 100644 --- a/tests/acceptance/features/apiAntivirus/antivirus.feature +++ b/tests/acceptance/features/apiAntivirus/antivirus.feature @@ -143,3 +143,88 @@ Feature: antivirus | old | | new | | spaces | + + + Scenario Outline: upload a file with virus to a user share + Given using DAV path + And user "Brian" has been created with default attributes and without skeleton files + And user "Alice" has created folder "uploadFolder" + And user "Alice" has shared folder "uploadFolder" with user "Brian" with permissions "all" + And user "Brian" has accepted share "/uploadFolder" offered by user "Alice" + When user "Brian" uploads file "filesForUpload/filesWithVirus/" to "/Shares/uploadFolder/" using the WebDAV API + Then the HTTP status code should be "201" + And user "Brian" should get a notification with subject "Virus found" and message: + | message | + | Virus found in . Upload not possible. Virus: Win.Test.EICAR_HDB-1 | + And as "Brian" file "/Shares/uploadFolder/" should not exist + And as "Alice" file "/uploadFolder/" should not exist + Examples: + | dav-path-version | filename | newfilename | + | old | eicar.com | virusFile1.txt | + | old | eicar_com.zip | virusFile2.zip | + | new | eicar.com | virusFile1.txt | + | new | eicar_com.zip | virusFile2.zip | + + + Scenario Outline: upload a file with virus to a user share using spaces dav endpoint + Given using spaces DAV path + And user "Brian" has been created with default attributes and without skeleton files + And user "Alice" has created folder "uploadFolder" + And user "Alice" has shared folder "uploadFolder" with user "Brian" with permissions "all" + And user "Brian" has accepted share "/uploadFolder" offered by user "Alice" + When user "Brian" uploads a file "filesForUpload/filesWithVirus/" to "/uploadFolder/" in space "Shares" using the WebDAV API + Then the HTTP status code should be "201" + And user "Brian" should get a notification with subject "Virus found" and message: + | message | + | Virus found in . Upload not possible. Virus: Win.Test.EICAR_HDB-1 | + And as "Brian" file "/Shares/uploadFolder/" should not exist + And as "Alice" file "/uploadFolder/" should not exist + Examples: + | filename | newfilename | + | eicar.com | virusFile1.txt | + | eicar_com.zip | virusFile2.zip | + + + Scenario Outline: upload a file with virus to a group share + Given using DAV path + And user "Brian" has been created with default attributes and without skeleton files + And group "group1" has been created + And user "Brian" has been added to group "group1" + And user "Alice" has created folder "uploadFolder" + And user "Alice" has shared folder "uploadFolder" with group "group1" + And user "Brian" has accepted share "/uploadFolder" offered by user "Alice" + When user "Brian" uploads file "filesForUpload/filesWithVirus/" to "/Shares/uploadFolder/" using the WebDAV API + Then the HTTP status code should be "201" + And user "Brian" should get a notification with subject "Virus found" and message: + | message | + | Virus found in . Upload not possible. Virus: Win.Test.EICAR_HDB-1 | + And as "Brian" file "/Shares/uploadFolder/" should not exist + And as "Alice" file "/uploadFolder/" should not exist + Examples: + | dav-path-version | filename | newfilename | + | old | eicar.com | virusFile1.txt | + | old | eicar_com.zip | virusFile2.zip | + | new | eicar.com | virusFile1.txt | + | new | eicar_com.zip | virusFile2.zip | + + + Scenario Outline: upload a file with virus to a group share using spaces dav endpoint + Given using spaces DAV path + And user "Brian" has been created with default attributes and without skeleton files + And group "group1" has been created + And user "Brian" has been added to group "group1" + And user "Alice" has created folder "uploadFolder" + And user "Alice" has shared folder "uploadFolder" with group "group1" + And user "Brian" has accepted share "/uploadFolder" offered by user "Alice" + When user "Brian" uploads a file "filesForUpload/filesWithVirus/" to "/uploadFolder/" in space "Shares" using the WebDAV API + Then the HTTP status code should be "201" + And user "Brian" should get a notification with subject "Virus found" and message: + | message | + | Virus found in . Upload not possible. Virus: Win.Test.EICAR_HDB-1 | + And as "Brian" file "/Shares/uploadFolder/" should not exist + And as "Alice" file "/uploadFolder/" should not exist + Examples: + | filename | newfilename | + | eicar.com | virusFile1.txt | + | eicar_com.zip | virusFile2.zip | + diff --git a/tests/acceptance/features/bootstrap/SpacesContext.php b/tests/acceptance/features/bootstrap/SpacesContext.php index 30bdfe02708..d985c95a5d4 100644 --- a/tests/acceptance/features/bootstrap/SpacesContext.php +++ b/tests/acceptance/features/bootstrap/SpacesContext.php @@ -1228,6 +1228,28 @@ class SpacesContext implements Context { $this->featureContext->uploadFileWithContent($user, $content, $destination); } + /** + * @When /^user "([^"]*)" uploads a file "([^"]*)" to "([^"]*)" in space "([^"]*)" using the WebDAV API$/ + * + * @param string $user + * @param string $source + * @param string $destination + * @param string $spaceName + * + * @return void + * @throws GuzzleException + * @throws Exception + */ + public function theUserUploadsALocalFileToSpace( + string $user, + string $source, + string $destination, + string $spaceName + ): void { + $this->setSpaceIDByName($user, $spaceName); + $this->featureContext->userUploadsAFileTo($user, $source, $destination); + } + /** * @When /^user "([^"]*)" uploads a file inside space "([^"]*)" owned by the user "([^"]*)" with content "([^"]*)" to "([^"]*)" using the WebDAV API$/ * From 4d9729df75b1e09f24fe5de7cd3f0818bf21424e Mon Sep 17 00:00:00 2001 From: Nalem7 <61624650+nabim777@users.noreply.github.com> Date: Tue, 13 Jun 2023 14:36:17 +0545 Subject: [PATCH 5/8] add tests for project space (#6485) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: nabim777 <“nabinalemagar019@gmail.com”> --- .../features/apiAntivirus/antivirus.feature | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/tests/acceptance/features/apiAntivirus/antivirus.feature b/tests/acceptance/features/apiAntivirus/antivirus.feature index a2697876e3f..1fb5527f91b 100644 --- a/tests/acceptance/features/apiAntivirus/antivirus.feature +++ b/tests/acceptance/features/apiAntivirus/antivirus.feature @@ -228,3 +228,50 @@ Feature: antivirus | eicar.com | virusFile1.txt | | eicar_com.zip | virusFile2.zip | + + Scenario Outline: upload a file with virus to a project space + Given using spaces DAV path + And the administrator has given "Alice" the role "Space Admin" using the settings api + And user "Alice" has created a space "new-space" with the default quota using the GraphApi + And user "Alice" has created a folder "uploadFolder" in space "new-space" + When user "Alice" uploads a file "filesForUpload/filesWithVirus/" to "/uploadFolder/" in space "new-space" using the WebDAV API + Then the HTTP status code should be "201" + And user "Alice" should get a notification with subject "Virus found" and message: + | message | + | Virus found in . Upload not possible. Virus: Win.Test.EICAR_HDB-1 | + And for user "Alice" the space "new-space" should not contain these entries: + | /uploadFolder/ | + When user "Alice" uploads a file "filesForUpload/filesWithVirus/" to "/" in space "new-space" using the WebDAV API + Then the HTTP status code should be "201" + And user "Alice" should get a notification with subject "Virus found" and message: + | message | + | Virus found in . Upload not possible. Virus: Win.Test.EICAR_HDB-1 | + And for user "Alice" the space "new-space" should not contain these entries: + | / | + Examples: + | filename | newfilename | + | eicar.com | virusFile1.txt | + | eicar_com.zip | virusFile2.zip | + + + Scenario Outline: upload a file with virus to a shared project space + Given using spaces DAV path + And user "Brian" has been created with default attributes and without skeleton files + And the administrator has given "Alice" the role "Space Admin" using the settings api + And user "Alice" has created a space "new-space" with the default quota using the GraphApi + And user "Alice" has shared a space "new-space" with settings: + | shareWith | Brian | + | role | editor | + When user "Brian" uploads a file "/filesForUpload/filesWithVirus/" to "/" in space "new-space" using the WebDAV API + Then the HTTP status code should be "201" + And user "Brian" should get a notification with subject "Virus found" and message: + | message | + | Virus found in . Upload not possible. Virus: Win.Test.EICAR_HDB-1 | + And for user "Brian" the space "new-space" should not contain these entries: + | / | + And for user "Alice" the space "new-space" should not contain these entries: + | / | + Examples: + | filename | newfilename | + | eicar.com | virusFile1.txt | + | eicar_com.zip | virusFile2.zip | From 87e5d8aa939942c440e86de67808e5e88b44f03d Mon Sep 17 00:00:00 2001 From: Swikriti Tripathi Date: Wed, 7 Jun 2023 16:52:27 +0545 Subject: [PATCH 6/8] Skip antivirus related tests in reva --- .../features/apiAntivirus/antivirus.feature | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/tests/acceptance/features/apiAntivirus/antivirus.feature b/tests/acceptance/features/apiAntivirus/antivirus.feature index 1fb5527f91b..ee8d983748b 100644 --- a/tests/acceptance/features/apiAntivirus/antivirus.feature +++ b/tests/acceptance/features/apiAntivirus/antivirus.feature @@ -1,4 +1,4 @@ -@api @antivirus +@api @antivirus @skipOnReva Feature: antivirus As a system administrator and user I want to protect myself and others from known viruses @@ -23,10 +23,6 @@ Feature: antivirus | dav-path-version | | old | | new | - - @skipOnRevaMaster - Examples: - | dav-path-version | | spaces | @@ -43,10 +39,6 @@ Feature: antivirus | dav-path-version | | old | | new | - - @skipOnRevaMaster - Examples: - | dav-path-version | | spaces | @@ -72,10 +64,6 @@ Feature: antivirus | dav-path-version | | old | | new | - - @skipOnRevaMaster - Examples: - | dav-path-version | | spaces | @@ -95,10 +83,6 @@ Feature: antivirus Examples: | dav-path-version | | old | - - @skipOnRevaMaster - Examples: - | dav-path-version | | spaces | From 165aa209b64b37ea45a7434a353ec27ef39f98cb Mon Sep 17 00:00:00 2001 From: Sabin Panta <64484313+S-Panta@users.noreply.github.com> Date: Wed, 14 Jun 2023 12:26:10 +0545 Subject: [PATCH 7/8] add tests by setting ANTIVIRUS_MAX_SCAN_SIZE env (#6484) --- .../features/apiAntivirus/antivirus.feature | 29 ++++++++++++++++++ .../filesWithVirus/eicarcom2.zip | Bin 308 -> 0 bytes 2 files changed, 29 insertions(+) delete mode 100644 tests/acceptance/filesForUpload/filesWithVirus/eicarcom2.zip diff --git a/tests/acceptance/features/apiAntivirus/antivirus.feature b/tests/acceptance/features/apiAntivirus/antivirus.feature index ee8d983748b..87fcca24b99 100644 --- a/tests/acceptance/features/apiAntivirus/antivirus.feature +++ b/tests/acceptance/features/apiAntivirus/antivirus.feature @@ -259,3 +259,32 @@ Feature: antivirus | filename | newfilename | | eicar.com | virusFile1.txt | | eicar_com.zip | virusFile2.zip | + + @env-config + Scenario Outline: upload a file with virus smaller than the upload threshold + Given the config "ANTIVIRUS_MAX_SCAN_SIZE" has been set to "100" + And using DAV path + When user "Alice" uploads file "filesForUpload/filesWithVirus/eicar.com" to "/aFileWithVirus.txt" using the WebDAV API + Then the HTTP status code should be "201" + And user "Alice" should get a notification with subject "Virus found" and message: + | message | + | Virus found in aFileWithVirus.txt. Upload not possible. Virus: Win.Test.EICAR_HDB-1 | + And as "Alice" file "/aFileWithVirus.txt" should not exist + Examples: + | dav-path-version | + | old | + | new | + | spaces | + + @env-config + Scenario Outline: upload a file with virus larger than the upload threshold + Given the config "ANTIVIRUS_MAX_SCAN_SIZE" has been set to "100" + And using DAV path + When user "Alice" uploads file "filesForUpload/filesWithVirus/eicar_com.zip" to "/aFileWithVirus.txt" using the WebDAV API + Then the HTTP status code should be "201" + And as "Alice" file "/aFileWithVirus.txt" should exist + Examples: + | dav-path-version | + | old | + | new | + | spaces | \ No newline at end of file diff --git a/tests/acceptance/filesForUpload/filesWithVirus/eicarcom2.zip b/tests/acceptance/filesForUpload/filesWithVirus/eicarcom2.zip deleted file mode 100644 index 4bda6119ad1e57f1087d87804a0dfab63e1e4f46..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 308 zcmWIWW@h1H00E;luQe_z+&0_+WP>m-5T|A)ClxQ@nhv>R_`nW2pcxZcQ1$Z+ui7-Iih0QXceGH5Y3Jm`nK`gK?7#YlgjBF5x0ogEYo&+lb8nz8#7{bd41FeDT9)r~a0HhZ{KL7v# From aca08a6933baf2bb8d1e415c77e912038eedb89f Mon Sep 17 00:00:00 2001 From: Nalem7 <61624650+nabim777@users.noreply.github.com> Date: Wed, 14 Jun 2023 15:30:00 +0545 Subject: [PATCH 8/8] update public sharing test for zip virus file (#6506) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: nabim777 <“nabinalemagar019@gmail.com”> --- .../features/apiAntivirus/antivirus.feature | 34 +++++++++++-------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/tests/acceptance/features/apiAntivirus/antivirus.feature b/tests/acceptance/features/apiAntivirus/antivirus.feature index 87fcca24b99..a74dd31ddd7 100644 --- a/tests/acceptance/features/apiAntivirus/antivirus.feature +++ b/tests/acceptance/features/apiAntivirus/antivirus.feature @@ -94,17 +94,20 @@ Feature: antivirus | name | sharedlink | | permissions | change | | expireDate | 2040-01-01T23:59:59+0100 | - When user "Alice" uploads file "filesForUpload/filesWithVirus/eicar.com" to "/virusFile.txt" using the WebDAV API + When user "Alice" uploads file "filesForUpload/filesWithVirus/" to "/" using the WebDAV API Then the HTTP status code should be "201" And user "Alice" should get a notification with subject "Virus found" and message: | message | - | Virus found in virusFile.txt. Upload not possible. Virus: Win.Test.EICAR_HDB-1 | - And as "Alice" file "/uploadFolder/virusFile.txt" should not exist + | Virus found in . Upload not possible. Virus: Win.Test.EICAR_HDB-1 | + And as "Alice" file "/uploadFolder/" should not exist Examples: - | dav-path-version | - | old | - | new | - | spaces | + | dav-path-version | filename | newfilename | + | old | eicar.com | virusFile1.txt | + | old | eicar_com.zip | virusFile2.zip | + | new | eicar.com | virusFile1.txt | + | new | eicar_com.zip | virusFile2.zip | + | spaces | eicar.com | virusFile1.txt | + | spaces | eicar_com.zip | virusFile2.zip | Scenario Outline: upload a file with the virus to a password-protected public share @@ -116,17 +119,20 @@ Feature: antivirus | permissions | change | | password | newpasswd | | expireDate | 2040-01-01T23:59:59+0100 | - When user "Alice" uploads file "filesForUpload/filesWithVirus/eicar.com" to "/virusFile.txt" using the WebDAV API + When user "Alice" uploads file "filesForUpload/filesWithVirus/" to "/" using the WebDAV API Then the HTTP status code should be "201" And user "Alice" should get a notification with subject "Virus found" and message: | message | - | Virus found in virusFile.txt. Upload not possible. Virus: Win.Test.EICAR_HDB-1 | - And as "Alice" file "/uploadFolder/virusFile.txt" should not exist + | Virus found in . Upload not possible. Virus: Win.Test.EICAR_HDB-1 | + And as "Alice" file "/uploadFolder/" should not exist Examples: - | dav-path-version | - | old | - | new | - | spaces | + | dav-path-version | filename | newfilename | + | old | eicar.com | virusFile1.txt | + | old | eicar_com.zip | virusFile2.zip | + | new | eicar.com | virusFile1.txt | + | new | eicar_com.zip | virusFile2.zip | + | spaces | eicar.com | virusFile1.txt | + | spaces | eicar_com.zip | virusFile2.zip | Scenario Outline: upload a file with virus to a user share