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 1
1
func processRemoteInput( remoteInput: String ) {
2
2
...
3
3
4
- # BAD: Unsanitized user input is used to construct a regular expression
4
+ // BAD: Unsanitized user input is used to construct a regular expression
5
5
let regex1 = try Regex ( remoteInput)
6
6
7
- # BAD: Unsanitized user input is used to construct a regular expression
7
+ // BAD: Unsanitized user input is used to construct a regular expression
8
8
let regexStr = " abc| \( remoteInput) "
9
9
let regex2 = try NSRegularExpression ( pattern: regexStr)
10
10
Original file line number Diff line number Diff line change 1
1
func processRemoteInput( remoteInput: String ) {
2
2
...
3
3
4
- # GOOD: Regular expression is not derived from user input
4
+ // GOOD: Regular expression is not derived from user input
5
5
let regex1 = try Regex ( myRegex)
6
6
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
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