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

TOS breaks collabora #260

Closed
joergmschulz opened this issue Nov 6, 2019 · 22 comments · Fixed by #765
Closed

TOS breaks collabora #260

joergmschulz opened this issue Nov 6, 2019 · 22 comments · Fixed by #765

Comments

@joergmschulz
Copy link

joergmschulz commented Nov 6, 2019

see issue nextcloud/richdocuments#681 : when TOS is activated, Collabora is broken.
grafik
(unchanged with Version 1.3.1)

@nickvergessen
Copy link
Member

Did you accept the tos on a neighbour file before?

@joergmschulz
Copy link
Author

I don't understand your question, I'm afraid. But, yes, the TOS have been accepted on that specific machine by that specific user.
Possibly, TOS expects the collabora app to accept the TOS (which will not happen)?

@brunt82
Copy link

brunt82 commented Feb 28, 2020

I can confirm the described behaviour for collabora and onlyoffice. As soon as I enable the app, documents cannot be opened anymore. When I disable the app, editing documents by using collabora / onlyoffice works again.

@nickvergessen
Copy link
Member

does it happen for all files, or just shared files, etc?

@joergmschulz
Copy link
Author

in my environmen, it happened for all files. I suspect that the 'ok' dialog that comes up when you login to a TOS-enabled cloud comes up as well for the connection that the lool server initiates to the nextcloud server after the file-open request from the user

@brunt82
Copy link

brunt82 commented Mar 2, 2020

Yes, it makes no difference between shared / unshared documents. Here are the log lines which are produced afterwards the file could not be opened:

OnlyOffice
{"reqId":"EKyrrJVwJFfVI6ntjk0T","level":4,"time":"2020-03-02T13:24:32+01:00","remoteAddr":"192.168.210.253","user":"gtest1","app":"onlyoffice","method":"GET","url":"/apps/onlyoffice/download?doc=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJmaWxlSWQiOjc3NDIyLCJ1c2VySWQiOiJzdG1lbnplbCIsInNoYXJlVG9rZW4iOm51bGwsImFjdGlvbiI6ImRvd25sb2FkIn0.Mh4kaArJW5_Dwu4eomcI8ONuKF1SXzwcRal2FKvzPe8","message":"Download without access right","userAgent":"--","version":"18.0.1.3"}
Collabora
{"reqId":"hQs7ajxfjsJkcAFnfoeS","level":3,"time":"2020-03-02T13:17:27+01:00","remoteAddr":"192.168.210.253","user":"--","app":"richdocuments","method":"GET","url":"/index.php/apps/richdocuments/wopi/files/79542_ocm2qn8y3fs4/contents?access_token=Oc4qhMlP1wX62QPcSuJX929XwlLnGa0R&access_token_ttl=0&reuse_cookies=experimentation_subject_id%3DIjM5MDdjZjc5LWVkNjQtNDJiYi04YTI0LTczZDA2NWQxZTI4MCI%3D--302185d7919a2db7cb33bc2d29a17fb956c96856&permission=edit","message":{"Exception":"OCP\\Files\\NotPermittedException","Message":"","Code":0,"Trace":[{"file":"/var/www/nextcloud/apps/richdocuments/lib/Controller/WopiController.php","line":360,"function":"fopen","class":"OC\\Files\\Node\\File","type":"->","args":["rb"]},{"file":"/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","line":170,"function":"getFile","class":"OCA\\Richdocuments\\Controller\\WopiController","type":"->","args":["79542","Oc4qhMlP1wX62QPcSuJX929XwlLnGa0R"]},{"file":"/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","line":99,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[{"__class__":"OCA\\Richdocuments\\Controller\\WopiController"},"getFile"]},{"file":"/var/www/nextcloud/lib/private/AppFramework/App.php","line":125,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[{"__class__":"OCA\\Richdocuments\\Controller\\WopiController"},"getFile"]},{"file":"/var/www/nextcloud/lib/private/AppFramework/Routing/RouteActionHandler.php","line":47,"function":"main","class":"OC\\AppFramework\\App","type":"::","args":["OCA\\Richdocuments\\Controller\\WopiController","getFile",{"__class__":"OC\\AppFramework\\DependencyInjection\\DIContainer"},{"fileId":"79542_ocm2qn8y3fs4","_route":"richdocuments.wopi.getFile"}]},{"function":"__invoke","class":"OC\\AppFramework\\Routing\\RouteActionHandler","type":"->","args":[{"fileId":"79542_ocm2qn8y3fs4","_route":"richdocuments.wopi.getFile"}]},{"file":"/var/www/nextcloud/lib/private/Route/Router.php","line":299,"function":"call_user_func","args":[{"__class__":"OC\\AppFramework\\Routing\\RouteActionHandler"},{"fileId":"79542_ocm2qn8y3fs4","_route":"richdocuments.wopi.getFile"}]},{"file":"/var/www/nextcloud/lib/base.php","line":1008,"function":"match","class":"OC\\Route\\Router","type":"->","args":["/apps/richdocuments/wopi/files/79542_ocm2qn8y3fs4/contents"]},{"file":"/var/www/nextcloud/index.php","line":38,"function":"handleRequest","class":"OC","type":"::","args":[]}],"File":"/var/www/nextcloud/lib/private/Files/Node/File.php","Line":118,"CustomMessage":"getFile failed"},"userAgent":"LOOLWSD WOPI Agent 4.0.9","version":"18.0.1.3"}

@brunt82
Copy link

brunt82 commented Mar 4, 2020

The new commit 0b7fcd2 does not change the behavior: Opening documents with Onlyoffice or Collabora is still not possible.

@wiswedel
Copy link
Contributor

wiswedel commented Mar 6, 2020

I can not reproduce this with

  • NC 18.0.1
  • Terms of Service 1.4.0
  • Onlyoffice App 4.1.4
  • Onlyoffice Documentserver Integration Edition 5.5.0 (Linux installation, no Docker, no Community Server)
  • with secret and without
  • with web sockets and without

@brunt82
Copy link

brunt82 commented Mar 11, 2020

I can not reproduce this with

* NC 18.0.1

* Terms of Service 1.4.0

* Onlyoffice App 4.1.4

* Onlyoffice Documentserver Integration Edition 5.5.0 (Linux installation, no Docker, no Community Server)

* with secret and without

* with web sockets and without

The app and nextcloud versions are the same for me. But I uses the docker solution for OnlyOffice. Anyhow I don't believe it has any to do with the docker, because it works as soon as I disable TOS.

Where comes the "Download without access right" of above error log from?

Edit: The server certificate of the docker server is self-signed. I trust it in my browser so that the preview works.

@juliusknorr
Copy link
Member

I#ve seen the same happening today with ONLYOFFICE where the TOS cache wrapper basically blocks the check if the file is readable in the download callback handler of the ONLYOFFICE app, though I cannot reproduce it locally on 1.6.1 nor master yet with the latest releases. I'll check back on the instance where this occured if there was maybe only a specific setting either tos_for_users or tos_on_public_shares enabled.

@joergmschulz
Copy link
Author

long time and some versions later: This can be closed because TOS work perfectly along with COOL.

@sydmund
Copy link

sydmund commented Oct 10, 2022

It is still here!

Nextcloud AIO v2.0.3 (NC 24.0.5)
Terms of service v1.10.2
Collabora Online server v6.2.1
Every other app is up to date.

Possibly step to reproduce:
I added global TOS as a second to firstly added in my country language.
After that SOME users (no idea why some users) can't open documents in Collabora.

Formated Errors:
[richdocuments] Error: OCP\Files\NotPermittedException: at <>

  1. /var/www/html/custom_apps/richdocuments/lib/Controller/WopiController.php line 425
    OC\Files\Node\File->fopen("rb")
  2. /var/www/html/lib/private/AppFramework/Http/Dispatcher.php line 225
    OCA\Richdocuments\Controller\WopiController->getFile("1094491", "7rwmfwj87p5vNk6wMZmtJTZjBTN5DjJa")
  3. /var/www/html/lib/private/AppFramework/Http/Dispatcher.php line 133
    OC\AppFramework\Http\Dispatcher->executeController(OCA\Richdocument ... {}, "getFile")
  4. /var/www/html/lib/private/AppFramework/App.php line 172
    OC\AppFramework\Http\Dispatcher->dispatch(OCA\Richdocument ... {}, "getFile")
  5. /var/www/html/lib/private/Route/Router.php line 298
    OC\AppFramework\App::main("OCA\Richdocume ... r", "getFile", OC\AppFramework\ ... {}, ["1094491_oc6w0i ... "])
  6. /var/www/html/lib/base.php line 1030
    OC\Route\Router->match("/apps/richdocum ... s")
  7. /var/www/html/index.php line 36
    OC::handleRequest()

After deleting second TOS (global), broken users are starting working fine. Three days of searching info in Collabora's threads, which was wrong :/

@nickvergessen
Copy link
Member

I put it on my todo list to check it again.
But I don't have a collabora setup at the moment to test this with.

@nickvergessen nickvergessen reopened this Oct 14, 2022
@nickvergessen
Copy link
Member

Can you please post the following details, that would really help me debugging this:

@sydmund
Copy link

sydmund commented Oct 19, 2022

Hi!
Ok, here is my configuration from NC GUI:
image

root@cloud:~# docker exec -it nextcloud-aio-nextcloud php occ config:list terms_of_service
{
    "apps": {
        "terms_of_service": {
            "term_uuid": "633ed0532973d",
            "types": "filesystem,dav",
            "installed_version": "1.10.2",
            "enabled": "yes"
        }
    }
}

In that case I have an error when trying to open document via Collabora.

Now I'm removing global (polish in my case) ToS via NC GUI:
image

OCC seems with no changes:

root@cloud:~# docker exec -it nextcloud-aio-nextcloud php occ config:list terms_of_service
{
    "apps": {
        "terms_of_service": {
            "term_uuid": "633ed0532973d",
            "types": "filesystem,dav",
            "installed_version": "1.10.2",
            "enabled": "yes"
        }
    }
}

But now Collabora opens documents.

As I mentioned before the broken time is broken only for some users and have no idea what's making a difference among users.

I'm not a developer, but fell free to ask for more.

@nickvergessen
Copy link
Member

As I mentioned before the broken time is broken only for some users and have no idea what's making a difference among users.

Maybe whether they signed it before opening the document?

My colleague in the meantime added some code to the ToS app which makes sure that the ToS are triggered there before:
nextcloud/richdocuments#2559

Maybe that already solves it?

Other than that I can still not reproduce the issue even with the information given above. The only thing that I can otherwise imagine is #691 but that was fixed in 1.10.2

@juliusknorr
Copy link
Member

I could reproduce this having a region (not global) set. The requests for Collabora always get checked against global ToS but without the user scope, so it might be that some users have the global signed (for those it works) and some only the polish (which doesn't work then).

@nickvergessen I think the most sane thing to do would be to still allow the requests for /richdocuments/wopi/ as even with setting the correct user during the wopi requests, we could not be able to match the country code that the user had in the browser requests.

Any preference on how to do that? I'd say with nextcloud/richdocuments#2559 it would be fine to only check against the request url, otherwise we probably need an event that TOS could dispatch so richdocuments could determine if the request ip is from the allow list.

How the wopi allow list is handled in richdocuments https://github.com/nextcloud/richdocuments/blob/2eca85078cf46e2ed61fad070a625d9161ffd26f/lib/Middleware/WOPIMiddleware.php#L68-L81

@nickvergessen
Copy link
Member

How the wopi allow list is handled in richdocuments https://github.com/nextcloud/richdocuments/blob/2eca85078cf46e2ed61fad070a625d9161ffd26f/lib/Middleware/WOPIMiddleware.php#L68-L81

I would prefer this over URL checking, but we could even combine it.
Only allowing the WOPI ips on index.php/apps/richdocuments/wopi

@nickvergessen
Copy link
Member

Let me prepare a patch for this.

@solracsf
Copy link
Member

@nickvergessen This seems to happen also with OnlyOffice.
After disabling the TOS app, file can be edited, with app enabled, error "Download without access right'"

NC v24.0.9, TOS v1.10.2, OnlyOffice v7.5.8.

@nickvergessen
Copy link
Member

Yeah, seems I forgot to make releases... Will queue a todo item for it

@hamza221
Copy link

hamza221 commented Sep 20, 2024

Still happening in v2.5.0

{
	"reqId": "GWDTcDbWLJfR2z3wFYRt",
	"level": 3,
	"time": "2024-09-20T12:20:53+00:00",
	"remoteAddr": "::ffff:212.46.103.227",
	"user": "--",
	"app": "richdocuments",
	"method": "GET",
	"url": "/index.php/apps/richdocuments/wopi/files/2781_ocylie5fucfr/contents?
	"message": "getFile failed: ",
	"userAgent": "COOLWSD HTTP Agent 24.04.6.3",
	"version": "29.0.7.2",
	"exception": {
		"Exception": "OCP\\Files\\NotPermittedException",
		"Message": "",
		"Code": 0,
		"Trace": [{
			"file": "/var/www/nextcloud/apps/richdocuments/lib/Controller/WopiController.php",
			"line": 385,
			"function": "fopen",
			"class": "OC\\Files\\Node\\File",
			"type": "->",
			"args": ["rb"]
		}, {
			"file": "/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
			"line": 232,
			"function": "getFile",
			"class": "OCA\\Richdocuments\\Controller\\WopiController",
			"type": "->",
			"args": ["2781", "j0g9sGbmdmHv7zi4938DtTxfZ9GZu65V"]
		}, {
			"file": "/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
			"line": 138,
			"function": "executeController",
			"class": "OC\\AppFramework\\Http\\Dispatcher",
			"type": "->",
			"args": [
				["OCA\\Richdocuments\\Controller\\WopiController"], "getFile"
			]
		}, {
			"file": "/var/www/nextcloud/lib/private/AppFramework/App.php",
			"line": 184,
			"function": "dispatch",
			"class": "OC\\AppFramework\\Http\\Dispatcher",
			"type": "->",
			"args": [
				["OCA\\Richdocuments\\Controller\\WopiController"], "getFile"
			]
		}, {
			"file": "/var/www/nextcloud/lib/private/Route/Router.php",
			"line": 331,
			"function": "main",
			"class": "OC\\AppFramework\\App",
			"type": "::",
			"args": ["OCA\\Richdocuments\\Controller\\WopiController", "getFile", ["OC\\AppFramework\\DependencyInjection\\DIContainer"],
				["2781_ocylie5fucfr", "richdocuments.wopi.getfile"]
			]
		}, {
			"file": "/var/www/nextcloud/lib/base.php",
			"line": 1058,
			"function": "match",
			"class": "OC\\Route\\Router",
			"type": "->",
			"args": ["/apps/richdocuments/wopi/files/2781_ocylie5fucfr/contents"]
		}, {
			"file": "/var/www/nextcloud/index.php",
			"line": 49,
			"function": "handleRequest",
			"class": "OC",
			"type": "::",
			"args": []
		}],
		"File": "/var/www/nextcloud/lib/private/Files/Node/File.php",
		"Line": 120,
		"message": "getFile failed: ",
		"exception": {},
		"CustomMessage": "getFile failed: "
	}
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants