YunoHost-Apps / nextcloud_ynh

Nextcloud package for YunoHost
https://nextcloud.com/
GNU Affero General Public License v3.0
147 stars 64 forks source link

Scan files fails due to symlink not followed #345

Open moutonjr opened 4 years ago

moutonjr commented 4 years ago

Hello team,

Since https://github.com/nextcloud/server/issues/20592, the NextCloud file scan does not follow symlinks. OK, it's written in README, but my %USER%/Multimedia is broken after manual update: "Forbidden operation". I'm pretty sure that there is a YNH workaround. Either there is a wrapped (yet unknown to myself) command to update, or there is a bug ? This is blocking my prod instance as my multimedia files disappeared.

Intended : # sudo -su nextcloud php7.3 /var/www/nextcloud/occ files:scan MYUSER

Expected : All files scanned. MYUSER files available from WebUI.

Got:

Starting scan for user 1 out of 1 (MYUSER)
Exception during scan: Following symlinks is not allowed
#0 /var/www/nextcloud/lib/private/Files/Storage/Local.php(161): OC\Files\Storage\Local->getSourcePath('/Share')
#1 /var/www/nextcloud/lib/private/Files/Storage/Common.php(884): OC\Files\Storage\Local->getMetaData('/Share')
#2 [internal function]: OC\Files\Storage\Common->getDirectoryContent('')
#3 /var/www/nextcloud/lib/private/Files/Cache/Scanner.php(408): iterator_to_array(Object(Generator))
#4 /var/www/nextcloud/lib/private/Files/Cache/Scanner.php(388): OC\Files\Cache\Scanner->handleChildren('', true, 3, 286839, true, 0)
#5 /var/www/nextcloud/lib/private/Files/Cache/Scanner.php(340): OC\Files\Cache\Scanner->scanChildren('', true, 3, 286839, true)
#6 /var/www/nextcloud/lib/private/Files/Utils/Scanner.php(260): OC\Files\Cache\Scanner->scan('', true, 3)
#7 /var/www/nextcloud/apps/files/lib/Command/Scan.php(151): OC\Files\Utils\Scanner->scan('/kifof', true, NULL)
#8 /var/www/nextcloud/apps/files/lib/Command/Scan.php(207): OCA\Files\Command\Scan->scanFiles('kifof', '/kifof', Object(Symfony\Component\Console\Output\ConsoleOutput), false, true, false)
#9 /var/www/nextcloud/3rdparty/symfony/console/Command/Command.php(255): OCA\Files\Command\Scan->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#10 /var/www/nextcloud/core/Command/Base.php(169): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#11 /var/www/nextcloud/3rdparty/symfony/console/Application.php(1012): OC\Core\Command\Base->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#12 /var/www/nextcloud/3rdparty/symfony/console/Application.php(272): Symfony\Component\Console\Application->doRunCommand(Object(OCA\Files\Command\Scan), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#13 /var/www/nextcloud/3rdparty/symfony/console/Application.php(148): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#14 /var/www/nextcloud/lib/private/Console/Application.php(215): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#15 /var/www/nextcloud/console.php(100): OC\Console\Application->run()
#16 /var/www/nextcloud/occ(11): require_once('/var/www/nextcl...')
#17 {main}

Version: nextcloud 19.0.3~ynh1 from yunohost 4.0.8

kay0u commented 4 years ago

Hi,

The workaround i found is to:

The is an issue about the "risks" of allowing symlinks here

Ping @YunoHost-Apps/apps-group do you have any idea?

moutonjr commented 4 years ago

Acknowledge the workaround (and associated security issue) I'm eager to look forward the fix though.

Thank you @kay0u

yalh76 commented 4 years ago

Ping @YunoHost-Apps/apps-group do you have any idea?

no idea :/

benneti commented 4 years ago

Came accross this issue, too. Simply deleting the symlinks is probably the simplest for now, while not elegant.

adocampo commented 4 years ago

I need as well the possibility to follow symlinks created by the root, so I had to change Local.php which is not ideal at all. I'm upvoting for a config.php option so we can upgrade safely.

artybdrlt commented 1 year ago

@kay0u I saw you merged the commit "Allow symlinks" but I don't see it now in the master branch. Did you give up on allowing symlinks in the end?