Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

该方案能让你的网页安全的植入第三方代码,在运行时分配沙箱隔离,被隔离代码在调用"location, top, document.cookie, alert, console, prototype"等时均会被拦截及记录操作行为并返回空值,同时运行器也能对代码设置类操作权限,以控制代码的有效操作。

Notifications You must be signed in to change notification settings

P79N6A/ShadowFunction

Repository files navigation

ShadowFunction

该方案能让你的网页安全的植入第三方代码,在运行时分配沙箱隔离,被隔离代码在调用"location, top, document.cookie, alert, console, prototype"等时均会被拦截及记录操作行为并返回空值,同时运行器也能对代码设置类操作权限,以控制代码的有效操作。

上手

npm 安装:

$ npm install shadow-function --save

简单的应用:

import { ShadowFunction, ShadowDocument } from 'shadow-function'
new ShadowFunction('console.log(a + b)')({a: 1, b: 2, console}) // 3
let sDoc = new ShadowDocument(document.body, '<div>123</div>')
sDoc(`
 document.body.append($template.content);
 console.log(document.body.getElementsByTagName("div")[0].innerText)
`)({console})

About

该方案能让你的网页安全的植入第三方代码,在运行时分配沙箱隔离,被隔离代码在调用"location, top, document.cookie, alert, console, prototype"等时均会被拦截及记录操作行为并返回空值,同时运行器也能对代码设置类操作权限,以控制代码的有效操作。

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

AltStyle によって変換されたページ (->オリジナル) /