Skip to content

Commit 2f7f9d9

Browse files
authored
Move explanation of example above sample code
1 parent aa95dd4 commit 2f7f9d9

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

javascript/ql/src/Security/CWE-094/UnsafeCodeConstruction.qhelp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,18 +26,16 @@ inputs, or avoid constructing code in the first place.
2626
<example>
2727
<p>
2828
The following example shows two methods implemented using `eval`: a simple
29-
deserialization routine and a getter method.
29+
deserialization routine and a getter method.
30+
If untrusted inputs are used with these methods,
31+
then an attacker might be able to execute arbitrary code on the system.
3032
</p>
3133

3234
<sample src="examples/UnsafeCodeConstruction.js" />
3335

34-
<p>
35-
If untrusted inputs are used with these methods,
36-
then an attacker might be able to execute arbitrary code on the system.
37-
</p>
3836
<p>
3937
To avoid this problem, either properly document that the function is potentially
40-
unsafe, or use an alternative solution such as `JSON.parse` or another library
38+
unsafe, or use an alternative solution such as `JSON.parse` or another library, like in the examples below,
4139
that does not allow arbitrary code to be executed.
4240
</p>
4341

0 commit comments

Comments
 (0)