index.js 717 B

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