15815213711
2024-08-26 f988680f27ff7393867ed3828010ca2d4c6f9a9e
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
const Log = require('ee-core/log');
const EE = require('ee-core/ee');
 
/**
 * 安全插件
 * @class
 */
class SecurityAddon {
 
  constructor() {
  }
 
  /**
   * 创建
   */
  create () {
    Log.info('[addon:security] load');
    const { CoreApp } = EE;
    const runWithDebug = process.argv.find(function(e){
      let isHasDebug = e.includes("--inspect") || e.includes("--inspect-brk") || e.includes("--remote-debugging-port");
      return isHasDebug;
    })
  
    // 不允许远程调试
    if (runWithDebug) {
      Log.error('[error] Remote debugging is not allowed,  runWithDebug:', runWithDebug);
      CoreApp.appQuit();
    }
  }
}
 
SecurityAddon.toString = () => '[class SecurityAddon]';
module.exports = SecurityAddon;