mirror of
https://github.com/github/codeql.git
synced 2026-05-01 11:45:14 +02:00
Ruby: update Files.ql tests for write accesses
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
fileInstances
|
||||
| Files.rb:2:1:2:30 | ... = ... |
|
||||
| Files.rb:2:1:2:30 | ... = ... |
|
||||
| Files.rb:2:12:2:30 | call to new |
|
||||
| Files.rb:2:1:2:36 | ... = ... |
|
||||
| Files.rb:2:1:2:36 | ... = ... |
|
||||
| Files.rb:2:12:2:36 | call to new |
|
||||
| Files.rb:3:1:3:21 | ... = ... |
|
||||
| Files.rb:3:1:3:21 | ... = ... |
|
||||
| Files.rb:3:14:3:21 | foo_file |
|
||||
@@ -15,10 +15,12 @@ fileInstances
|
||||
| Files.rb:24:19:24:40 | call to open |
|
||||
| Files.rb:37:1:37:33 | ... = ... |
|
||||
| Files.rb:37:14:37:33 | call to open |
|
||||
| Files.rb:40:1:40:8 | foo_file |
|
||||
| Files.rb:41:1:41:26 | call to open |
|
||||
ioInstances
|
||||
| Files.rb:2:1:2:30 | ... = ... |
|
||||
| Files.rb:2:1:2:30 | ... = ... |
|
||||
| Files.rb:2:12:2:30 | call to new |
|
||||
| Files.rb:2:1:2:36 | ... = ... |
|
||||
| Files.rb:2:1:2:36 | ... = ... |
|
||||
| Files.rb:2:12:2:36 | call to new |
|
||||
| Files.rb:3:1:3:21 | ... = ... |
|
||||
| Files.rb:3:1:3:21 | ... = ... |
|
||||
| Files.rb:3:14:3:21 | foo_file |
|
||||
@@ -40,6 +42,12 @@ ioInstances
|
||||
| Files.rb:35:13:35:56 | call to open |
|
||||
| Files.rb:37:1:37:33 | ... = ... |
|
||||
| Files.rb:37:14:37:33 | call to open |
|
||||
| Files.rb:40:1:40:8 | foo_file |
|
||||
| Files.rb:41:1:41:26 | call to open |
|
||||
| Files.rb:44:1:44:45 | ... = ... |
|
||||
| Files.rb:44:1:44:45 | ... = ... |
|
||||
| Files.rb:44:11:44:45 | call to open |
|
||||
| Files.rb:48:1:48:7 | io_file |
|
||||
fileModuleReaders
|
||||
| Files.rb:7:13:7:32 | call to readlines |
|
||||
ioReaders
|
||||
@@ -64,7 +72,21 @@ fileSystemAccesses
|
||||
| Files.rb:20:13:20:25 | call to read |
|
||||
| Files.rb:29:12:29:29 | call to read |
|
||||
| Files.rb:37:14:37:33 | call to open |
|
||||
| Files.rb:40:1:40:22 | call to puts |
|
||||
| Files.rb:41:1:41:26 | call to open |
|
||||
| Files.rb:41:1:41:43 | call to write |
|
||||
| Files.rb:48:1:48:40 | call to printf |
|
||||
fileNameSources
|
||||
| Files.rb:10:6:10:18 | call to path |
|
||||
| Files.rb:11:6:11:21 | call to to_path |
|
||||
| Files.rb:14:8:14:43 | call to makedirs |
|
||||
ioWriters
|
||||
| Files.rb:48:1:48:40 | call to printf |
|
||||
fileWriters
|
||||
| Files.rb:40:1:40:22 | call to puts |
|
||||
| Files.rb:41:1:41:43 | call to write |
|
||||
| Files.rb:48:1:48:40 | call to printf |
|
||||
fileSystemWriteAccesses
|
||||
| Files.rb:40:1:40:22 | call to puts |
|
||||
| Files.rb:41:1:41:43 | call to write |
|
||||
| Files.rb:48:1:48:40 | call to printf |
|
||||
|
||||
@@ -21,3 +21,9 @@ query predicate fileSystemReadAccesses(FileSystemReadAccess a) { any() }
|
||||
query predicate fileSystemAccesses(FileSystemAccess a) { any() }
|
||||
|
||||
query predicate fileNameSources(FileNameSource s) { any() }
|
||||
|
||||
query predicate ioWriters(IO::IOWriter r) { any() }
|
||||
|
||||
query predicate fileWriters(IO::FileWriter r) { any() }
|
||||
|
||||
query predicate fileSystemWriteAccesses(FileSystemWriteAccess a) { any() }
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# `foo_file` is a `File` instance
|
||||
foo_file = File.new("foo.txt")
|
||||
foo_file = File.new("foo.txt", "a+")
|
||||
foo_file_2 = foo_file
|
||||
foo_file
|
||||
|
||||
@@ -34,4 +34,15 @@ date = IO.read("|date")
|
||||
# `rand_open` is an `IO` instance
|
||||
rand_open = IO.open(IO.sysopen("/dev/random", "r"), "r")
|
||||
|
||||
foo_file_3 = File.open("foo.txt")
|
||||
foo_file_3 = File.open("foo.txt")
|
||||
|
||||
# File write accesses
|
||||
foo_file.puts("hello")
|
||||
File.open("foo.txt", "a+").write("world\n")
|
||||
|
||||
# IO instance
|
||||
io_file = IO.open(IO.sysopen("foo.txt", "w"))
|
||||
str_1 = "hello"
|
||||
int_1 = 123
|
||||
# File/IO write
|
||||
io_file.printf("%s: %d\n", str_1, int_1)
|
||||
|
||||
Reference in New Issue
Block a user