Mattermost-server: Whitepage After Uploading Plugin With Invalid settings_schema value

Created on 24 Apr 2019  ·  7Comments  ·  Source: mattermost/mattermost-server

Summary

White page occurs after uploading server only plugin

Steps to reproduce

Mattermost Version: 5.10.0
Database Schema Version: 5.10.0
Database: postgres
Build Hash: dc70ab42034da17eaf23be5a86abae81b3f1cd21
EE Build Hash: none
Webapp Build Hash: b95e32fa7719c0d9c71650666f06a64e17fa659b
Build Date: Tue Apr 16 23:13:47 UTC 2019

Steps:

  1. Build the plugin at https://github.com/kkirsche/mattermost-plugin-issue-example using the command make bundle
  2. Navigate to system console's plugins screen
  3. Upload plugin from step 1 (note that this has a duplicate file name for the executable as welcome bot)
  4. Plugin page will display the upload has succeeded
  5. Refresh page
  6. White page is displayed with error in console

Expected behavior

System console would load correctly

Observed behavior (that appears unintentional)

Page does not load, causing white page and unusable system console.

# websocket_client.jsx:35 
websocket connecting to wss://REDACTED_URL/api/v4/websocket
# websocket_client.jsx:156 
websocket closed
# react-dom.production.min.js:198 
TypeError: Cannot read property 'length' of null
    at admin_sidebar.jsx:302
    at Array.forEach (<anonymous>)
    at t.renderPluginsMenu (admin_sidebar.jsx:301)
    at admin_sidebar.jsx:213
    at Array.map (<anonymous>)
    at t.value (admin_sidebar.jsx:385)
    at ko (react-dom.production.min.js:173)
    at Wo (react-dom.production.min.js:172)
    at Co (react-dom.production.min.js:180)
    at Yi (react-dom.production.min.js:232)
di @ react-dom.production.min.js:198
# admin_sidebar.jsx:302 
Uncaught (in promise) TypeError: Cannot read property 'length' of null
    at admin_sidebar.jsx:302
    at Array.forEach (<anonymous>)
    at t.renderPluginsMenu (admin_sidebar.jsx:301)
    at admin_sidebar.jsx:213
    at Array.map (<anonymous>)
    at t.value (admin_sidebar.jsx:385)
    at ko (react-dom.production.min.js:173)
    at Wo (react-dom.production.min.js:172)
    at Co (react-dom.production.min.js:180)
    at Yi (react-dom.production.min.js:232)

Screen Shot 2019-04-24 at 15 50 37

Running on

DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=18.04
DISTRIB_CODENAME=bionic
DISTRIB_DESCRIPTION="Ubuntu 18.04.2 LTS"
NAME="Ubuntu"
VERSION="18.04.2 LTS (Bionic Beaver)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 18.04.2 LTS"
VERSION_ID="18.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=bionic
UBUNTU_CODENAME=bionic

as user:group of mattermost:mattermost

Mattermost is using two other plugins at the time this occurs:

● mattermost.service - Mattermost
   Loaded: loaded (/lib/systemd/system/mattermost.service; enabled; vendor preset: enabled)
   Active: active (running) since Wed 2019-04-24 19:35:19 UTC; 28min ago
 Main PID: 15109 (mattermost)
    Tasks: 34 (limit: 4662)
   CGroup: /system.slice/mattermost.service
           ├─15109 /opt/mattermost/bin/mattermost
           ├─15138 plugins/com.mattermost.welcomebot/server/dist/plugin-linux-amd64
           └─15153 plugins/com.pdcncs-sc01.golangbot/plugin.exe

Apr 24 19:35:16 pdcncs-mm01 systemd[1]: Starting Mattermost...
Apr 24 19:35:19 pdcncs-mm01 systemd[1]: Started Mattermost.

Possible fixes

Unknown

Bug ReporOpen

Most helpful comment

All 7 comments

After investigating this more in comparison to https://github.com/mattermost/mattermost-plugin-sample this is being caused by Mattermost not validating the settings schema provided by the plugin. By updating the example plugin's setting schema to the following:

    "settings_schema": {
        "header": "",
        "footer": "",
        "settings": []
    }

This issue no longer occurs.

As a result, Mattermost should validate the plugin.json manifest and ensure that it is valid / meets minimum requirements before attempting to display it

@hanzei Do you know if there is a bug here that I can open a bug ticket for?

@amyblais @hanzei it looks like the validation in

https://github.com/mattermost/mattermost-webapp/blob/81589f29cc05056cdbe21485c71dbd5e304c241a/components/admin_console/admin_sidebar/admin_sidebar.jsx#L239

Needs to be updated to do complete validation of settings. It seems like, if I'm reading the code right, the failure is on:

p.settings_schema.settings.length > 0

@amyblais That's defiantly a bug.

@kkirsche Would you be open on submitting a PR to fix this?

Let me take a look at how difficult it is to get a developer instance setup of mattermost in terms of building so I can do the appropriate testing. I'm not opposed to submitting a PR to fix this, I'm just not sure if the build system is sufficiently complex that it'd be faster / more efficient for someone else to run with it.

Was this page helpful?
0 / 5 - 0 ratings