mirror of
https://github.com/github/codeql.git
synced 2026-04-28 10:15:14 +02:00
Swift: # -> //
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
func processRemoteInput(remoteInput: String) {
|
||||
...
|
||||
|
||||
# BAD: Unsanitized user input is used to construct a regular expression
|
||||
// BAD: Unsanitized user input is used to construct a regular expression
|
||||
let regex1 = try Regex(remoteInput)
|
||||
|
||||
# BAD: Unsanitized user input is used to construct a regular expression
|
||||
// BAD: Unsanitized user input is used to construct a regular expression
|
||||
let regexStr = "abc|\(remoteInput)"
|
||||
let regex2 = try NSRegularExpression(pattern: regexStr)
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
func processRemoteInput(remoteInput: String) {
|
||||
...
|
||||
|
||||
# GOOD: Regular expression is not derived from user input
|
||||
// GOOD: Regular expression is not derived from user input
|
||||
let regex1 = try Regex(myRegex)
|
||||
|
||||
# GOOD: User input is sanitized before being used to construct a regular expression
|
||||
// GOOD: User input is sanitized before being used to construct a regular expression
|
||||
let escapedInput = NSRegularExpression.escapedPattern(for: remoteInput)
|
||||
let regexStr = "abc|\(escapedInput)"
|
||||
let regex2 = try NSRegularExpression(pattern: regexStr)
|
||||
|
||||
Reference in New Issue
Block a user