File tree Expand file tree Collapse file tree 2 files changed +5
-5
lines changed
swift/ql/src/queries/Security/CWE-730 Expand file tree Collapse file tree 2 files changed +5
-5
lines changed Original file line number Diff line number Diff line change 6
6
<overview >
7
7
<p >
8
8
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 .
13
13
</p >
14
14
</overview >
15
15
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ func processRemoteInput(remoteInput: String) {
4
4
# GOOD: Regular expression is not derived from user input
5
5
let regex1 = try Regex ( myRegex)
6
6
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
8
8
let escapedInput = NSRegularExpression . escapedPattern ( for: remoteInput)
9
9
let regexStr = " abc| \( escapedInput) "
10
10
let regex2 = try NSRegularExpression ( pattern: regexStr)
You can’t perform that action at this time.
0 commit comments