File tree Expand file tree Collapse file tree 2 files changed +4
-4
lines changed
swift/ql/src/queries/Security/CWE-730 Expand file tree Collapse file tree 2 files changed +4
-4
lines changed Original file line number Diff line number Diff line change 11func processRemoteInput( remoteInput: String ) {
22 ...
33
4- # BAD: Unsanitized user input is used to construct a regular expression
4+ // BAD: Unsanitized user input is used to construct a regular expression
55 let regex1 = try Regex ( remoteInput)
66
7- # BAD: Unsanitized user input is used to construct a regular expression
7+ // BAD: Unsanitized user input is used to construct a regular expression
88 let regexStr = " abc| \( remoteInput) "
99 let regex2 = try NSRegularExpression ( pattern: regexStr)
1010
Original file line number Diff line number Diff line change 11func processRemoteInput( remoteInput: String ) {
22 ...
33
4- # GOOD: Regular expression is not derived from user input
4+ // GOOD: Regular expression is not derived from user input
55 let regex1 = try Regex ( myRegex)
66
7- # GOOD: User input is sanitized before being 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