tea3 / hexo-related-popular-posts

A hexo plugin that generates a list of links to related posts and popular posts. Also , this plugin can get Visitor Counts (PV) on posts.
MIT License
109 stars 14 forks source link

Google analytics configuration not clear or out-of-date #17

Open yrxwin opened 5 years ago

yrxwin commented 5 years ago

Seems this plugin needs the following configuration setup in _config, while some fields seem a bit out-of-date (maybe just because I am not that familiar with the google API, but the dependency ga-analytics seems hasn't been updated for quite a while). Would that be possible to either update the dependency and configuration, or add some detailed guild on how to obtain the following fields? Thanks!

popularPosts: 
  googleAnalyticsAPI: 
    clientId:  ******. apps.googleusercontent.com            # google analytics API Service account acquired with 
    serviceEmail:  *****@developer.gserviceaccount.com      # E-mail address obtained with the google analytics API 
    key:  /hexo-project-root/path/to/google-services.pem    # With the google analytics API Path of acquired pem file 
    viewId:  12345678                                       # View ID tied with google analytics 
    dateRange:  30                                          # (Optional) Time period (days) to count PV number Default is 30 
    expiresDate:  10 
tea3 commented 5 years ago

@yrxwin Thank you for the telling me that Google API Specification refreshed. As you say, this plugin rely on ga-analytics. Are there any other plugins recommended ? Please tell me the plugin if you possible.

The above options are used the following code. https://github.com/tea3/hexo-related-popular-posts/blob/master/lib/googleAnalytics.js#L77-L86

wafer-li commented 4 years ago

@tea3 What about https://www.npmjs.com/package/googleapis You could see the related post: https://flaviocopes.com/google-analytics-api-nodejs/

CoreJa commented 4 years ago

Since ga-analytics is published 5 years ago, it depends on a deprecated version of lodash, which is causing github and npm warnings.

┌───────────────┬──────────────────────────────────────────────────────────────┐
│ Moderate      │ Regular Expression Denial of Service                         │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package       │ hawk                                                         │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Patched in    │ >=3.1.3 < 4.0.0 || >=4.1.1                                   │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ hexo-related-popular-posts                                   │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path          │ hexo-related-popular-posts > ga-analytics > googleapis >     │
│               │ request > hawk                                               │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info     │ https://npmjs.com/advisories/77                              │
└───────────────┴──────────────────────────────────────────────────────────────┘
┌───────────────┬──────────────────────────────────────────────────────────────┐
│ Moderate      │ Prototype Pollution                                          │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package       │ hoek                                                         │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Patched in    │ > 4.2.0 < 5.0.0 || >= 5.0.3                                  │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ hexo-related-popular-posts                                   │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path          │ hexo-related-popular-posts > ga-analytics > googleapis >     │
│               │ request > hawk > boom > hoek                                 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info     │ https://npmjs.com/advisories/566                             │
└───────────────┴──────────────────────────────────────────────────────────────┘
┌───────────────┬──────────────────────────────────────────────────────────────┐
│ Moderate      │ Prototype Pollution                                          │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package       │ hoek                                                         │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Patched in    │ > 4.2.0 < 5.0.0 || >= 5.0.3                                  │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ hexo-related-popular-posts                                   │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path          │ hexo-related-popular-posts > ga-analytics > googleapis >     │
│               │ request > hawk > cryptiles > boom > hoek                     │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info     │ https://npmjs.com/advisories/566                             │
└───────────────┴──────────────────────────────────────────────────────────────┘
┌───────────────┬──────────────────────────────────────────────────────────────┐
│ Moderate      │ Prototype Pollution                                          │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package       │ hoek                                                         │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Patched in    │ > 4.2.0 < 5.0.0 || >= 5.0.3                                  │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ hexo-related-popular-posts                                   │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path          │ hexo-related-popular-posts > ga-analytics > googleapis >     │
│               │ request > hawk > hoek                                        │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info     │ https://npmjs.com/advisories/566                             │
└───────────────┴──────────────────────────────────────────────────────────────┘
┌───────────────┬──────────────────────────────────────────────────────────────┐
│ Moderate      │ Prototype Pollution                                          │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package       │ hoek                                                         │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Patched in    │ > 4.2.0 < 5.0.0 || >= 5.0.3                                  │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ hexo-related-popular-posts                                   │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path          │ hexo-related-popular-posts > ga-analytics > googleapis >     │
│               │ request > hawk > sntp > hoek                                 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info     │ https://npmjs.com/advisories/566                             │
└───────────────┴──────────────────────────────────────────────────────────────┘
┌───────────────┬──────────────────────────────────────────────────────────────┐
│ Low           │ Prototype Pollution                                          │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package       │ lodash                                                       │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Patched in    │ >=4.17.5                                                     │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ hexo-related-popular-posts                                   │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path          │ hexo-related-popular-posts > ga-analytics > lodash           │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info     │ https://npmjs.com/advisories/577                             │
└───────────────┴──────────────────────────────────────────────────────────────┘
┌───────────────┬──────────────────────────────────────────────────────────────┐
│ High          │ Prototype Pollution                                          │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package       │ lodash                                                       │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Patched in    │ >=4.17.11                                                    │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ hexo-related-popular-posts                                   │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path          │ hexo-related-popular-posts > ga-analytics > lodash           │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info     │ https://npmjs.com/advisories/782                             │
└───────────────┴──────────────────────────────────────────────────────────────┘
┌───────────────┬──────────────────────────────────────────────────────────────┐
│ High          │ Prototype Pollution                                          │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package       │ lodash                                                       │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Patched in    │ >=4.17.12                                                    │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ hexo-related-popular-posts                                   │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path          │ hexo-related-popular-posts > ga-analytics > lodash           │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info     │ https://npmjs.com/advisories/1065                            │
└───────────────┴──────────────────────────────────────────────────────────────┘
┌───────────────┬──────────────────────────────────────────────────────────────┐
│ Moderate      │ Memory Exposure                                              │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package       │ tunnel-agent                                                 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Patched in    │ >=0.6.0                                                      │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ hexo-related-popular-posts                                   │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path          │ hexo-related-popular-posts > ga-analytics > googleapis >     │
│               │ request > tunnel-agent                                       │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info     │ https://npmjs.com/advisories/598                             │
└───────────────┴──────────────────────────────────────────────────────────────┘
┌───────────────┬──────────────────────────────────────────────────────────────┐
│ Moderate      │ Out-of-bounds Read                                           │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package       │ base64url                                                    │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Patched in    │ >=3.0.0                                                      │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ hexo-related-popular-posts                                   │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path          │ hexo-related-popular-posts > ga-analytics > googleapis >     │
│               │ gapitoken > jws > base64url                                  │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info     │ https://npmjs.com/advisories/658                             │
└───────────────┴──────────────────────────────────────────────────────────────┘
┌───────────────┬──────────────────────────────────────────────────────────────┐
│ Moderate      │ Out-of-bounds Read                                           │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package       │ base64url                                                    │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Patched in    │ >=3.0.0                                                      │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ hexo-related-popular-posts                                   │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path          │ hexo-related-popular-posts > ga-analytics > googleapis >     │
│               │ gapitoken > jws > jwa > base64url                            │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info     │ https://npmjs.com/advisories/658                             │
└───────────────┴──────────────────────────────────────────────────────────────┘
┌───────────────┬──────────────────────────────────────────────────────────────┐
│ Low           │ Regular Expression Denial of Service                         │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package       │ braces                                                       │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Patched in    │ >=2.3.1                                                      │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ hexo-related-popular-posts                                   │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path          │ hexo-related-popular-posts > hexo-fs > chokidar > anymatch > │
│               │ micromatch > braces                                          │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info     │ https://npmjs.com/advisories/786                             │
└───────────────┴──────────────────────────────────────────────────────────────┘
┌───────────────┬──────────────────────────────────────────────────────────────┐
│ High          │ Improper Authorization                                       │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package       │ googleapis                                                   │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Patched in    │ >=39.1.0                                                     │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ hexo-related-popular-posts                                   │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path          │ hexo-related-popular-posts > ga-analytics > googleapis       │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info     │ https://npmjs.com/advisories/791                             │
└───────────────┴──────────────────────────────────────────────────────────────┘

It might lead to potential danger according to the information above. To me, it's just annoying because everytime I deploy my repo on github page, it always warns me that I've got 14 vulnerabilities.

Hoping this issue can be soon fixed. Thanks!