mcp-server-semgrep
Version:
MCP Server for Semgrep Integration - static code analysis with AI
29 lines (23 loc) • 591 B
JavaScript
const el = element.innerHTML;
function bad1(userInput) {
// ruleid: insecure-document-method
el.innerHTML = '<div>' + userInput + '</div>';
}
function bad2(userInput) {
// ruleid: insecure-document-method
document.body.outerHTML = userInput;
}
function bad3(userInput) {
const name = '<div>' + userInput + '</div>';
// ruleid: insecure-document-method
document.write(name);
}
function ok1() {
const name = "<div>it's ok</div>";
// ok: insecure-document-method
el.innerHTML = name;
}
function ok2() {
// ok: insecure-document-method
document.write("<div>it's ok</div>");
}