From d9298dbb73c9b158e3da40ef97f77dd0c98f1f85 Mon Sep 17 00:00:00 2001 From: KarunAtreya Date: Fri, 23 Jun 2023 09:16:18 +0545 Subject: [PATCH 1/2] added scenarios for overwrite file with virus content in user share --- .../features/apiAntivirus/antivirus.feature | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/tests/acceptance/features/apiAntivirus/antivirus.feature b/tests/acceptance/features/apiAntivirus/antivirus.feature index a4273838ea..2a633027d9 100644 --- a/tests/acceptance/features/apiAntivirus/antivirus.feature +++ b/tests/acceptance/features/apiAntivirus/antivirus.feature @@ -408,3 +408,39 @@ Feature: antivirus | Virus found in test.txt. Upload not possible. Virus: Win.Test.EICAR_HDB-1 | And for user "Brian" the content of the file "/test.txt" of the space "Shares" should be "hello" And the content of file "/test.txt" for user "Alice" should be "hello" + + + Scenario Outline: try to overwrite a file with the virus content in 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 "Alice" has uploaded file with content "hello" to "uploadFolder/test.txt" + And user "Brian" has accepted share "/uploadFolder" offered by user "Alice" + When user "Brian" uploads file with content "X5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*" to "Shares/uploadFolder/test.txt" using the WebDAV API + Then the HTTP status code should be "204" + And user "Brian" should get a notification with subject "Virus found" and message: + | message | + | Virus found in test.txt. Upload not possible. Virus: Win.Test.EICAR_HDB-1 | + And the content of file "Shares/uploadFolder/test.txt" for user "Brian" should be "hello" + And the content of file "uploadFolder/test.txt" for user "Alice" should be "hello" + Examples: + | dav-path-version | + | old | + | new | + + + Scenario: try to overwrite a file with the virus content in 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 uploaded file with content "hello" to "uploadFolder/test.txt" + 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/eicar.com" to "/uploadFolder/test.txt" in space "Shares" using the WebDAV API + Then the HTTP status code should be "204" + And user "Brian" should get a notification with subject "Virus found" and message: + | message | + | Virus found in test.txt. Upload not possible. Virus: Win.Test.EICAR_HDB-1 | + And for user "Brian" the content of the file "/uploadFolder/test.txt" of the space "Shares" should be "hello" + And the content of file "uploadFolder/test.txt" for user "Alice" should be "hello" From 0de8222461befa1ad27d7f7c774b94c0205caaa6 Mon Sep 17 00:00:00 2001 From: KarunAtreya Date: Mon, 26 Jun 2023 10:07:00 +0545 Subject: [PATCH 2/2] adapt the scenario for sharing file as well as file inside a folder --- .../features/apiAntivirus/antivirus.feature | 64 ++++++++++++------- 1 file changed, 42 insertions(+), 22 deletions(-) diff --git a/tests/acceptance/features/apiAntivirus/antivirus.feature b/tests/acceptance/features/apiAntivirus/antivirus.feature index 2a633027d9..98112301a1 100644 --- a/tests/acceptance/features/apiAntivirus/antivirus.feature +++ b/tests/acceptance/features/apiAntivirus/antivirus.feature @@ -409,38 +409,58 @@ Feature: antivirus And for user "Brian" the content of the file "/test.txt" of the space "Shares" should be "hello" And the content of file "/test.txt" for user "Alice" should be "hello" - - Scenario Outline: try to overwrite a file with the virus content in 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 "Alice" has uploaded file with content "hello" to "uploadFolder/test.txt" - And user "Brian" has accepted share "/uploadFolder" offered by user "Alice" - When user "Brian" uploads file with content "X5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*" to "Shares/uploadFolder/test.txt" using the WebDAV API - Then the HTTP status code should be "204" - And user "Brian" should get a notification with subject "Virus found" and message: - | message | - | Virus found in test.txt. Upload not possible. Virus: Win.Test.EICAR_HDB-1 | - And the content of file "Shares/uploadFolder/test.txt" for user "Brian" should be "hello" - And the content of file "uploadFolder/test.txt" for user "Alice" should be "hello" - Examples: - | dav-path-version | - | old | - | new | + + Scenario Outline: try to overwrite a file with the virus content in 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 uploaded file with content "this is a test file." to "uploadFolder/test.txt" + And user "Alice" has shared folder "uploadFolder" with user "Brian" with permissions "all" + And user "Alice" has uploaded file with content "this is a test file." to "/test.txt" + And user "Alice" has shared file "/test.txt" with user "Brian" + And user "Brian" has accepted share "/uploadFolder" offered by user "Alice" + And user "Brian" has accepted share "/test.txt" offered by user "Alice" + When user "Brian" uploads file with content "X5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*" to "Shares/uploadFolder/test.txt" using the WebDAV API + Then the HTTP status code should be "204" + And user "Brian" should get a notification with subject "Virus found" and message: + | message | + | Virus found in test.txt. Upload not possible. Virus: Win.Test.EICAR_HDB-1 | + And the content of file "Shares/uploadFolder/test.txt" for user "Brian" should be "this is a test file." + And the content of file "uploadFolder/test.txt" for user "Alice" should be "this is a test file." + When user "Brian" uploads file with content "X5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*" to "Shares/test.txt" using the WebDAV API + Then the HTTP status code should be "204" + And user "Brian" should get a notification with subject "Virus found" and message: + | message | + | Virus found in test.txt. Upload not possible. Virus: Win.Test.EICAR_HDB-1 | + And the content of file "Shares/test.txt" for user "Brian" should be "this is a test file." + And the content of file "/test.txt" for user "Alice" should be "this is a test file." + Examples: + | dav-path-version | + | old | + | new | Scenario: try to overwrite a file with the virus content in 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 uploaded file with content "hello" to "uploadFolder/test.txt" + And user "Alice" has uploaded file with content "this is a test file." to "uploadFolder/test.txt" And user "Alice" has shared folder "uploadFolder" with user "Brian" with permissions "all" + And user "Alice" has uploaded file with content "this is a test file." to "/test.txt" + And user "Alice" has shared file "/test.txt" with user "Brian" And user "Brian" has accepted share "/uploadFolder" offered by user "Alice" + And user "Brian" has accepted share "/test.txt" offered by user "Alice" When user "Brian" uploads a file "filesForUpload/filesWithVirus/eicar.com" to "/uploadFolder/test.txt" in space "Shares" using the WebDAV API Then the HTTP status code should be "204" And user "Brian" should get a notification with subject "Virus found" and message: | message | | Virus found in test.txt. Upload not possible. Virus: Win.Test.EICAR_HDB-1 | - And for user "Brian" the content of the file "/uploadFolder/test.txt" of the space "Shares" should be "hello" - And the content of file "uploadFolder/test.txt" for user "Alice" should be "hello" + And for user "Brian" the content of the file "/uploadFolder/test.txt" of the space "Shares" should be "this is a test file." + And the content of file "uploadFolder/test.txt" for user "Alice" should be "this is a test file." + When user "Brian" uploads a file "filesForUpload/filesWithVirus/eicar.com" to "/test.txt" in space "Shares" using the WebDAV API + Then the HTTP status code should be "204" + And user "Brian" should get a notification with subject "Virus found" and message: + | message | + | Virus found in test.txt. Upload not possible. Virus: Win.Test.EICAR_HDB-1 | + And for user "Brian" the content of the file "/test.txt" of the space "Shares" should be "this is a test file." + And the content of file "/test.txt" for user "Alice" should be "this is a test file."