@dcrays/mobook-security-plugin 2.0.14 → 2.0.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.js CHANGED
@@ -749,6 +749,53 @@ export default function register(api) {
749
749
  }
750
750
  }
751
751
 
752
+ // ============================================================
753
+ // 禁止 OpenClaw 自动更新
754
+ // ============================================================
755
+
756
+ // 路径1:gateway 工具 update.run
757
+ if (toolName === "gateway" && params?.action === "update.run") {
758
+ alert(`BLOCKED: 尝试通过 gateway 更新 OpenClaw`);
759
+ return {
760
+ block: true,
761
+ blockReason: "🛡️ 安全插件拦截:禁止自动更新 OpenClaw,需人工确认后手动执行"
762
+ };
763
+ }
764
+
765
+ // 路径2:gateway config 修改自动更新相关配置
766
+ if (toolName === "gateway" && ["config.patch", "config.apply"].includes(params?.action)) {
767
+ const raw = params?.raw || JSON.stringify(params);
768
+ if (/auto.?update|"updates?"/i.test(raw)) {
769
+ alert(`BLOCKED: 尝试通过配置修改 OpenClaw 自动更新设置 | action=${params.action}`);
770
+ return {
771
+ block: true,
772
+ blockReason: "🛡️ 安全插件拦截:禁止修改 OpenClaw 自动更新配置,需人工确认"
773
+ };
774
+ }
775
+ }
776
+
777
+ // 路径3:exec 命令安装/更新 OpenClaw
778
+ if (toolName === "exec") {
779
+ const cmd = params.command || "";
780
+ const openclawUpdatePatterns = [
781
+ /npm\s+(i|install|update|up|upgrade)\s+.*\bopenclaw\b/i,
782
+ /yarn\s+(global\s+)?add\s+.*\bopenclaw\b/i,
783
+ /yarn\s+(global\s+)?upgrade\s+.*\bopenclaw\b/i,
784
+ /pnpm\s+(add|update|install|upgrade)\s+.*\bopenclaw\b/i,
785
+ /npx\s+.*\bopenclaw\b.*update/i,
786
+ /brew\s+(upgrade|reinstall)\s+.*\bopenclaw\b/i,
787
+ /\bopenclaw\s+update\b/i,
788
+ /\bopenclaw\s+gateway\s+update\b/i,
789
+ ];
790
+ if (openclawUpdatePatterns.some(p => p.test(cmd))) {
791
+ alert(`BLOCKED: 尝试通过命令行更新 OpenClaw | cmd: ${cmd.slice(0, 200)}`);
792
+ return {
793
+ block: true,
794
+ blockReason: "🛡️ 安全插件拦截:禁止通过包管理器更新 OpenClaw,需人工确认后手动执行"
795
+ };
796
+ }
797
+ }
798
+
752
799
  return {};
753
800
  });
754
801
 
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "id": "mobook-security-plugin",
3
3
  "name": "MoBook 安全防护插件",
4
- "version": "2.0.14",
4
+ "version": "2.0.15",
5
5
  "description": "MoBook 企业级安全插件 - 危险命令分级拦截、敏感信息全渠道脱敏(身份证GB11643/银行卡Luhn校验)、LLM响应拦截、操作审计",
6
6
  "entry": "./index.js",
7
7
  "type": "plugin",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dcrays/mobook-security-plugin",
3
- "version": "2.0.14",
3
+ "version": "2.0.15",
4
4
  "type": "module",
5
5
  "description": "MoBook 企业级安全插件 - 危险命令分级拦截、敏感信息全渠道脱敏(身份证GB11643/银行卡Luhn校验)、LLM响应拦截、操作审计",
6
6
  "main": "index.js",