Swift: Label the now missing cases for CWE-020 and dataflow.

This commit is contained in:
Geoffrey White
2024-11-26 10:16:09 +00:00
parent 8bcc5f4bf8
commit 6130679c34
3 changed files with 4 additions and 5 deletions

View File

@@ -1,3 +1,2 @@
testFailures
| test.swift:863:24:864:1 | // $ flow=873\n | Missing result: flow=873 |
failures

View File

@@ -860,7 +860,7 @@ func testVarargs3(_ v: Int, _ args: Int...) {
sink(arg: args[1]) // $ flow=873
for arg in args {
sink(arg: arg) // $ flow=873
sink(arg: arg) // $ MISSING: flow=873
}
let myKeyPath = \[Int][1]

View File

@@ -79,9 +79,9 @@ func tests(url: String, secure: Bool) throws {
_ = try NSRegularExpression(pattern: #"https?://good.com:8080"#).firstMatch(in: input, range: inputRange) // BAD (missing anchor)
let trustedUrlRegexs = [
"https?://good.com", // BAD (missing anchor), referenced below
#"https?:\/\/good.com"#, // BAD (missing anchor), referenced below
"^https?://good.com" // BAD (missing post-anchor), referenced below
"https?://good.com", // BAD (missing anchor), referenced below [NOT DETECTED]
#"https?:\/\/good.com"#, // BAD (missing anchor), referenced below [NOT DETECTED]
"^https?://good.com" // BAD (missing post-anchor), referenced below [NOT DETECTED]
]
for trustedUrlRegex in trustedUrlRegexs {
if let _ = try NSRegularExpression(pattern: trustedUrlRegex).firstMatch(in: input, range: inputRange) { }