From 54a7da451f54e474e9d0da3e6b62bba986323546 Mon Sep 17 00:00:00 2001 From: Sagar Gurung <46086950+SagarGi@users.noreply.github.com> Date: Fri, 19 Jan 2024 09:33:02 +0545 Subject: [PATCH] [tests-only][full-ci]Forward port `setpassword` and `internallink` (#8245) * [tests-only][full-ci]Added test for banned password to create public link (#8194) * Added test for banned password to create public link Signed-off-by: sagargurung1001@gmail.com * review address Signed-off-by: sagargurung1001@gmail.com --------- Signed-off-by: sagargurung1001@gmail.com * [tests-only][full-ci]Added type internal for share link (public) (#8210) * Added type internal for share link (public) Signed-off-by: sagargurung1001@gmail.com * fix Ci fail Signed-off-by: sagargurung1001@gmail.com --------- Signed-off-by: sagargurung1001@gmail.com --------- Signed-off-by: sagargurung1001@gmail.com --- ...ected-failures-localAPI-on-OCIS-storage.md | 19 ++- .../features/apiSharingNg/linkShare.feature | 108 ++++++++++++++++++ 2 files changed, 117 insertions(+), 10 deletions(-) diff --git a/tests/acceptance/expected-failures-localAPI-on-OCIS-storage.md b/tests/acceptance/expected-failures-localAPI-on-OCIS-storage.md index 72a9ec510..3d8352b86 100644 --- a/tests/acceptance/expected-failures-localAPI-on-OCIS-storage.md +++ b/tests/acceptance/expected-failures-localAPI-on-OCIS-storage.md @@ -260,16 +260,15 @@ The expected failures in this file are from features in the owncloud/ocis repo. - [apiLocks/lockFiles.feature:457](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiLocks/lockFiles.feature#L457) ### [blocksDownload link type is not implemented yet (sharing-ng)](https://github.com/owncloud/ocis/issues/7879) - -- [apiSharingNg/linkShare.feature:78](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSharingNg/linkShare.feature#L78) -- [apiSharingNg/linkShare.feature:147](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSharingNg/linkShare.feature#L147) -- [apiSharingNg/linkShare.feature:225](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSharingNg/linkShare.feature#L225) -- [apiSharingNg/linkShare.feature:301](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSharingNg/linkShare.feature#L301) -- [apiSharingNg/linkShare.feature:372](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSharingNg/linkShare.feature#L372) -- [apiSharingNg/linkShare.feature:445](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSharingNg/linkShare.feature#L445) -- [apiSharingNg/linkShare.feature:447](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSharingNg/linkShare.feature#L447) -- [apiSharingNg/linkShare.feature:448](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSharingNg/linkShare.feature#L448) -- [apiSharingNg/linkShare.feature:449](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSharingNg/linkShare.feature#L449) +- [apiSharingNg/linkShare.feature:79](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSharingNg/linkShare.feature#L79) +- [apiSharingNg/linkShare.feature:149](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSharingNg/linkShare.feature#L149) +- [apiSharingNg/linkShare.feature:228](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSharingNg/linkShare.feature#L228) +- [apiSharingNg/linkShare.feature:305](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSharingNg/linkShare.feature#L305) +- [apiSharingNg/linkShare.feature:377](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSharingNg/linkShare.feature#L377) +- [apiSharingNg/linkShare.feature:451](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSharingNg/linkShare.feature#L451) +- [apiSharingNg/linkShare.feature:453](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSharingNg/linkShare.feature#L453) +- [apiSharingNg/linkShare.feature:455](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSharingNg/linkShare.feature#L455) +- [apiSharingNg/linkShare.feature:456](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSharingNg/linkShare.feature#L456) - [apiSharingNg/deletePermissions.feature:146](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSharingNg/deletePermissions.feature#L146) - [apiSharingNg/deletePermissions.feature:163](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSharingNg/deletePermissions.feature#L163) - [apiSharingNg/deletePermissions.feature:184](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSharingNg/deletePermissions.feature#L184) diff --git a/tests/acceptance/features/apiSharingNg/linkShare.feature b/tests/acceptance/features/apiSharingNg/linkShare.feature index 671fb0fe1..b7259c17a 100644 --- a/tests/acceptance/features/apiSharingNg/linkShare.feature +++ b/tests/acceptance/features/apiSharingNg/linkShare.feature @@ -73,6 +73,7 @@ Feature: Create a share link for a resource | permissionsRole | | view | | edit | + | internal | | upload | | createOnly | | blocksDownload | @@ -144,6 +145,7 @@ Feature: Create a share link for a resource | permissionsRole | | view | | edit | + | internal | | blocksDownload | @issue-7879 @@ -220,6 +222,7 @@ Feature: Create a share link for a resource | permissionsRole | | view | | edit | + | internal | | upload | | createOnly | | blocksDownload | @@ -298,6 +301,7 @@ Feature: Create a share link for a resource | permissionsRole | | view | | edit | + | internal | | blocksDownload | @env-config @issue-7879 @@ -369,6 +373,7 @@ Feature: Create a share link for a resource | permissionsRole | | view | | edit | + | internal | | blocksDownload | @issue-7879 @@ -442,11 +447,14 @@ Feature: Create a share link for a resource Examples: | previousPermissionsRole | newPermissionsRole | | view | edit | + | view | internal | | view | blocksDownload | | edit | view | | edit | blocksDownload | + | view | internal | | blocksDownload | edit | | blocksDownload | blocksDownload | + | view | internal | Scenario: update expiration date of a file's link share @@ -584,3 +592,103 @@ Feature: Create a share link for a resource """ And the public should be able to download file "textfile1.txt" from the last link share with password "%public%" and the content should be "other data" And the public download of file "textfile1.txt" from the last link share with password "$heLlo*1234*" should fail with HTTP status code "401" using shareNg + + + Scenario Outline: create a file's link share with a password that is listed in the Banned-Password-List + Given the config "OCIS_PASSWORD_POLICY_BANNED_PASSWORDS_LIST" has been set to path "config/drone/banned-password-list.txt" + And user "Alice" has uploaded file with content "other data" to "text.txt" + When user "Alice" creates the following link share using the Graph API: + | resourceType | file | + | resource | text.txt | + | space | Personal | + | permissionsRole | view | + | password | | + Then the HTTP status code should be "400" + And the JSON data of the response should match + """ + { + "type": "object", + "required": [ + "error" + ], + "properties": { + "error": { + "type": "object", + "required": [ + "code", + "message" + ], + "properties": { + "code": { + "type": "string", + "pattern": "invalidRequest" + }, + "message": { + "type": "string", + "enum": [ + "unfortunately, your password is commonly used. please pick a harder-to-guess password for your safety" + ] + } + } + } + } + } + """ + Examples: + | banned-password | + | 123 | + | password | + | ownCloud | + + + Scenario Outline: update a file's link share with a password that is listed in the Banned-Password-List + Given the config "OCIS_PASSWORD_POLICY_BANNED_PASSWORDS_LIST" has been set to path "config/drone/banned-password-list.txt" + And user "Alice" has uploaded file with content "other data" to "text.txt" + And user "Alice" has created the following link share: + | resourceType | file | + | resource | text.txt | + | space | Personal | + | permissionsRole | view | + | password | %public% | + When user "Alice" sets the following password for the last link share using the Graph API: + | resourceType | file | + | resource | text.txt | + | space | Personal | + | permissionsRole | view | + | password | | + Then the HTTP status code should be "400" + And the JSON data of the response should match + """ + { + "type": "object", + "required": [ + "error" + ], + "properties": { + "error": { + "type": "object", + "required": [ + "code", + "message" + ], + "properties": { + "code": { + "type": "string", + "pattern": "invalidRequest" + }, + "message": { + "type": "string", + "enum": [ + "unfortunately, your password is commonly used. please pick a harder-to-guess password for your safety" + ] + } + } + } + } + } + """ + Examples: + | banned-password | + | 123 | + | password | + | ownCloud |