nextcloud / server

☁️ Nextcloud server, a safe home for all your data
https://nextcloud.com
GNU Affero General Public License v3.0
27.57k stars 4.08k forks source link

Federated Sharing - GuzzleHTTP - filename longer than 64 character #19635

Closed aignerat closed 3 years ago

aignerat commented 4 years ago

Hey,

I found out an error that should affect most federations.

Steps to reproduce

  1. Have a file that is longer than 64 characters in total (61+ "." + 3 extension)
  2. Try to share it with a federated server (doesn't work)
  3. Try to share it locally (works)

Expected behaviour

Get the notification on server 2 that smth has been shared.

Actual behaviour

Javascript error on "for share xyz user not found, maybe the server is not reachable or there is a problem with certificates"

Server configuration

Operating system: centos7 Web server: apache 2.4.39 Database: postgres 9.6 PHP version: 7.2.26 and 7.1.29 Nextcloud version: (see Nextcloud admin page) v17.0.2/v15.0.4 (tested on both configurations on the same server with 4 instances) Updated from an older Nextcloud/ownCloud or fresh install: v17 (relevant) fresh Where did you install Nextcloud from: download from nextcloud.com Signing status:

Signing status ``` Login as admin user into your Nextcloud and access http://example.com/index.php/settings/integrity/failed paste the results here. ```

List of activated apps:

App list ``` If you have access to your command line run e.g.: sudo -u www-data php occ app:list from within your Nextcloud installation folder ```

Nextcloud configuration:

Config report ``` If you have access to your command line run e.g.: sudo -u www-data php occ config:list system from within your Nextcloud installation folder or Insert your config.php content here. Make sure to remove all sensitive content such as passwords. (e.g. database password, passwordsalt, secret, smtp password, …) ```

Are you using external storage, if yes which one: local/smb/sftp/...

Are you using encryption: no

Are you using an external user-backend, if yes which one: LDAP/ActiveDirectory - but not relevant, tested with databaseusers and ldapusers

Client configuration

Browser:

Operating system:

Logs

Web server error log

Web server error log ``` ```

Nextcloud log (data/nextcloud.log)

Nextcloud log ``` {"reqId":"XlUdz-gSc7zx-0rxfBjV4gAAAVM","level":3,"time":"2020-02-25T14:14:57+01:00","remoteAddr":"192.168.101.171","user":"***","app":"federatedfilesharing","method":"POST","url":"\/ocs\/v2.php\/apps\/files_sharing\/api\/v1\/shares?format=json","message":{"Exception":"GuzzleHttp\\Exception\\ServerException","Message":"Server error: `POST https:\/\/test.***.at\/ocm\/shares` resulted in a `500 Internal Server Error` response:\n{\"message\":\"internal server error, was not able to add share from https:\\\/\\\/test.***.at\\\/\"}\n","Code":500,"Trace":[{"file":"\/srv\/***\/web\/3rdparty\/guzzlehttp\/guzzle\/src\/Middleware.php","line":66,"function":"create","class":"GuzzleHttp\\Exception\\RequestException","type":"::","args":[{"__class__":"GuzzleHttp\\Psr7\\Request"},"*** sensitive parameter replaced ***"]},{"file":"\/srv\/***\/web\/3rdparty\/guzzlehttp\/promises\/src\/Promise.php","line":203,"function":"GuzzleHttp\\{closure}","class":"GuzzleHttp\\Middleware","type":"::","args":["*** sensitive parameters replaced ***"]},{"file":"\/srv\/***\/web\/3rdparty\/guzzlehttp\/promises\/src\/Promise.php","line":156,"function":"callHandler","class":"GuzzleHttp\\Promise\\Promise","type":"::","args":[1,"*** sensitive parameter replaced ***",[{"__class__":"GuzzleHttp\\Promise\\Promise"},{"__class__":"Closure"},null]]},{"file":"\/srv\/***\/web\/3rdparty\/guzzlehttp\/promises\/src\/TaskQueue.php","line":47,"function":"GuzzleHttp\\Promise\\{closure}","class":"GuzzleHttp\\Promise\\Promise","type":"::","args":["*** sensitive parameters replaced ***"]},{"file":"\/srv\/***\/web\/3rdparty\/guzzlehttp\/promises\/src\/Promise.php","line":246,"function":"run","class":"GuzzleHttp\\Promise\\TaskQueue","type":"->","args":[true]},{"file":"\/srv\/***\/web\/3rdparty\/guzzlehttp\/promises\/src\/Promise.php","line":223,"function":"invokeWaitFn","class":"GuzzleHttp\\Promise\\Promise","type":"->","args":[]},{"file":"\/srv\/***\/web\/3rdparty\/guzzlehttp\/promises\/src\/Promise.php","line":267,"function":"waitIfPending","class":"GuzzleHttp\\Promise\\Promise","type":"->","args":[]},{"file":"\/srv\/***\/web\/3rdparty\/guzzlehttp\/promises\/src\/Promise.php","line":225,"function":"invokeWaitList","class":"GuzzleHttp\\Promise\\Promise","type":"->","args":[]},{"file":"\/srv\/***\/web\/3rdparty\/guzzlehttp\/promises\/src\/Promise.php","line":62,"function":"waitIfPending","class":"GuzzleHttp\\Promise\\Promise","type":"->","args":[]},{"file":"\/srv\/***\/web\/3rdparty\/guzzlehttp\/guzzle\/src\/Client.php","line":131,"function":"wait","class":"GuzzleHttp\\Promise\\Promise","type":"->","args":[]},{"file":"\/srv\/***\/web\/lib\/private\/Http\/Client\/Client.php","line":212,"function":"request","class":"GuzzleHttp\\Client","type":"->","args":["post","https:\/\/test.***.at\/ocm\/shares",{"proxy":null,"verify":"\/srv\/***\/data\/files_external\/rootcerts.crt","timeout":10,"body":"{\"shareWith\":\"***@https:\\\/\\\/test.***.at\",\"shareType\":\"user\",\"name\":\"testfedlong dshdfssdsrdrsgsdhgsdhgdbergesrgxghdsxdrgxdcvggesbrxdfghexrgchgxgdrgcfgcg.md\",\"resourceType\":\"file\",\"description\":\"\",\"providerId\":3,\"owner\":\"***@https:\\\/\\\/test.***.at\\\/\",\"ownerDisplayName\":\"***\",\"sharedBy\":\"***@https:\\\/\\\/test.***.at\\\/\",\"sharedByDisplayName\":\"***\",\"protocol\":{\"name\":\"webdav\",\"options\":{\"sharedSecret\":\"IPOXdcDEq2nTgU2\",\"permissions\":\"{http:\\\/\\\/open-cloud-mesh.org\\\/ns}share-permissions\"}}}","headers":{"content-type":"application\/json","User-Agent":"Nextcloud Server Crawler"},"connect_timeout":10,"synchronous":true}]},{"file":"\/srv\/***\/web\/lib\/private\/Federation\/CloudFederationProviderManager.php","line":147,"function":"post","class":"OC\\Http\\Client\\Client","type":"->","args":["https:\/\/test.***.at\/ocm\/shares",{"body":"{\"shareWith\":\"***@https:\\\/\\\/test.***.at\",\"shareType\":\"user\",\"name\":\"testfedlong dshdfssdsrdrsgsdhgsdhgdbergesrgxghdsxdrgxdcvggesbrxdfghexrgchgxgdrgcfgcg.md\",\"resourceType\":\"file\",\"description\":\"\",\"providerId\":3,\"owner\":\"***@https:\\\/\\\/test.***.at\\\/\",\"ownerDisplayName\":\"***\",\"sharedBy\":\"***@https:\\\/\\\/test.***.at\\\/\",\"sharedByDisplayName\":\"***\",\"protocol\":{\"name\":\"webdav\",\"options\":{\"sharedSecret\":\"IPOXdcDEq2nTgU2\",\"permissions\":\"{http:\\\/\\\/open-cloud-mesh.org\\\/ns}share-permissions\"}}}","headers":{"content-type":"application\/json"},"timeout":10,"connect_timeout":10}]},{"file":"\/srv\/***\/web\/apps\/federatedfilesharing\/lib\/Notifications.php","line":400,"function":"sendShare","class":"OC\\Federation\\CloudFederationProviderManager","type":"->","args":[{"__class__":"OC\\Federation\\CloudFederationShare"}]},{"file":"\/srv\/***\/web\/apps\/federatedfilesharing\/lib\/Notifications.php","line":323,"function":"tryOCMEndPoint","class":"OCA\\FederatedFileSharing\\Notifications","type":"->","args":["https:\/\/test.***.at",{"shareWith":"***","token":"IPOXdcDEq2nTgU2","name":"testfedlong dshdfssdsrdrsgsdhgsdhgdbergesrgxghdsxdrgxdcvggesbrxdfghexrgchgxgdrgcfgcg.md","remoteId":3,"owner":"***","ownerFederatedId":"***@https:\/\/test.***.at\/","sharedBy":"***","sharedByFederatedId":"***@https:\/\/test.***.at\/","remote":"https:\/\/test.***.at\/","shareType":6},"share"]},{"file":"\/srv\/***\/web\/apps\/federatedfilesharing\/lib\/Notifications.php","line":116,"function":"tryHttpPostToShareEndpoint","class":"OCA\\FederatedFileSharing\\Notifications","type":"->","args":["https:\/\/test.***.at","",{"shareWith":"***","token":"IPOXdcDEq2nTgU2","name":"testfedlong dshdfssdsrdrsgsdhgsdhgdbergesrgxghdsxdrgxdcvggesbrxdfghexrgchgxgdrgcfgcg.md","remoteId":3,"owner":"***","ownerFederatedId":"***@https:\/\/test.***.at\/","sharedBy":"***","sharedByFederatedId":"***@https:\/\/test.***.at\/","remote":"https:\/\/test.***.at\/","shareType":6}]},{"file":"\/srv\/***\/web\/apps\/federatedfilesharing\/lib\/FederatedShareProvider.php","line":284,"function":"sendRemoteShare","class":"OCA\\FederatedFileSharing\\Notifications","type":"->","args":["IPOXdcDEq2nTgU2","***@test.***.at","testfedlong dshdfssdsrdrsgsdhgsdhgdbergesrgxghdsxdrgxdcvggesbrxdfghexrgchgxgdrgcfgcg.md",3,"***","***@https:\/\/test.***.at\/","***","***@https:\/\/test.***.at\/",6]},{"file":"\/srv\/***\/web\/apps\/federatedfilesharing\/lib\/FederatedShareProvider.php","line":238,"function":"createFederatedShare","class":"OCA\\FederatedFileSharing\\FederatedShareProvider","type":"->","args":[{"__class__":"OC\\Share20\\Share"}]},{"file":"\/srv\/***\/web\/lib\/private\/Share20\/Manager.php","line":694,"function":"create","class":"OCA\\FederatedFileSharing\\FederatedShareProvider","type":"->","args":[{"__class__":"OC\\Share20\\Share"}]},{"file":"\/srv\/***\/web\/apps\/files_sharing\/lib\/Controller\/ShareAPIController.php","line":567,"function":"createShare","class":"OC\\Share20\\Manager","type":"->","args":[{"__class__":"OC\\Share20\\Share"}]},{"file":"\/srv\/***\/web\/lib\/private\/AppFramework\/Http\/Dispatcher.php","line":170,"function":"createShare","class":"OCA\\Files_Sharing\\Controller\\ShareAPIController","type":"->","args":[{"__class__":"OC\\Files\\Node\\File"},19,6,"***@test.***.at","false","",null,"",""]},{"file":"\/srv\/***\/web\/lib\/private\/AppFramework\/Http\/Dispatcher.php","line":99,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[{"__class__":"OCA\\Files_Sharing\\Controller\\ShareAPIController"},"createShare"]},{"file":"\/srv\/***\/web\/lib\/private\/AppFramework\/App.php","line":126,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[{"__class__":"OCA\\Files_Sharing\\Controller\\ShareAPIController"},"createShare"]},{"file":"\/srv\/***\/web\/lib\/private\/AppFramework\/Routing\/RouteActionHandler.php","line":47,"function":"main","class":"OC\\AppFramework\\App","type":"::","args":["OCA\\Files_Sharing\\Controller\\ShareAPIController","createShare",{"__class__":"OC\\AppFramework\\DependencyInjection\\DIContainer"},{"_route":"ocs.files_sharing.ShareAPI.createShare"}]},{"function":"__invoke","class":"OC\\AppFramework\\Routing\\RouteActionHandler","type":"->","args":[{"_route":"ocs.files_sharing.ShareAPI.createShare"}]},{"file":"\/srv\/***\/web\/lib\/private\/Route\/Router.php","line":297,"function":"call_user_func","args":[{"__class__":"OC\\AppFramework\\Routing\\RouteActionHandler"},{"_route":"ocs.files_sharing.ShareAPI.createShare"}]},{"file":"\/srv\/***\/web\/ocs\/v1.php","line":82,"function":"match","class":"OC\\Route\\Router","type":"->","args":["\/ocsapp\/apps\/files_sharing\/api\/v1\/shares"]},{"file":"\/srv\/***\/web\/ocs\/v2.php","line":24,"args":["\/srv\/***\/web\/ocs\/v1.php"],"function":"require_once"}],"File":"\/srv\/***\/web\/3rdparty\/guzzlehttp\/guzzle\/src\/Exception\/RequestException.php","Line":113,"CustomMessage":"Failed to notify remote server of federated share, removing share."},"userAgent":"Mozilla\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\/537.36 (KHTML, like Gecko) Chrome\/80.0.3987.116 Safari\/537.36","version":"17.0.2.1"} ```

Browser log

Browser log ``` no javascript-errors - just turns out in network-tab, that the 500 - error is acutally a 403 (forbidden) error ```
aignerat commented 4 years ago

the solution: /apps/files_sharing/appinfo/database.xml edit length of name from 64 to 256 or even more, according to the needs

timbru31 commented 4 years ago

Confirming the bug and the workaround to rename the files. Really bad UX to display a 403 error message - I thought the other Nextcloud instance had problems.

(Nextcloud 18.0.6 on Ubuntu 20.04 with Apache 2.4.43-1+ubuntu20.04.1+deb.sury.org+7)

szaimen commented 3 years ago

Is this Issue still valid? If not, please close this issue. Thanks! :)

ghost commented 3 years ago

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