gallery icon indicating copy to clipboard operation
gallery copied to clipboard

OC 10.0.1 - unable to install Gallery app because it contains unallowed code

Open j-ed opened this issue 8 years ago • 14 comments

Expected behavior

It should be possible to install/update the Gallery app from the new Marketplace.

Current behavior

It isn't possible to install/update the Gallery app from the new Marketplace because the installer identifies unallowed code.

Steps to reproduce

  1. Open the Marketplace and select the Gallery app
  2. Select "Install"
  3. The message "Gallery v16.0.2 cannot be installed because it contains unallowed code.
![2017-05-26 13_32_54-market - owncloud](https://cloud.githubusercontent.com/assets/2572764/26493140/17b92170-4218-11e7-97dc-75a15bf03b6f.png)

The following lines were written to the log right after I've pressed the Install button:

{"reqId":"9GqYivNTxYOlxqFwbzi4","level":3,"time":"2017-05-26 15:34:15+02:00","remoteAddr":"10.0.2.2","user":"admin","app":"PHP","method":"POST","url":"\/owncloud\/index.php\/apps\/market\/apps\/gallery\/install","message":"Undefined variable: undefinedVariable at \/var\/www\/htdocs\/owncloud\/lib\/composer\/nikic\/php-parser\/lib\/PhpParser\/Lexer.php#70"}
{"reqId":"TdeBq8QJjRDVuc9MeYIt","level":3,"time":"2017-05-26 15:34:16+02:00","remoteAddr":"10.0.2.2","user":"admin","app":"PHP","method":"GET","url":"\/owncloud\/ocs\/v2.php\/apps\/notifications\/api\/v1\/notifications?format=json","message":"You are using a fallback implementation of the intl extension. Installing the native one is highly recommended instead. at \/var\/www\/htdocs\/owncloud\/lib\/composer\/patchwork\/utf8\/src\/Patchwork\/Utf8\/Bootup\/intl.php#18"}

Environment

Server Configuration

OS: Linux 3.16.42 Web server: Apache2 2.4.25 Database: MariaDB 5.5.54 PHP version: 5.6.29 ownCloud version: 10.0.1

Client Configuration

Browser: Mozilla Firefox 53.0.3 Operating system: Windows 7

j-ed avatar May 26 '17 11:05 j-ed

Hmm strange, I just managed to upgrade gallery on my own server today.

PVince81 avatar May 26 '17 12:05 PVince81

WFM too

davitol avatar May 26 '17 12:05 davitol

I just want to add that at the same time I had no problems to install/update e.g. the contacts and calendar apps. So it wouldn't expect a general problem.

j-ed avatar May 26 '17 12:05 j-ed

I've downloaded the Gallery app tar.gz file, extracted its content to the ./owncloud/apps2 folder, activated it and ran ./occ upgrade. I was able to install it without any problems.

j-ed avatar May 26 '17 13:05 j-ed

Still persistent with OC 10.0.10 and gallery 16.1.0 from market. Can't install because app "contains unallowed code".

kerlerm avatar Oct 03 '18 11:10 kerlerm

Any debugging help before I try the mentioned workaround by @j-ed ?

kerlerm avatar Oct 07 '18 09:10 kerlerm

@davitol mind reverifying ? last I checked the gallery app could be installed without issues.

PVince81 avatar Oct 08 '18 20:10 PVince81

https://github.com/owncloud/gallery/issues/724#issuecomment-304270472

@PVince81 Worked for me in past. Tested with oC 10.0.7 and WFM. Tested with 10.0.10 and Gallery 16.1.0 and works for me too

Sentry exception but the gallery app was enabled fine and works

ErrorException: require_once(/var/www/owncloud/apps/gallery/appinfo/application.php): failed to open stream: No such file or directory
  File "/var/www/owncloud/lib/autoloader.php", line 168, in handleError
    require_once $fullPath;
  File "/var/www/owncloud/lib/autoloader.php", line 168, in require_once
    require_once $fullPath;
  File "/var/www/owncloud/lib/autoloader.php", line 168, in load
    require_once $fullPath;
  File "/var/www/owncloud/lib/autoloader.php", line 0, in spl_autoload_call
    OC\Autoloader->load
  File "gallery/appinfo/app.php", line 19, in require_once
    $app = new Application();
...
(5 additional frame(s) were not displayed)

davitol avatar Oct 09 '18 09:10 davitol

How to debug?

kerlerm avatar Oct 09 '18 15:10 kerlerm

I unpacked the gallery app into ../apps manually and used the check-code to get more precise output:

./occ app:check-code gallery
Analysing apps/gallery/middleware/envcheckmiddleware.php
 1 errors
    line  155: OC_User - Static method of private class must not be called
App is not compliant

Is this the source of the problem?

// Allows a logged in user to access public links
line 155:                \OC_User::setIncognitoMode(true);

But why does it trigger an error in my owncloud installation and not in others?

kerlerm avatar Oct 12 '18 21:10 kerlerm

see https://raw.githubusercontent.com/owncloud/core/master/.github/issue_template.md to provide more info about your setup. could be some config.php switch about code checking ?

PVince81 avatar Oct 15 '18 10:10 PVince81

'appcodechecker' => true, in config.php

I will check with the next minor OC update because with the workaround mentioned above all is up & running for the moment :)

kerlerm avatar Oct 15 '18 18:10 kerlerm

https://doc.owncloud.org/server/10.0/admin_manual/configuration/server/occ_command.html says: app:check-code has multiple checks: it checks if an app uses ownCloud’s public API (OCP) or private API (OC_)

So the gallery app seems to use a "private" method (OC_User) which is not allowed?

kerlerm avatar Oct 15 '18 18:10 kerlerm

Yes. Sometimes app developers absolutely need some information and resort to using private APIs to access it. The right approach is to submit a pull request to core to extend the public API with the required method.

PVince81 avatar Oct 15 '18 19:10 PVince81