mirror of
https://github.com/github/codeql.git
synced 2026-04-28 18:25:24 +02:00
add Zip::File.new to framework
This commit is contained in:
@@ -11,6 +11,15 @@ private import codeql.ruby.ApiGraphs
|
||||
* Classes and predicates for modeling the RubyZip library
|
||||
*/
|
||||
module RubyZip {
|
||||
/**
|
||||
* A call to `Zip::File.new`, considered as a `FileSystemAccess`
|
||||
*/
|
||||
class RubyZipFileNew extends DataFlow::CallNode, FileSystemAccess::Range {
|
||||
RubyZipFileNew() { this = API::getTopLevelMember("Zip").getMember("File").getAnInstantiation() }
|
||||
|
||||
override DataFlow::Node getAPathArgument() { result = this.getArgument(0) }
|
||||
}
|
||||
|
||||
/**
|
||||
* A call to `Zip::File.open`, considered as a `FileSystemAccess`.
|
||||
*/
|
||||
|
||||
@@ -1 +1,4 @@
|
||||
rubyZipFileOpens
|
||||
| Archive.rb:2:12:2:35 | call to open |
|
||||
rubyZipFileNew
|
||||
| Archive.rb:5:12:5:34 | call to new |
|
||||
|
||||
@@ -2,3 +2,5 @@ private import ruby
|
||||
private import codeql.ruby.frameworks.Archive
|
||||
|
||||
query predicate rubyZipFileOpens(RubyZip::RubyZipFileOpen f) { any() }
|
||||
|
||||
query predicate rubyZipFileNew(RubyZip::RubyZipFileNew f) { any() }
|
||||
|
||||
@@ -1,2 +1,5 @@
|
||||
# `foo_file` is a RubyZip `Zip::File.open` instance
|
||||
foo_file = Zip::File.open(filename)
|
||||
|
||||
# `new_file` is a RubyZip `Zip::File.new` instance
|
||||
new_file = Zip::File.new(filename)
|
||||
|
||||
Reference in New Issue
Block a user