Skip to content

Commit 4644b71

Browse files
committed
Swift: # -> //
1 parent 2870bc2 commit 4644b71

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

swift/ql/src/queries/Security/CWE-730/RegexInjectionBad.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
func 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

swift/ql/src/queries/Security/CWE-730/RegexInjectionGood.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
func 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)

0 commit comments

Comments
 (0)