Skip to content

Commit 6f3dba5

Browse files
committed
Swift: Tweak qhelp and example.
1 parent 7f9cb16 commit 6f3dba5

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

swift/ql/src/queries/Security/CWE-730/RegexInjection.qhelp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66
<overview>
77
<p>
88
Constructing a regular expression with unsanitized user input is dangerous,
9-
since a malicious user may be able to modify the meaning of the expression. In
10-
particular, such a user may be able to provide a regular expression fragment
11-
that takes exponential time in the worst case, and use that to perform a Denial
12-
of Service attack.
9+
since a malicious user may be able to modify the meaning of the expression. They
10+
may be able to cause unexpected program behaviour, or perform a Denial of Service
11+
attack. For example they may provide a regular expression fragment that takes
12+
exponential time to evaluate in the worst case.
1313
</p>
1414
</overview>
1515

swift/ql/src/queries/Security/CWE-730/RegexInjectionGood.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ func processRemoteInput(remoteInput: String) {
44
# GOOD: Regular expression is not derived from user input
55
let regex1 = try Regex(myRegex)
66

7-
# GOOD: Sanitized user input is used to construct a regular expression
7+
# GOOD: User input is sanitized before being used to construct a regular expression
88
let escapedInput = NSRegularExpression.escapedPattern(for: remoteInput)
99
let regexStr = "abc|\(escapedInput)"
1010
let regex2 = try NSRegularExpression(pattern: regexStr)

0 commit comments

Comments
 (0)