File tree Expand file tree Collapse 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 Expand file tree Collapse file tree 2 files changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -73,7 +73,7 @@ int main(int argc, char** argv) { // $ Source=argv
73
73
char buffer [1024 ];
74
74
read (0 , buffer , 1024 ); // $ Source=read_output1
75
75
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]
77
77
}
78
78
79
79
{
Original file line number Diff line number Diff line change @@ -201,17 +201,17 @@ func testSync(_ sink: @escaping (String) -> ()) {
201
201
let url = URL ( string: " http://example.com/ " )
202
202
203
203
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
206
206
207
207
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
209
209
210
210
let localData = Data ( localString. utf8)
211
211
let remoteData = Data ( ( try ! String ( contentsOf: url!) ) . utf8) // $ Source=source4
212
212
213
213
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) )
215
215
216
216
sink ( " console.log( " + String( Int ( localStringFragment) ?? 0 ) + " ) " ) // GOOD: Primitive conversion
217
217
sink ( " console.log( " + String( Int ( try ! String ( contentsOf: url!) ) ?? 0 ) + " ) " ) // GOOD: Primitive conversion
You can’t perform that action at this time.
0 commit comments