Skip to content

Commit 7eab085

Browse files
committed
add source code examples to blocksCharInAccess
1 parent 8b03ab0 commit 7eab085

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

javascript/ql/src/semmle/javascript/security/dataflow/UnsafeShellCommandConstructionCustomizations.qll

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,19 @@ module UnsafeShellCommandConstruction {
218218
/**
219219
* Holds if `instance` is an instance of the access-path `ap`, and there exists a guard
220220
* that ensures that `instance` is not equal to `char`.
221+
*
222+
* For example if `ap` is `str[i]` and `char` is `<`:
223+
* ```JavaScript
224+
* if (str[i] !== "<" && ...) {
225+
* var foo = str[i]; // <- `instance`
226+
* }
227+
* ```
228+
* or
229+
* ```JavaScript
230+
* if (!(str[i] == "<" || ...)) {
231+
* var foo = str[i]; // <- `instance`
232+
* }
233+
* ```
221234
*/
222235
private predicate blocksCharInAccess(AccessPath ap, string char, Expr instance) {
223236
exists(BasicBlock bb, ConditionGuardNode guard, EqualityTest test |

0 commit comments

Comments
 (0)