nextcloud / nextcloud/ios

Spurious attempts to access "/webdav" generated on every interaction with the app

Open
#1,494 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Swift
Stars
2.5k
Forks
1k
Avg merge
2d 18h
Merged PRs (30d)
13

Description

Background

I have NextCloud installed in "/nextcloud" on my Apache web server, e.g. "example.com/nextcloud", served out of $DOCUMENT_ROOT/nextcloud. I also use mod_dav to provide webdav access at "example.com/webdav", served out of $DOCUMENT_ROOT/webdav. Access to the $DOCUMENT_ROOT/webdav directory is managed via a user file generated by htpasswd.

Some NextCloud users and WebDAV users have the same user name, but different passwords.

NextCloud is configured to store user data elsewhere on my server - I only say this to point out that it shares no common storage with the example.com/webdav service.

Expected behaviour

I expect that I can access files with the NextCloud iOS client at example.com/nextcloud, and this will not cause any requests to example.com/webdav.

Actual behaviour

I can access files with the NextCloud iOS client at example.com/nextcloud, but every interaction with the application (open file, create new directory, navigate to sub-directory, navigate to parent directory, etc.) generates one or more attempts to authenticate against example.com/webdav, which fail. The failure is expected, as NextCloud has no credentials for my standalone WebDAV service, nor should it require any.

Steps to reproduce

Use Apache, configure DocumentRoot to /var/www/, with two subdirectories, webdav and nextcloud. Have a single virtual host listening on 443. Configure Apache mod_dav to provide WebDAV services on Directory /webdav using AuthType Basic, and an htpasswd file with username TEST_USER and password WEBDAV_PASSWORD.

Configure Directory /nextcloud as required for the NextCloud server.

Configure NextCloud server to use some directory outside of Apache document root as its datadirectory

Create a user in NextCloud via a desktop browser with username TEST_USER and password NEXTCLOUD_PASSWORD.

Login to example.com/nextcloud using a desktop browser with TEST_USER, and observe your Apache error log while navigating TEST_USER's files and creating and deleting directories. You should see no failed requests to example.com/webdav.

Login to example.com/nextcloud using a mobile browser (e.g. iOS Safari) with TEST_USER, and observe your Apache error log while navigating TEST_USER's files and creating and deleting directories. You should see no failed requests to example.com/webdav.

Login to example.com/nextcloud using the iOS NextCloud client with TEST_USER, and observe your Apache error log while navigating TEST_USER's files and creating and deleting directories. From the iOS client, all will appear as normal. However, you will see repeated authentication failures to example.com/webdav in the Apache error log, e.g.
[Sat Nov 28 16:07:09.709580 2020] [auth_basic:error] [pid 29349] [client 192.168.1.1:58099] AH01617: user TEST_USER: authentication failure for "/webdav/": Password Mismatch
[Sat Nov 28 16:07:57.681889 2020] [auth_basic:error] [pid 1900] [client 192.168.1.1:58101] AH01617: user TEST_USER: authentication failure for "/webdav": Password Mismatch
[Sat Nov 28 16:08:06.389869 2020] [auth_basic:error] [pid 2212] [client 192.168.1.1:58105] AH01617: user TEST_USER: authentication failure for "/webdav/Documents": Password Mismatch
[Sat Nov 28 16:08:06.471519 2020] [auth_basic:error] [pid 2212] [client 192.168.1.1:58105] AH01617: user TEST_USER: authentication failure for "/webdav/Documents/": Password Mismatch
[Sat Nov 28 16:19:27.306747 2020] [auth_basic:error] [pid 15887] [client 192.168.1.1:58112] AH01617: user TEST_USER: authentication failure for "/webdav/Documents/About.odt": Password Mismatch
[Sat Nov 28 16:19:54.688070 2020] [auth_basic:error] [pid 3792] [client 192.168.1.1:58181] AH01617: user TEST_USER: authentication failure for "/webdav/Documents/About.odt": Password Mismatch

Now, reconfigure Apache. Rename /var/www/webdav to /var/www/not_webdav, and change your httpd.conf Directory tag accordingly. When you access example.com/nextcloud with the iOS NextCloud client now, you will see nothing logged to Apache's error log, only lines like this in Apache's access log
192.168.1.1 - TEST_USER [28/Nov/2020:21:02:19 -0500] "PROPFIND /nextcloud/remote.php/dav/files/TEST_USER/ HTTP/1.1" 207 4978 "-" "Mozilla/5.0 (Macintosh) mirall/3.0.3git (build 3799) (Nextcloud)"

Reasoning or why should it be changed/implemented?

Access to URLs outside of the NextCloud installation are unexpected and inconsistent, based (apparently) on the presence of certain keyword URLs on the NextCloud server.

In this case, I was able to change /webdav to something else quite easily, as this server is only used by me and one other person, with a total of < 20 client programs across ~6 client systems. For larger installations this would create quite an issue.

iOS version

iOS 14.2

App version

3.0.14.6

Server configuration

Operating system:
Ubuntu 18.04.5
Web server:
apache2 2.4.29-1ubuntu4.14
Database:
mysql-server-5.7 5.7.32-0ubuntu0.18.04.1
PHP version:
7.2
Nextcloud version: (see Nextcloud admin page)
17.0.10 (I realize this is not the latest version, however at this point I have reconfigured my webdav service and all webdav clients to point to the new URL, so I am not eager to revert this once upgrading to see if the issue persists in newer versions. I file this issue in the hope that someone may recognize and affirm that the behavior has already been fixed, or find that it the flaw does persist in newer versions, in which case my report would have some value)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue with the iOS Nextcloud client using the Apache setup described, then compare its requests and Apache logs with desktop and mobile browser behavior. Trace the client’s file-navigation interactions and WebDAV requests; done means navigating, creating, and deleting files in /nextcloud no longer causes requests or authentication attempts against the unrelated /webdav path.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift
Domain
mobile
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.