otetard / ownpad

Ownpad is a Nextcloud application that allows to create and open Etherpad and Ethercalc documents.
GNU Affero General Public License v3.0
57 stars 24 forks source link

Can't Create Protected Pad (+ Other issues) #60

Closed Kosyne closed 5 years ago

Kosyne commented 6 years ago

Etherpad v1.6.3 Ownpad v0.6.5

So I have a working etherpad instance, and ownpad works just fine for standard public pads.

Etherpad is at ether.domain.com, NextCloud is at cloud.domain.com, and the cookie domain is set as domain.com, and I have the api key from APIKEY.txt

Nextcloud and Etherpad are on the same machine, both behind a reverse proxy.

In Nextcloud, when hitting the + symbol, I'm given the option to create a standard pad and a protected pad. I can create the former and not have any problems, however, trying to create a protected pad does nothing except cause Flushed 1 values to appear in Etherpad's log.

When enabling the following two options, things get worse:

"requireSession" : true,
"editOnly" : true,

I cannot access standard pads anymore, and get the following message:

[2018-03-03 02:50:32.627] [INFO] API - REQUEST, v1:createSession, {"apikey":"<API_KEY>"}
[2018-03-03 02:50:32.632] [INFO] API - RESPONSE, createSession, {"code":1,"message":"groupID does not exist","data":null}
[2018-03-03 02:51:27.997] [WARN] message - Authentication try failed:{"component":"pad","type":"CLIENT_READY","padId":"u1FOGKJDlSnipnrx","sessionID":"null","password":null,"token":"t.mddnXr2aV3rtneCOf6jn","protocolVersion":2}

Looks like it's not being supplied a groupID when it needs one.

If you need more info, let me know.

shadoxx commented 6 years ago

I am having the same issues described in the above bug report. My infrastructure is, for all intents and purposes, nearly identical to the one above. I have checked APIKEY.txt and all logs to rule out Nextcloud setup issues.

Etherpad-Lite 1.6.5 Ownpad 0.6.6

Apr 24 12:55:14 domain.example.com node[19072]: [2018-04-24 12:55:14.697] [INFO] ueberDB - Flushed 1 values
Apr 24 12:55:14 domain.example.com node[19072]: [2018-04-24 12:55:14.778] [WARN] message - Authentication try failed:{"component":"pad","type":"CLIENT_READY","padId":"g.DyfgO6b0xHMHmqnV$jKS9DbW3zKWducMt","sessionID":"null","password":null
,"token":"t.H9wLrayL1NC3ARB4gU0B","protocolVersion":2}

I can confirm that enabling "Public Pads" lets me create and edit pads from the Nextcloud interface as expected, but any attempt at creating a "Protected Pad" results in a "You do not have permission to access this pad".

Currently this plugin is critically broken and my users can't access their protected pads at all.

m0urs commented 5 years ago

It was working for me until I upgraded yesterday to Nextcloud 14 (and PHP 7.2). Now I see the same issue. Public Pads are working, Protected Pads give me the same error message.

m0urs commented 5 years ago

Owncloud 14.0.4 ownpad 0.6.9

I still cannot use protected pads. Public pads are working, protected pads are created but when trying to access them I see the message "You do not have permission to access this pad" and in the logfile you see messages like that:

Dec 16 12:54:22 vs1 run.sh[31938]: #033[33m[2018-12-16 12:54:22.623] [WARN] message - #033[39mAuthentication try failed:{"component":"pad","type":"CLIENT_READY","padId":"g.50saqAt1EuMhFUmu$itvfxe3huas5s9ap","sessionID":"null","password":null,"token":"t.QpmEbmLhAbhZPL5wKtM9","protocolVersion":2}

Dec 16 13:01:28 vs1 run.sh[31938]: #033[33m[2018-12-16 13:01:28.584] [WARN] message - #033[39mAuthentication try failed:{"component":"pad","type":"CLIENT_READY","padId":"g.SF6Me6Zm8eHVrsQm$7uzh1s7nef9koqu8","sessionID":"null","password":null,"token":"t.QpmEbmLhAbhZPL5wKtM9","protocolVersion":2}
LLynx commented 5 years ago

same here: can create and access standad pads, but can't access protected pads

PHP 7.2.13 Nextcloud 14.0.4 Ownpad 0.6.10 Etherpad Lite 1.6.6

nextcloud.log said

{"reqId":"__ID__","level":3,"time":"2018-12-20T13:50:39+00:00","remoteAddr“:“__ipv6__","user“:"__user__","app":"index","method":"POST","url":"\/index.php\/apps\/ownpad\/ajax\/v1.0\/newpad","message":{"Exception":"Error","Message":"Call to a member function createPad() on null","Code":0,"Trace":[{"file":"\/__path__\/apps\/ownpad\/lib\/Controller\/AjaxController.php","line":57,"function":"create","class":"OCA\\Ownpad\\Service\\OwnpadService","type":"->","args":["\/","New pad.pad","etherpad",false]},{"file":"\/__path__\/lib\/private\/AppFramework\/Http\/Dispatcher.php","line":166,"function":"newpad","class":"OCA\\Ownpad\\Controller\\AjaxController","type":"->","args":["\/","New pad.pad","etherpad",false]},{"file":"\/__path__\/lib\/private\/AppFramework\/Http\/Dispatcher.php","line":99,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[{"__class__":"OCA\\Ownpad\\Controller\\AjaxController"},"newpad"]},{"file":"\/__path__\/lib\/private\/AppFramework\/App.php","line":118,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[{"__class__":"OCA\\Ownpad\\Controller\\AjaxController"},"newpad"]},{"file":"\/__path__\/lib\/private\/AppFramework\/Routing\/RouteActionHandler.php","line":47,"function":"main","class":"OC\\AppFramework\\App","type":"::","args":["OCA\\Ownpad\\Controller\\AjaxController","newpad",{"__class__":"OC\\AppFramework\\DependencyInjection\\DIContainer"},{"_route":"ownpad.ajax.newpad"}]},{"function":"__invoke","class":"OC\\AppFramework\\Routing\\RouteActionHandler","type":"->","args":[{"_route":"ownpad.ajax.newpad"}]},{"file":"\/__path__\/lib\/private\/Route\/Router.php","line":297,"function":"call_user_func","args":[{"__class__":"OC\\AppFramework\\Routing\\RouteActionHandler"},{"_route":"ownpad.ajax.newpad"}]},{"file":"\/__path__\/lib\/base.php","line":987,"function":"match","class":"OC\\Route\\Router","type":"->","args":["\/apps\/ownpad\/ajax\/v1.0\/newpad"]},{"file":"\/__path__\/index.php","line":42,"function":"handleRequest","class":"OC","type":"::","args":[]}],"File":"\/__path__\/apps\/ownpad\/lib\/Service\/OwnpadService.php","Line":59,"CustomMessage":"--"},"userAgent":"__...__","version":"14.0.4.2“}

m0urs commented 5 years ago

And still reproducable with Ownpad 0.6.11.

shadoxx commented 5 years ago

Bumping. Just fully updated everything. Now running Nextcloud 14.0.4 and Ownpad 0.6.11. Protected pads are still broken.

otetard commented 5 years ago

I tried several times to reproduce this issue, but I didn’t manage to. I just tested the official Nextcloud Docker image, which is based on PHP 7.2, I’ve installed and configured Ownpad 0.6.11, and I successfully created a protected pad.

I would be very happy to help here, but I need to be able to reproduce that issue. Maybe, someone could send me more information on their system.

awrede commented 5 years ago

I encountered the same problem and traced it down to a trailing '/' on the domain name in the Etherpad Host field in the ownpad setting. This caused the preg_match (around line 78 in lib/Controller/DisplayController.php) to never match.

shadoxx commented 5 years ago

@awrede OMG THIS FIXED EVERYTHING THANK YOU! Removed the trailing / in the specified field and it's like it was never broken. Thank you thank you thank you!

filisko commented 5 years ago

This should be documented somewhere or a trim() should be added to the code.

otetard commented 5 years ago

@awrede Thanks for the tip! Code should be fixed now.

m0urs commented 5 years ago

Unfortunately this still does not solve the issue for me.

The protected pad IS created (as before the update also) and the pad has an ID starting with "g."., but then if I try to access the protected pad from within Owncloud, I just get a message that I am not allowed to access that pad.

Unprotected pads are working fine. They have an ID without a leading "g.".

UPDATE:

Ok, sorry. Seems to be an issue with my security settings in my Apache configuration. I have set some HEADER directives and ant least one of these seems to break that thing. I need to investigate more but if I disable all of them, everything works fine!

Please look here: https://github.com/otetard/ownpad/issues/83