Skip to content

Instantly share code, notes, and snippets.

@hsuan1117
Created November 9, 2019 13:21
Show Gist options
  • Save hsuan1117/c8981e695969b2ed2de294d845a1c4ef to your computer and use it in GitHub Desktop.
Save hsuan1117/c8981e695969b2ed2de294d845a1c4ef to your computer and use it in GitHub Desktop.
function result(text) {
document.getElementById("EvalResultSandBox").innerText = text;
}
function evalCode(code) {
if(code.from == "user_generated"){
alert("Prevent XSS (Reason: user_generated code)")
return ;
}else if(code.from == "unknown"){
alert("Prevent XSS (Reason: unknown code)")
return ;
}else if(code.from == "browser_variable"){
alert("Prevent XSS (Reason: browser_variable code)")
return ;
}else{
eval(code.code)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment