Skip to content

Commit 83d4fb6

Browse files
authored
Merge pull request #559 from xiemaisi/js/invalid-dynamic-method-call
JavaScript: Documentation review for new query `UnvalidatedDynamicMethodCall`.
2 parents 595e6fc + 5062369 commit 83d4fb6

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

javascript/ql/src/Security/CWE-754/UnvalidatedDynamicMethodCall.qhelp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@
66
<overview>
77
<p>
88
JavaScript makes it easy to look up object properties dynamically at runtime. In particular, methods
9-
can be looked up by name and then called. However, if he method name is user controlled, an attacker
9+
can be looked up by name and then called. However, if the method name is user-controlled, an attacker
1010
could choose a name that makes the application invoke an unexpected method, which may cause a runtime
1111
exception. If this exception is not handled, it could be used to mount a denial-of-service attack.
1212
</p>
1313
<p>
14-
For example, there might not be a method of the given name or the result of the lookup might not be
15-
a function, which would cause the method call to throw a <code>TypeError</code> at runtime.
14+
For example, there might not be a method of the given name, or the result of the lookup might not be
15+
a function. In either case the method call will throw a <code>TypeError</code> at runtime.
1616
</p>
1717
<p>
1818
Another, more subtle example is where the result of the lookup is a standard library method from
@@ -33,7 +33,7 @@ If the dynamic method lookup cannot be avoided, consider whitelisting permitted
3333
the very least, check that the method is an own property and not inherited from the prototype object.
3434
If the object on which the method is looked up contains properties that are not methods, you
3535
should additionally check that the result of the lookup is a function. Even if the object only
36-
contains methods it is still a good idea to perform this check in case other properties are
36+
contains methods, it is still a good idea to perform this check in case other properties are
3737
added to the object later on.
3838
</p>
3939
</recommendation>

0 commit comments

Comments
 (0)