Fabrizz / MMM-OnSpotify

Highly customizable MM2 module that displays what you are listening to in Spotify. Compatible with MMM-LiveLyrics and DynamicTheming.
MIT License
53 stars 9 forks source link

Installation and Startup Error in MagicMirror Due to Security Vulnerabilities and Configuration Syntax Error #64

Closed Hunter00712 closed 2 months ago

Hunter00712 commented 3 months ago

Description: While attempting to install and configure MagicMirror for university purposes, I encountered two issues. Firstly, during the installation process, I faced security vulnerabilities. Secondly, a syntax error in the configuration file prevented MagicMirror from starting properly.

Steps to Reproduce:

  1. Tried to install MagicMirror for university use, encountering the following issue:

    # npm audit report
    
    request  *
    Severity: moderate
    Server-Side Request Forgery in Request - https://github.com/advisories/GHSA-p8p7-x288-28g6
    Depends on vulnerable versions of tough-cookie
    No fix available
    node_modules/request
    
    tough-cookie  <4.1.3
    Severity: moderate
    tough-cookie Prototype Pollution vulnerability - https://github.com/advisories/GHSA-72xf-g2v4-qvf3
    No fix available
    node_modules/tough-cookie
    
    2 moderate severity vulnerabilities
    
    Some issues need review, and may require choosing
    a different dependency.
  2. Despite the listed security vulnerabilities, attempted to proceed with the installation.

  3. After installation, MagicMirror failed to start. The following error message was displayed:

    [2024-04-08 09:31:29.894] [INFO]  Checking file...  /home/tom/MagicMirror/config/config.js
    [2024-04-08 09:31:30.004] [ERROR] Your configuration file contains syntax errors :(
    [2024-04-08 09:31:30.007] [ERROR] Line 100 column 5: Parsing error: Unexpected token advertisePlayerTheme

Expected Behavior: I expected MagicMirror to install and start successfully without encountering security vulnerabilities or failing due to syntax errors in the configuration file.

Additional Information:

/ DO NOT EDIT THE LINE BELOW / if (typeof module !== "undefined") { module.exports = config; }


- What could I do to make this work
Fabrizz commented 3 months ago

Hi,

1 Serverside packages with issues

The vulnerabilities are on packages used on the service that you use to generate the base config, as its just a thing that you turn on once to get the access_token, and its not a pubic server its a non-issue, still, I will change the version (pr dep) to another version.

2 Configuration error

I do not recommend just copying and pasting the entire default config, as everything listed there is just default, you should use the Auth Service (as described here) to create the base config with your spotify credentials, then if you want to change a setting you just add that entry

                {
                         /* Don't share your credentials! */
                         module: "MMM-OnSpotify",
                         position: "bottom_right", /* bottom_left, bottom_center */
                                 config: {
                                 clientID: "key" /* <------------------- Missing comma here */
                                 clientSecret: "key" /* <------------------- Missing comma here */
                                 accessToken: "key" /*<------------------- Missing comma here */
                                 refreshToken: "key" /* <------------------- Missing comma here */

                                /* Add here your theming and behaviour configurations */
                                        // General module options [SEE BELOW]
                                advertisePlayerTheme: true,