安全漏洞 / 高 / 工具系统
electron/harness/sandbox/sandbox.ts
scanCode 用于检测代码字符串中的危险操作,但当前模式集遗漏:
require('fs')
require('child_process')
import('fs')
process.binding('fs')
Reflect.get(globalThis, 'req' + 'uire')
new Function('return process')()
project_memory.md 要求:
sandbox scanCode must include 28 patterns with 'i' flag and base64/$() detection to prevent encoding bypass
但实际模式数可能不足或未覆盖上述场景。
const DANGEROUS_PATTERNS = [ /\brequire\s*\(\s*['"]fs['"]\s*\)/i, /\brequire\s*\(\s*['"]child_process['"]\s*\)/i, /\bimport\s*\(\s*['"]fs['"]\s*\)/i, /\bprocess\.binding\s*\(/i, /\bnew\s+Function\s*\(/i, /\bReflect\.get\s*\(/i, /\beval\s*\(/i, /\bFunction\s*\(\s*['"]return process['"]\s*\)/i, // ... 28+ patterns ];
No dependencies set.
The note is not visible to the blocked user.
问题类型
安全漏洞 / 高 / 工具系统
文件位置
electron/harness/sandbox/sandbox.ts问题描述
scanCode 用于检测代码字符串中的危险操作,但当前模式集遗漏:
require('fs')/require('child_process')等同步 require 形式import('fs')动态 importprocess.binding('fs')底层绑定Reflect.get(globalThis, 'req' + 'uire')字符串拼接绕过new Function('return process')()函数构造project_memory.md 要求:
但实际模式数可能不足或未覆盖上述场景。
影响
建议修复