owncloud / owncloud/ocis

Auth popup when opening a file in a password protected public link in external/wopiserver apps

Open
#4,120 0 comments 0 reactions 0 assignees View on GitHub
Type:Bug
Dominant language
Go
Stars
2.1k
Forks
274
Avg merge
2d 1h
Merged PRs (30d)
103

Description

## Describe the bug

Trying to open a file in a password protected public link via wopiserver shows an auth popup in the browser (i.e. a www-authenticate header is sent by the server).

Here's an example request:
```curl $'https://ocis.owncloud.test/app/open?file_id=1284d238-aa92-42ce-bdc4-0b0000009157$33b291e1-a97b-49ec-ac70-844d94c28489\u002179551149-06e1-487b-8ad8-031edf1352d7&app_name=Collabora' \
-X 'POST' \
-H 'authority: ocis.owncloud.test' \
-H 'accept: application/json, text/plain, */*' \
-H 'accept-language: en-GB,en-US;q=0.9,en;q=0.8,de;q=0.7' \
-H 'authorization: Basic cHVibGljOnRlc3Q=' \
-H 'cache-control: no-cache' \
-H 'content-length: 0' \
-H 'origin: https://ocis.owncloud.test' \
-H 'pragma: no-cache' \
-H 'public-token: SZvyZCAdFVbEjOa' \
-H 'referer: https://ocis.owncloud.test/external/SZvyZCAdFVbEjOa/New%20file.odt?app=Collabora&fileId=1284d238-aa92-42ce-bdc4-0b0000009157%2433b291e1-a97b-49ec-ac70-844d94c28489%2179551149-06e1-487b-8ad8-031edf1352d7&contextRouteName=files-public-files&contextRouteParams.item=SZvyZCAdFVbEjOa' \
-H 'sec-ch-ua: ".Not/A)Brand";v="99", "Google Chrome";v="103", "Chromium";v="103"' \
-H 'sec-ch-ua-mobile: ?0' \
-H 'sec-ch-ua-platform: "macOS"' \
-H 'sec-fetch-dest: empty' \
-H 'sec-fetch-mode: cors' \
-H 'sec-fetch-site: same-origin' \
-H 'user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.0.0 Safari/537.36' \
-H 'x-requested-with: XMLHttpRequest' \
--compressed \
--insecure
```

` -H 'public-token: SZvyZCAdFVbEjOa' \` is obviously the public link token

` -H 'authorization: Basic cHVibGljOnRlc3Q=' \`

The password we send is `base64('public:test')` where test is obviously the password and `public` is the hardcoded username.

Maybe @kulmann can add the response sent by the server which I don't have at hand right now.

We haven't found a way to avoid the auth popup and make it work, if we are somehow sending incorrect headers: please let us know.

cc @micbar

## Steps to reproduce

Steps to reproduce the behavior:

1. Create a public link for a folder with an office document in it
2. Open public link in a new tab
3. Try to open office document
4. See auth popup

## Expected behavior
The file can be opened.

## Actual behavior
We see an auth popup.

## Setup

Please describe how you started the server and provide a list of relevant environment variables or configuration files.

```console
OCIS_XXX=somevalue
OCIS_YYY=somevalue
PROXY_XXX=somevalue
```

## Additional context
Add any other context about the problem here.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.