Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ruby: Add mysql2 model #14916

Draft
wants to merge 8 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
268 changes: 268 additions & 0 deletions ruby/ql/lib/codeql/ruby/frameworks/carrierwave/model.yml

Large diffs are not rendered by default.

138 changes: 138 additions & 0 deletions ruby/ql/lib/codeql/ruby/frameworks/http_clients/httparty/model.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
extensions:
- addsTo:
pack: codeql/ruby-all
extensible: sourceModel
data: []

- addsTo:
pack: codeql/ruby-all
extensible: sinkModel
data:
- ["HTTParty::Request","Method[_load].Argument[0]","code-injection"]
- ["HTTParty::Response","Method[_load].Argument[0]","code-injection"]
- ["HTTParty::ClassMethods","Method[get].Argument[0]","request-forgery"]
- ["HTTParty::ClassMethods","Method[post].Argument[0]","request-forgery"]
- ["HTTParty::ClassMethods","Method[patch].Argument[0]","request-forgery"]
- ["HTTParty::ClassMethods","Method[put].Argument[0]","request-forgery"]
- ["HTTParty::ClassMethods","Method[delete].Argument[0]","request-forgery"]
- ["HTTParty::ClassMethods","Method[move].Argument[0]","request-forgery"]
- ["HTTParty::ClassMethods","Method[head].Argument[0]","request-forgery"]
- ["HTTParty::ClassMethods","Method[options].Argument[0]","request-forgery"]
- ["HTTParty::ClassMethods","Method[mkcol].Argument[0]","request-forgery"]
- ["HTTParty::ClassMethods","Method[lock].Argument[0]","request-forgery"]
- ["HTTParty::ClassMethods","Method[unlock].Argument[0]","request-forgery"]
- ["HTTParty::ClassMethods","Method[build_request].Argument[1]","request-forgery"]

- addsTo:
pack: codeql/ruby-all
extensible: summaryModel
data:
- ["HTTParty::CookieHash","Method[add_cookies]","Argument[0]","ReturnValue","taint"]
- ["HTTParty::CookieHash","Method[to_cookie_string]","Argument[self]","ReturnValue","value"]
- ["HTTParty::HashConversions","Method[to_params]","Argument[0]","ReturnValue","taint"]
- ["HTTParty::HashConversions","Method[normalize_param]","Argument[0]","ReturnValue","taint"]
- ["HTTParty::HashConversions","Method[normalize_param]","Argument[1]","ReturnValue","taint"]
- ["HTTParty::Request","Method[path=]","Argument[0]","ReturnValue","value"]
- ["HTTParty::Response::Headers","Method[==]","Argument[0]","ReturnValue","taint"]
- ["HTTParty::Response","Method[tap]","Argument[self]","ReturnValue","value"]
- ["HTTParty::Response","Method[to_s]","Argument[self]","ReturnValue","taint"]
- ["HTTParty::ClassMethods","Method[logger]","Argument[2]","ReturnValue","value"]
- ["HTTParty::ClassMethods","Method[raise_on]","Argument[0]","ReturnValue","taint"]
- ["HTTParty::ClassMethods","Method[http_proxy]","Argument[3]","ReturnValue","value"]
- ["HTTParty::ClassMethods","Method[base_uri]","Argument[0]","ReturnValue","taint"]
- ["HTTParty::ClassMethods","Method[default_params]","Argument[0]","ReturnValue","taint"]
- ["HTTParty::ClassMethods","Method[default_timeout]","Argument[0]","ReturnValue","value"]
- ["HTTParty::ClassMethods","Method[open_timeout]","Argument[0]","ReturnValue","value"]
- ["HTTParty::ClassMethods","Method[read_timeout]","Argument[0]","ReturnValue","value"]
- ["HTTParty::ClassMethods","Method[write_timeout]","Argument[0]","ReturnValue","value"]
- ["HTTParty::ClassMethods","Method[debug_output]","Argument[0]","ReturnValue","value"]
- ["HTTParty::ClassMethods","Method[follow_redirects]","Argument[0]","ReturnValue","value"]
- ["HTTParty::ClassMethods","Method[no_follow]","Argument[0]","ReturnValue","value"]
- ["HTTParty::ClassMethods","Method[maintain_method_across_redirects]","Argument[0]","ReturnValue","value"]
- ["HTTParty::ClassMethods","Method[resend_on_redirect]","Argument[0]","ReturnValue","value"]
- ["HTTParty::ClassMethods","Method[pem]","Argument[1]","ReturnValue","value"]
- ["HTTParty::ClassMethods","Method[pkcs12]","Argument[1]","ReturnValue","value"]
- ["HTTParty::ClassMethods","Method[query_string_normalizer]","Argument[0]","ReturnValue","value"]
- ["HTTParty::ClassMethods","Method[ssl_version]","Argument[0]","ReturnValue","value"]
- ["HTTParty::ClassMethods","Method[skip_decompression]","Argument[0]","ReturnValue","taint"]
- ["HTTParty::ClassMethods","Method[ciphers]","Argument[0]","ReturnValue","value"]
- ["HTTParty::ClassMethods","Method[ssl_ca_file]","Argument[0]","ReturnValue","value"]
- ["HTTParty::ClassMethods","Method[ssl_ca_path]","Argument[0]","ReturnValue","value"]
- ["HTTParty::ClassMethods","Method[uri_adapter]","Argument[0]","ReturnValue","value"]
- ["HTTParty::ClassMethods","Method[connection_adapter]","Argument[1]","ReturnValue","value"]

- addsTo:
pack: codeql/ruby-all
extensible: neutralModel
data:
- ["BasicAuthentication","Method[extended]","summary"]
- ["DigestAuthentication","Method[extended]","summary"]
- ["DigestAuthenticationUsingMD5Sess","Method[extended]","summary"]
- ["BasicMongrelHandler","Method[initialize]","summary"]
- ["BasicMongrelHandler","Method[process]","summary"]
- ["BasicMongrelHandler","Method[reply_with]","summary"]
- ["DeflateHandler","Method[process]","summary"]
- ["GzipHandler","Method[process]","summary"]
- ["BasicAuthentication","Method[process]","summary"]
- ["BasicAuthentication","Method[authorized?]","summary"]
- ["DigestAuthentication","Method[process]","summary"]
- ["DigestAuthentication","Method[authorized?]","summary"]
- ["DigestAuthenticationUsingMD5Sess","Method[process]","summary"]
- ["DigestAuthenticationUsingMD5Sess","Method[md5]","summary"]
- ["DigestAuthenticationUsingMD5Sess","Method[authorized?]","summary"]
- ["HTTParty::ConnectionAdapter","Method[call]","summary"]
- ["HTTParty::ConnectionAdapter","Method[default_cert_store]","summary"]
- ["HTTParty::ConnectionAdapter","Method[initialize]","summary"]
- ["HTTParty::ConnectionAdapter","Method[connection]","summary"]
- ["HTTParty::HeadersProcessor","Method[initialize]","summary"]
- ["HTTParty::HeadersProcessor","Method[call]","summary"]
- ["HTTParty::ClassMethods","Method[basic_auth]","summary"]

- addsTo:
pack: codeql/ruby-all
extensible: typeModel
data:
- ["HTTParty::Response","HTTParty::Request","Method[perform].ReturnValue"]
- ["HTTParty::ResponseFragment","HTTParty::Request","Method[perform].Argument[0].Parameter[0]"]
- ["HTTParty::ResponseFragment","HTTParty::Request","Method[perform].Argument[block].Parameter[0]"]
- ["HTTParty::Response","HTTParty::Request","Method[handle_unauthorized].ReturnValue"]
- ["HTTParty::ResponseFragment","HTTParty::Request","Method[handle_unauthorized].Argument[0].Parameter[0]"]
- ["HTTParty::ResponseFragment","HTTParty::Request","Method[handle_unauthorized].Argument[block].Parameter[0]"]
- ["HTTParty::Response","HTTParty::Response","Method[tap].ReturnValue"]
- ["HTTParty::Response","HTTParty::ClassMethods","Method[get].ReturnValue"]
- ["HTTParty::ResponseFragment","HTTParty::ClassMethods","Method[get].Argument[block].Parameter[0]"]
- ["HTTParty::ResponseFragment","HTTParty::ClassMethods","Method[get].Argument[2].Parameter[0]"]
- ["HTTParty::Response","HTTParty::ClassMethods","Method[post].ReturnValue"]
- ["HTTParty::ResponseFragment","HTTParty::ClassMethods","Method[post].Argument[block].Parameter[0]"]
- ["HTTParty::ResponseFragment","HTTParty::ClassMethods","Method[post].Argument[2].Parameter[0]"]
- ["HTTParty::Response","HTTParty::ClassMethods","Method[patch].ReturnValue"]
- ["HTTParty::ResponseFragment","HTTParty::ClassMethods","Method[patch].Argument[block].Parameter[0]"]
- ["HTTParty::ResponseFragment","HTTParty::ClassMethods","Method[patch].Argument[2].Parameter[0]"]
- ["HTTParty::Response","HTTParty::ClassMethods","Method[put].ReturnValue"]
- ["HTTParty::ResponseFragment","HTTParty::ClassMethods","Method[put].Argument[block].Parameter[0]"]
- ["HTTParty::ResponseFragment","HTTParty::ClassMethods","Method[put].Argument[2].Parameter[0]"]
- ["HTTParty::Response","HTTParty::ClassMethods","Method[delete].ReturnValue"]
- ["HTTParty::ResponseFragment","HTTParty::ClassMethods","Method[delete].Argument[block].Parameter[0]"]
- ["HTTParty::ResponseFragment","HTTParty::ClassMethods","Method[delete].Argument[2].Parameter[0]"]
- ["HTTParty::Response","HTTParty::ClassMethods","Method[move].ReturnValue"]
- ["HTTParty::ResponseFragment","HTTParty::ClassMethods","Method[move].Argument[block].Parameter[0]"]
- ["HTTParty::ResponseFragment","HTTParty::ClassMethods","Method[move].Argument[2].Parameter[0]"]
- ["HTTParty::Response","HTTParty::ClassMethods","Method[copy].ReturnValue"]
- ["HTTParty::ResponseFragment","HTTParty::ClassMethods","Method[copy].Argument[block].Parameter[0]"]
- ["HTTParty::ResponseFragment","HTTParty::ClassMethods","Method[copy].Argument[2].Parameter[0]"]
- ["HTTParty::Response","HTTParty::ClassMethods","Method[head].ReturnValue"]
- ["HTTParty::ResponseFragment","HTTParty::ClassMethods","Method[head].Argument[block].Parameter[0]"]
- ["HTTParty::ResponseFragment","HTTParty::ClassMethods","Method[head].Argument[2].Parameter[0]"]
- ["HTTParty::Response","HTTParty::ClassMethods","Method[options].ReturnValue"]
- ["HTTParty::ResponseFragment","HTTParty::ClassMethods","Method[options].Argument[block].Parameter[0]"]
- ["HTTParty::ResponseFragment","HTTParty::ClassMethods","Method[options].Argument[2].Parameter[0]"]
- ["HTTParty::Response","HTTParty::ClassMethods","Method[mkcol].ReturnValue"]
- ["HTTParty::ResponseFragment","HTTParty::ClassMethods","Method[mkcol].Argument[2].Parameter[0]"]
- ["HTTParty::ResponseFragment","HTTParty::ClassMethods","Method[mkcol].Argument[block].Parameter[0]"]
- ["HTTParty::Response","HTTParty::ClassMethods","Method[lock].ReturnValue"]
- ["HTTParty::ResponseFragment","HTTParty::ClassMethods","Method[lock].Argument[2].Parameter[0]"]
- ["HTTParty::ResponseFragment","HTTParty::ClassMethods","Method[lock].Argument[block].Parameter[0]"]
- ["HTTParty::Response","HTTParty::ClassMethods","Method[unlock].ReturnValue"]
- ["HTTParty::ResponseFragment","HTTParty::ClassMethods","Method[unlock].Argument[2].Parameter[0]"]
- ["HTTParty::ResponseFragment","HTTParty::ClassMethods","Method[unlock].Argument[block].Parameter[0]"]
- ["HTTParty::Request","HTTParty::ClassMethods","Method[build_request].ReturnValue"]
51 changes: 51 additions & 0 deletions ruby/ql/lib/codeql/ruby/frameworks/mysql2/model.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
extensions:
- addsTo:
pack: codeql/ruby-all
extensible: sourceModel
data:
- ["Mysql2::Client", "Method[async_result].ReturnValue","remote"]
- ["Mysql2::Client", "Method[next_result].ReturnValue","remote"]
- ["Mysql2::Client", "Method[store_result].ReturnValue","remote"]
- ["Mysql2::EM::Client", "Method[async_result].ReturnValue","remote"]
- ["Mysql2::EM::Client", "Method[next_result].ReturnValue","remote"]
- ["Mysql2::EM::Client", "Method[store_result].ReturnValue","remote"]

- addsTo:
pack: codeql/ruby-all
extensible: sinkModel
data:
- ["Mysql2::Client","Method[query].Argument[0]","sql-injection"]
- ["Mysql2::Client","Method[prepare].Argument[0]","sql-injection"]
- ["Mysql2::EM::Client","Method[query].Argument[0]","sql-injection"]
- ["Mysql2::EM::Client","Method[prepare].Argument[0]","sql-injection"]

- addsTo:
pack: codeql/ruby-all
extensible: summaryModel
data:
- ["Mysql2::Client","Method[parse_flags_array]","Argument[1]","ReturnValue","value"]

- addsTo:
pack: codeql/ruby-all
extensible: neutralModel
data:
- ["Mysql2::Client!","Method[default_query_options]","summary"]
- ["Mysql2::Client","Method[initialize]","summary"]
- ["Mysql2::Client","Method[parse_ssl_mode]","summary"]
- ["Mysql2::Client","Method[find_default_ca_path]","summary"]
- ["Mysql2::Client","Method[parse_connect_attrs]","summary"]
- ["Mysql2::Client","Method[query_info]","summary"]
- ["Mysql2::Client","Method[info]","summary"]
- ["Mysql2::EM::Client::Watcher","Method[initialize]","summary"]
- ["Mysql2::EM::Client::Watcher","Method[notify_readable]","summary"]
- ["Mysql2::EM::Client::Watcher","Method[watching?]","summary"]
- ["Mysql2::EM::Client::Watcher","Method[unbind]","summary"]
- ["Mysql2::EM::Client","Method[close]","summary"]
- ["Mysql2::Error!","Method[new_with_args]","summary"]
- ["Mysql2::Error","Method[initialize]","summary"]
- ["Mysql2::Statement","Method[execute]","summary"]

- addsTo:
pack: codeql/ruby-all
extensible: typeModel
data: []
Loading
Loading