Skip to content

Commit cc94c42

Browse files
committed
Address review comments
1 parent baeffa2 commit cc94c42

File tree

2 files changed

+5
-5
lines changed
  • cpp/ql/test/query-tests/Security/CWE/CWE-022/semmle/tests
  • swift/ql/test/query-tests/Security/CWE-094

2 files changed

+5
-5
lines changed

cpp/ql/test/query-tests/Security/CWE/CWE-022/semmle/tests/test.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ int main(int argc, char** argv) { // $ Source=argv
7373
char buffer[1024];
7474
read(0, buffer, 1024); // $ Source=read_output1
7575
read(0, buffer, 1024); // $ Source=read_output2
76-
fopen(buffer, "wb+"); // $ Alert=read_output1 $ Alert=read_output2
76+
fopen(buffer, "wb+"); // $ SPURIOUS: Alert=read_output1 $ Alert=read_output2 [duplicated with both sources]
7777
}
7878

7979
{

swift/ql/test/query-tests/Security/CWE-094/UnsafeJsEval.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -201,17 +201,17 @@ func testSync(_ sink: @escaping (String) -> ()) {
201201
let url = URL(string: "http://example.com/")
202202

203203
sink(localString) // GOOD: the HTML data is local
204-
sink(try! String(contentsOf: URL(string: "http://example.com/")!)) // $ Source=source1 $ MISSING: Alert HTML contains remote input, may access local secrets
205-
sink(try! String(contentsOf: url!)) // $ Source=source2 $ MISSING: Alert
204+
sink(try! String(contentsOf: URL(string: "http://example.com/")!)) // $ Source=source1
205+
sink(try! String(contentsOf: url!)) // $ Source=source2
206206

207207
sink("console.log(" + localStringFragment + ")") // GOOD: the HTML data is local
208-
sink("console.log(" + (try! String(contentsOf: url!)) + ")") // $ Source=source3 $ MISSING: Alert
208+
sink("console.log(" + (try! String(contentsOf: url!)) + ")") // $ Source=source3
209209

210210
let localData = Data(localString.utf8)
211211
let remoteData = Data((try! String(contentsOf: url!)).utf8) // $ Source=source4
212212

213213
sink(String(decoding: localData, as: UTF8.self)) // GOOD: the data is local
214-
sink(String(decoding: remoteData, as: UTF8.self)) // $ MISSING: Alert the data is remote
214+
sink(String(decoding: remoteData, as: UTF8.self))
215215

216216
sink("console.log(" + String(Int(localStringFragment) ?? 0) + ")") // GOOD: Primitive conversion
217217
sink("console.log(" + String(Int(try! String(contentsOf: url!)) ?? 0) + ")") // GOOD: Primitive conversion

0 commit comments

Comments
 (0)