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

Tests for accessing webDav endpoints with invalid authentication #36601

Merged
merged 1 commit into from
Dec 17, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion tests/TestHelpers/WebDavHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,6 @@ public static function makeDavRequest(
}
}
}

return HttpRequestHelper::sendRequest(
$fullUrl, $method, $user, $password, $headers, $body, $config, null,
$stream, $timeout, $client
Expand Down
40 changes: 40 additions & 0 deletions tests/acceptance/features/apiAuthWebDav/webDavMKCOLAuth.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
@api @TestAlsoOnExternalUserBackend
Feature: get file info using MKCOL

Background:
Given user "user0" has been created with default attributes and skeleton files
And user "user1" has been created with default attributes and without skeleton files

Scenario: send MKCOL requests to webDav endpoints as normal user with wrong password
When user "user0" requests these endpoints with "MKCOL" including body using password "invalid" then the status codes should be as listed
| endpoint | http-code | body |
| /remote.php/webdav/textfile0.txt | 401 | doesnotmatter |
| /remote.php/dav/files/user0/textfile0.txt | 401 | doesnotmatter |
| /remote.php/webdav/PARENT | 401 | doesnotmatter |
| /remote.php/dav/files/user0/PARENT | 401 | doesnotmatter |
| /remote.php/dav/files/user0/PARENT/parent.txt | 401 | doesnotmatter |

Scenario: send MKCOL requests to webDav endpoints as normal user with no password
When user "user0" requests these endpoints with "MKCOL" including body using password "" then the status codes should be as listed
| endpoint | http-code | body |
| /remote.php/webdav/textfile0.txt | 401 | doesnotmatter |
| /remote.php/dav/files/user0/textfile0.txt | 401 | doesnotmatter |
| /remote.php/webdav/PARENT | 401 | doesnotmatter |
| /remote.php/dav/files/user0/PARENT | 401 | doesnotmatter |
| /remote.php/dav/files/user0/PARENT/parent.txt | 401 | doesnotmatter |

Scenario: send MKCOL requests to another user's webDav endpoints as normal user
When user "user1" requests these endpoints with "MKCOL" including body then the status codes should be as listed
| endpoint | http-code | body |
| /remote.php/dav/files/user0/textfile0.txt | 403 | |
| /remote.php/dav/files/user0/PARENT | 403 | |
| /remote.php/dav/files/user0/PARENT/parent.txt | 409 | |

Scenario: send MKCOL requests to webDav endpoints using invalid username but correct password
When user "usero" requests these endpoints with "MKCOL" including body using the password of user "user0" then the status codes should be as listed
| endpoint | http-code | body |
| /remote.php/webdav/textfile0.txt | 401 | doesnotmatter |
| /remote.php/dav/files/user0/textfile0.txt | 401 | doesnotmatter |
| /remote.php/webdav/PARENT | 401 | doesnotmatter |
| /remote.php/dav/files/user0/PARENT | 401 | doesnotmatter |
| /remote.php/dav/files/user0/PARENT/parent.txt | 401 | doesnotmatter |
40 changes: 40 additions & 0 deletions tests/acceptance/features/apiAuthWebDav/webDavPOSTAuth.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
@api @TestAlsoOnExternalUserBackend
Feature: get file info using POST

Background:
Given user "user0" has been created with default attributes and skeleton files
And user "user1" has been created with default attributes and without skeleton files

Scenario: send POST requests to webDav endpoints as normal user with wrong password
When user "user0" requests these endpoints with "POST" including body using password "invalid" then the status codes should be as listed
| endpoint | http-code | body |
| /remote.php/webdav/textfile0.txt | 401 | doesnotmatter |
| /remote.php/dav/files/user0/textfile0.txt | 401 | doesnotmatter |
| /remote.php/webdav/PARENT | 401 | doesnotmatter |
| /remote.php/dav/files/user0/PARENT | 401 | doesnotmatter |
| /remote.php/dav/files/user0/PARENT/parent.txt | 401 | doesnotmatter |

Scenario: send POST requests to webDav endpoints as normal user with no password
When user "user0" requests these endpoints with "POST" including body using password "" then the status codes should be as listed
| endpoint | http-code | body |
| /remote.php/webdav/textfile0.txt | 401 | doesnotmatter |
| /remote.php/dav/files/user0/textfile0.txt | 401 | doesnotmatter |
| /remote.php/webdav/PARENT | 401 | doesnotmatter |
| /remote.php/dav/files/user0/PARENT | 401 | doesnotmatter |
| /remote.php/dav/files/user0/PARENT/parent.txt | 401 | doesnotmatter |

Scenario: send POST requests to another user's webDav endpoints as normal user
When user "user1" requests these endpoints with "POST" including body then the status codes should be as listed
| endpoint | http-code | body |
| /remote.php/dav/files/user0/textfile1.txt | 404 | doesnotmatter |
| /remote.php/dav/files/user0/PARENTS | 404 | doesnotmatter |
| /remote.php/dav/files/user0/PARENTS/parent.txt | 404 | doesnotmatter |

Scenario: send POST requests to webDav endpoints using invalid username but correct password
When user "usero" requests these endpoints with "POST" including body using the password of user "user0" then the status codes should be as listed
| endpoint | http-code | body |
| /remote.php/webdav/textfile0.txt | 401 | doesnotmatter |
| /remote.php/dav/files/user0/textfile0.txt | 401 | doesnotmatter |
| /remote.php/webdav/PARENT | 401 | doesnotmatter |
| /remote.php/dav/files/user0/PARENT | 401 | doesnotmatter |
| /remote.php/dav/files/user0/PARENT/parent.txt | 401 | doesnotmatter |
40 changes: 40 additions & 0 deletions tests/acceptance/features/apiAuthWebDav/webDavPROPFINDAuth.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
@api @TestAlsoOnExternalUserBackend
Feature: get file info using PROPFIND

Background:
Given user "user0" has been created with default attributes and skeleton files
And user "user1" has been created with default attributes and without skeleton files

Scenario: send PROPFIND requests to webDav endpoints as normal user with wrong password
When user "user0" requests these endpoints with "PROPFIND" including body using password "invalid" then the status codes should be as listed
| endpoint | http-code | body |
| /remote.php/webdav/textfile0.txt | 401 | doesnotmatter |
| /remote.php/dav/files/user0/textfile0.txt | 401 | doesnotmatter |
| /remote.php/webdav/PARENT | 401 | doesnotmatter |
| /remote.php/dav/files/user0/PARENT | 401 | doesnotmatter |
| /remote.php/dav/files/user0/PARENT/parent.txt | 401 | doesnotmatter |

Scenario: send PROPFIND requests to webDav endpoints as normal user with no password
When user "user0" requests these endpoints with "PROPFIND" including body using password "" then the status codes should be as listed
| endpoint | http-code | body |
| /remote.php/webdav/textfile0.txt | 401 | doesnotmatter |
| /remote.php/dav/files/user0/textfile0.txt | 401 | doesnotmatter |
| /remote.php/webdav/PARENT | 401 | doesnotmatter |
| /remote.php/dav/files/user0/PARENT | 401 | doesnotmatter |
| /remote.php/dav/files/user0/PARENT/parent.txt | 401 | doesnotmatter |

Scenario: send PROPFIND requests to another user's webDav endpoints as normal user
When user "user1" requests these endpoints with "PROPFIND" including body then the status codes should be as listed
| endpoint | http-code | body |
| /remote.php/dav/files/user0/textfile0.txt | 404 | <?xml version="1.0"?><d:propfind xmlns:d="DAV:" xmlns:oc="http://owncloud.org/ns"><d:prop><d:getetag /></d:prop></d:propfind> |
| /remote.php/dav/files/user0/PARENT | 404 | <?xml version="1.0"?><d:propfind xmlns:d="DAV:" xmlns:oc="http://owncloud.org/ns"><d:prop><d:getetag /></d:prop></d:propfind> |
| /remote.php/dav/files/user0/PARENT/parent.txt | 404 | <?xml version="1.0"?><d:propfind xmlns:d="DAV:" xmlns:oc="http://owncloud.org/ns"><d:prop><d:getetag /></d:prop></d:propfind> |

Scenario: send PROPFIND requests to webDav endpoints using invalid username but correct password
When user "usero" requests these endpoints with "PROPFIND" including body using the password of user "user0" then the status codes should be as listed
| endpoint | http-code | body |
| /remote.php/webdav/textfile0.txt | 401 | doesnotmatter |
| /remote.php/dav/files/user0/textfile0.txt | 401 | doesnotmatter |
| /remote.php/webdav/PARENT | 401 | doesnotmatter |
| /remote.php/dav/files/user0/PARENT | 401 | doesnotmatter |
| /remote.php/dav/files/user0/PARENT/parent.txt | 401 | doesnotmatter |
40 changes: 40 additions & 0 deletions tests/acceptance/features/apiAuthWebDav/webDavPUTAuth.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
@api @TestAlsoOnExternalUserBackend
Feature: get file info using PUT

Background:
Given user "user0" has been created with default attributes and skeleton files
And user "user1" has been created with default attributes and without skeleton files

Scenario: send PUT requests to webDav endpoints as normal user with wrong password
When user "user0" requests these endpoints with "PUT" including body using password "invalid" then the status codes should be as listed
| endpoint | http-code | body |
| /remote.php/webdav/textfile0.txt | 401 | doesnotmatter |
| /remote.php/dav/files/user0/textfile0.txt | 401 | doesnotmatter |
| /remote.php/webdav/PARENT | 401 | doesnotmatter |
| /remote.php/dav/files/user0/PARENT | 401 | doesnotmatter |
| /remote.php/dav/files/user0/PARENT/parent.txt | 401 | doesnotmatter |

Scenario: send PUT requests to webDav endpoints as normal user with no password
When user "user0" requests these endpoints with "PUT" including body using password "" then the status codes should be as listed
| endpoint | http-code | body |
| /remote.php/webdav/textfile0.txt | 401 | doesnotmatter |
| /remote.php/dav/files/user0/textfile0.txt | 401 | doesnotmatter |
| /remote.php/webdav/PARENT | 401 | doesnotmatter |
| /remote.php/dav/files/user0/PARENT | 401 | doesnotmatter |
| /remote.php/dav/files/user0/PARENT/parent.txt | 401 | doesnotmatter |

Scenario: send PUT requests to another user's webDav endpoints as normal user
When user "user1" requests these endpoints with "PUT" including body then the status codes should be as listed
| endpoint | http-code | body |
| /remote.php/dav/files/user0/textfile1.txt | 403 | doesnotmatter |
| /remote.php/dav/files/user0/PARENTS | 403 | doesnotmatter |
| /remote.php/dav/files/user0/PARENTS/parent.txt | 404 | doesnotmatter |

Scenario: send PUT requests to webDav endpoints using invalid username but correct password
When user "usero" requests these endpoints with "PUT" including body using the password of user "user0" then the status codes should be as listed
| endpoint | http-code | body |
| /remote.php/webdav/textfile0.txt | 401 | doesnotmatter |
| /remote.php/dav/files/user0/textfile0.txt | 401 | doesnotmatter |
| /remote.php/webdav/PARENT | 401 | doesnotmatter |
| /remote.php/dav/files/user0/PARENT | 401 | doesnotmatter |
| /remote.php/dav/files/user0/PARENT/parent.txt | 401 | doesnotmatter |