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 66<overview >
77<p >
88Constructing 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
Original file line number Diff line number Diff 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)
You can’t perform that action at this time.
0 commit comments