File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed
swift/ql/test/query-tests/Security/CWE-089 Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -35,7 +35,7 @@ class MyDatabase {
3535 func query( sqlStatement: String ) { }
3636 func query( sqliteStatement: String ) { }
3737
38- // non-examples
38+ // non-examples
3939 func doSomething( sqlIndex: Int ) { }
4040 func doSomething( sqliteContext: Sql ) { }
4141}
@@ -45,8 +45,8 @@ class MyDatabase {
4545func test_heuristic( db: MyDatabase ) throws {
4646 let remoteString = try String ( contentsOf: URL ( string: " http://example.com/ " ) !)
4747
48- _ = MyDatabase ( )
49- _ = MyDatabase ( sql: " some_fixed_sql " )
48+ _ = MyDatabase ( ) // GOOD
49+ _ = MyDatabase ( sql: " some_fixed_sql " ) // GOOD
5050 _ = MyDatabase ( sql: remoteString) // BAD
5151
5252 db. execute1 ( remoteString) // BAD
@@ -59,6 +59,6 @@ func test_heuristic(db: MyDatabase) throws {
5959 db. query ( sqlStatement: remoteString) // BAD [NOT DETECTED]
6060 db. query ( sqliteStatement: remoteString) // BAD [NOT DETECTED]
6161
62- db. doSomething ( sqlIndex: Int ( remoteString) ?? 0 )
63- db. doSomething ( sqliteContext: remoteString as! Sql )
62+ db. doSomething ( sqlIndex: Int ( remoteString) ?? 0 ) // GOOD
63+ db. doSomething ( sqliteContext: remoteString as! Sql ) // GOOD
6464}
You can’t perform that action at this time.
0 commit comments