Skip to content

Commit 0be6f84

Browse files
committed
Add sample
1 parent 1ad7bd9 commit 0be6f84

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Bad: arbitrary code execution
1+
// Bad: ScriptEngine allows arbitrary code injection
22
ScriptEngineManager scriptEngineManager = new ScriptEngineManager();
33
ScriptEngine scriptEngine = scriptEngineManager.getEngineByExtension("js");
44
Object result = scriptEngine.eval(code);

java/ql/src/Security/CWE/CWE-094/ScriptEngine.qhelp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,7 @@ Use "Cloudbees Rhino Sandbox" or sandboxing with SecurityManager or use <a href=
1414

1515
<example>
1616
The following code could executes random JavaScript code
17-
ScriptEngineManager scriptEngineManager = new ScriptEngineManager();
18-
ScriptEngine scriptEngine = scriptEngineManager.getEngineByExtension("js");
19-
Object result = scriptEngine.eval(code);
17+
<sample src="ScriptEngine.java" />
2018
</example>
2119

2220
<references>

0 commit comments

Comments
 (0)