Android: Cryptomator can access webdav and create vault but can not open it in bitrix24 cloud.

Created on 13 Oct 2020  路  6Comments  路  Source: cryptomator/android


Description

Cryptomator can access webdav and create vault but can not open it.
The webdav provider is bitrix24, sign up url is: https://www.bitrix24.net/create/
Cryptomator can connect the webdav successfully, it can even browser the files, create folder and create a vault.
However, after creating a vault on the phone, when I try to open it. It shows an error in the password dialog:
-> An error occurred
If I enter the password anyway and click unlock, it will show "please wait" indefinitely.

The webdav service can be managed by other app like foldersync. I tried to create a local vault and sync the vault using foldersync. In this way, the vault can be access and unlock in the desktop without problem.

System Setup

  • Android version: 10
  • Cryptomator version: 1.5.9
  • Cloud type: WebDAV

Steps to Reproduce

  1. Add a webdav service
  2. Create a vault in the webdav
  3. Try to open the vault

Expected Behavior

The vault can be opened.

Actual Behavior

The vault can not be opened.

Reproducibility

Always

Additional Information

confirmed webdav upstream-bug

All 6 comments

We got such a request already, the problem is the following:

We can

  1. list the content of a folder
  2. create folders / files
  3. write into files
  4. --> Create vaults

But when we try to unlock the vault, we download the masterkey.cryptomator file:

D/OkHttp: --> GET https://b24-1nbs3x.bitrix24.de/company/personal/user/1/disk/path/asdf/masterkey.cryptomator http/1.1 (unknown length)
D/OkHttp: --> END GET

Server is responding with a 302 redirect - fair enough

D/OkHttp: <-- 302  https://b24-1nbs3x.bitrix24.de/company/personal/user/1/disk/path/asdf/masterkey.cryptomator (1396ms)
D/OkHttp: server: nginx/1.16.1
D/OkHttp: date: Wed, 14 Oct 2020 11:54:45 GMT
D/OkHttp: location: https://www.bitrix24.net/oauth/authorize/?user_lang=de&client_id=b24.5f86e51320e612.83030667&redirect_uri=https%3A%2F%2Fb24-1nbs3x.bitrix24.de%2Fcompany%2Fpersonal%2Fuser%2F1%2Fdisk%2Fpath%2Fasdf%2Fmasterkey.cryptomator%3Fauth_service_id%3DBitrix24Net&scope=auth,profile&response_type=code&mode=page&state=site_id%3Ds1%26backurl%3D%252Fcompany%252Fpersonal%252Fuser%252F1%252Fdisk%252Fpath%252Fasdf%252Fmasterkey.cryptomator%253Fcheck_key%253D3613f904aafe42a5fc06450e45662bc4%26mode%3Dpage
D/OkHttp: p3p: policyref="/bitrix/p3p.xml", CP="NON DSP COR CUR ADM DEV PSA PSD OUR UNR BUS UNI COM NAV INT DEM STA"
D/OkHttp: x-powered-cms: Bitrix Site Manager (bc2cad9153cb418bb2dfd5602c3c3754)
D/OkHttp: expires: Thu, 19 Nov 1981 08:52:00 GMT
D/OkHttp: x-frame-options: SAMEORIGIN
D/OkHttp: x-content-type-options: nosniff
D/OkHttp: strict-transport-security: max-age=31536000; includeSubdomains
D/OkHttp: x-bitrix-times: 0.022/0.022/0.000
D/OkHttp: x-bitrix-tcp: 19375/10000/20/17898
D/OkHttp: x-bitrix-ri: 1caa9f070af4085c14bf6d122e86fa7a
D/OkHttp: x-bitrix-lb: lb-de-01
D/OkHttp: Cache-Control: max-age=0
D/OkHttp: <-- END HTTP

Following the redirect and doing the request to the new location:

D/OkHttp: --> GET https://www.bitrix24.net/oauth/authorize/?user_lang=de&client_id=b24.5f86e51320e612.83030667&redirect_uri=https%3A%2F%2Fb24-1nbs3x.bitrix24.de%2Fcompany%2Fpersonal%2Fuser%2F1%2Fdisk%2Fpath%2Fasdf%2Fmasterkey.cryptomator%3Fauth_service_id%3DBitrix24Net&scope=auth,profile&response_type=code&mode=page&state=site_id%3Ds1%26backurl%3D%252Fcompany%252Fpersonal%252Fuser%252F1%252Fdisk%252Fpath%252Fasdf%252Fmasterkey.cryptomator%253Fcheck_key%253D3613f904aafe42a5fc06450e45662bc4%26mode%3Dpage http/1.1 (unknown length)
D/OkHttp: Cache-Control: max-age=0
D/OkHttp: --> END GET
D/OkHttp: <-- 200  https://www.bitrix24.net/oauth/authorize/?user_lang=de&client_id=b24.5f86e51320e612.83030667&redirect_uri=https%3A%2F%2Fb24-1nbs3x.bitrix24.de%2Fcompany%2Fpersonal%2Fuser%2F1%2Fdisk%2Fpath%2Fasdf%2Fmasterkey.cryptomator%3Fauth_service_id%3DBitrix24Net&scope=auth,profile&response_type=code&mode=page&state=site_id%3Ds1%26backurl%3D%252Fcompany%252Fpersonal%252Fuser%252F1%252Fdisk%252Fpath%252Fasdf%252Fmasterkey.cryptomator%253Fcheck_key%253D3613f904aafe42a5fc06450e45662bc4%26mode%3Dpage (490ms)
D/OkHttp: server: nginx/1.16.1
D/OkHttp: date: Wed, 14 Oct 2020 11:54:46 GMT
D/OkHttp: x-powered-by: PHP/7.1.32
D/OkHttp: p3p: policyref="/bitrix/p3p.xml", CP="NON DSP COR CUR ADM DEV PSA PSD OUR UNR BUS UNI COM NAV INT DEM STA"
D/OkHttp: x-powered-cms: Bitrix Site Manager (3b33ffbe22d842a186f2cab76bf7921a)
D/OkHttp: expires: Thu, 19 Nov 1981 08:52:00 GMT
D/OkHttp: x-frame-options: SAMEORIGIN
D/OkHttp: strict-transport-security: max-age=63072000
D/OkHttp: Cache-Control: max-age=0
D/OkHttp: <-- END HTTP

Now it gets weird: The server is responding with a HTML page instead of the masterkey.cryptomator file in JSON format we asked for (masterkey.cryptomator):

D/PrepareUnlockUseCase: failed 26f658da
D/ExceptionHandler: Unexpected error
    java.lang.IllegalStateException: Not a JSON Object: "<!DOCTYPE"
...

After some further testing I now always get a 403 status code to the masterkey.cryptomator GET request while I still can create folders, files etc :

D/OkHttp: --> GET https://b24-1nbs3x.bitrix24.de/company/personal/user/1/disk/path/asdf/masterkey.cryptomator http/1.1 (unknown length)
D/OkHttp: --> END GET
D/OkHttp: <-- 403  https://b24-1nbs3x.bitrix24.de/company/personal/user/1/disk/path/asdf/masterkey.cryptomator (83ms)
D/OkHttp: server: nginx/1.16.1
    date: Wed, 14 Oct 2020 11:52:21 GMT
    etag: W/"5e454cc5-77a9"
    Cache-Control: max-age=0
    <-- END HTTP

Maybe I triggered something like a max login retry counter becuase in the requests before they always do a redirect to a url with .../oauth/authorize/... but this is only a guess.

To sum it up: I have no idea why the server redirects GET requests to an .../oauth/authorize/... URL but lets other requests be executed. It would be great if you could contact the Bitrix24 support with this question.

HI SailReal,

I did some test on my part.
Despite the issue I encountered, there are many people saying that they can access wedav service of this provide via network drive in Windows and people using Linux saying they can access it via davfs2 without problems. In my computer, I tried davfs2 and it indeed works but another similar webdav client wdfs does not.
So I use one of my own webdav server to check if there is a difference in the GET request between davfs2 and wdfs.
Turned out that the only difference is their user agent which is no surprising.
Then I tried these two wget commands:

wget -U "davfs2/1.5.2 neon/0.30.1"  --user [email protected] --ask-password https://b24-xxx.bitrix24.de/company/personal/user/1/disk/path/file
wget -U "wdfs/1.4.2 neon/0.30.1"  --user [email protected] --ask-password https://b24-xxx.bitrix24.de/company/personal/user/1/disk/path/file

The first one successfully download the file with correct content and the second one just get the html file of the website. Apparently, this provider only allow GET request with certain user agent to download the files from the webdav service. I have tested that user agent such as "davfs2/1.5.2 neon/0.30.1" and "Microsoft-WebDAV-MiniRedir/6.1.7601" work and probably some others also.
I encountered the same problem with rclone with this provider, now if I supply the argument "--user-agent Microsoft-WebDAV-MiniRedir/6.1.7601" to rclone and it will successfully downloads the files with correct content which it is not possible before.

Can you confirm this from your side? if this is the case, it will be nice if cryptomator can let user set a custom user agent in a specific webdav service.

:flushed: whaaat, thanks for your testing and surprisingly I can confirm your described behavior: setting the user agent to davfs2/1.5.2 fixes the problem of bitrix24 together with Cryptomator for Android.

Before implementing this workaround by providing a custom user agent can you contact the company and tell them what you found out? It would make much more sense that they fix this on their side...

Thank you very much for the analysis!

My mind is blown. 馃く They can't be serious.

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

After months of inactivity I close this issue. Feel free to open it again when a response from bitrix24 is available.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

SailReal picture SailReal  路  5Comments

0xDAFE picture 0xDAFE  路  6Comments

jandechent picture jandechent  路  7Comments

ghost picture ghost  路  5Comments

eqyiel picture eqyiel  路  5Comments