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

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

Open
j-ed opened this issue May 26, 2017 · 14 comments
Open

Comments

@j-ed
Copy link

j-ed commented May 26, 2017

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

@PVince81
Copy link
Contributor

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

@davitol
Copy link

davitol commented May 26, 2017

WFM too

@j-ed
Copy link
Author

j-ed commented May 26, 2017

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
Copy link
Author

j-ed commented May 26, 2017

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.

@kerlerm
Copy link

kerlerm commented Oct 3, 2018

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

@kerlerm
Copy link

kerlerm commented Oct 7, 2018

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

@PVince81
Copy link
Contributor

PVince81 commented Oct 8, 2018

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

@davitol
Copy link

davitol commented Oct 9, 2018

#724 (comment)

@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)

@kerlerm
Copy link

kerlerm commented Oct 9, 2018 via email

@kerlerm
Copy link

kerlerm commented Oct 12, 2018

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?

@PVince81
Copy link
Contributor

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 ?

@kerlerm
Copy link

kerlerm commented Oct 15, 2018

'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
Copy link

kerlerm commented Oct 15, 2018

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?

@PVince81
Copy link
Contributor

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.

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

No branches or pull requests

4 participants