mirror of
https://github.com/github/codeql.git
synced 2026-04-28 02:05:14 +02:00
Ruby: use MaD for more precise Pathname flow summaries
This commit is contained in:
@@ -6,6 +6,7 @@ private import codeql.ruby.Concepts
|
||||
private import codeql.ruby.DataFlow
|
||||
private import codeql.ruby.dataflow.FlowSummary
|
||||
private import codeql.ruby.dataflow.internal.DataFlowDispatch
|
||||
private import codeql.ruby.frameworks.data.ModelsAsData
|
||||
|
||||
/**
|
||||
* Modeling of the `Pathname` class from the Ruby standard library.
|
||||
@@ -113,106 +114,75 @@ module Pathname {
|
||||
override DataFlow::Node getAPermissionNode() { result = permissionArg }
|
||||
}
|
||||
|
||||
/** Flow summary for `Pathname.new`. */
|
||||
private class NewSummary extends SummarizedCallable {
|
||||
NewSummary() { this = "Pathname.new" }
|
||||
|
||||
override MethodCall getACall() {
|
||||
result = API::getTopLevelMember("Pathname").getAnInstantiation().getExprNode().getExpr()
|
||||
}
|
||||
|
||||
override predicate propagatesFlowExt(string input, string output, boolean preservesValue) {
|
||||
input = "Argument[0]" and
|
||||
output = "ReturnValue" and
|
||||
preservesValue = false
|
||||
/**
|
||||
* Type summaries for the `Pathname` class, i.e. method calls that produce new
|
||||
* `Pathname` instances.
|
||||
*/
|
||||
private class PathnameTypeSummary extends ModelInput::TypeModelCsv {
|
||||
override predicate row(string row) {
|
||||
// package1;type1;package2;type2;path
|
||||
row =
|
||||
[
|
||||
// Pathname.new : Pathname
|
||||
";Pathname;;;Member[Pathname].Instance",
|
||||
// Pathname#+(path) : Pathname
|
||||
";Pathname;;Pathname;Method[+].ReturnValue",
|
||||
// Pathname#/(path) : Pathname
|
||||
";Pathname;;Pathname;Method[/].ReturnValue",
|
||||
// Pathname#basename(path) : Pathname
|
||||
";Pathname;;Pathname;Method[basename].ReturnValue",
|
||||
// Pathname#cleanpath(path) : Pathname
|
||||
";Pathname;;Pathname;Method[cleanpath].ReturnValue",
|
||||
// Pathname#expand_path(path) : Pathname
|
||||
";Pathname;;Pathname;Method[expand_path].ReturnValue",
|
||||
// Pathname#join(path) : Pathname
|
||||
";Pathname;;Pathname;Method[join].ReturnValue",
|
||||
// Pathname#realpath(path) : Pathname
|
||||
";Pathname;;Pathname;Method[realpath].ReturnValue",
|
||||
// Pathname#relative_path_from(path) : Pathname
|
||||
";Pathname;;Pathname;Method[relative_path_from].ReturnValue",
|
||||
// Pathname#sub(path) : Pathname
|
||||
";Pathname;;Pathname;Method[sub].ReturnValue",
|
||||
// Pathname#sub_ext(path) : Pathname
|
||||
";Pathname;;Pathname;Method[sub_ext].ReturnValue",
|
||||
// Pathname#to_path(path) : Pathname
|
||||
";Pathname;;Pathname;Method[to_path].ReturnValue",
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
/** Flow summary for `Pathname#dirname`. */
|
||||
private class DirnameSummary extends SimpleSummarizedCallable {
|
||||
DirnameSummary() { this = "dirname" }
|
||||
|
||||
override predicate propagatesFlowExt(string input, string output, boolean preservesValue) {
|
||||
input = "Argument[self]" and
|
||||
output = "ReturnValue" and
|
||||
preservesValue = false
|
||||
}
|
||||
}
|
||||
|
||||
/** Flow summary for `Pathname#each_filename`. */
|
||||
private class EachFilenameSummary extends SimpleSummarizedCallable {
|
||||
EachFilenameSummary() { this = "each_filename" }
|
||||
|
||||
override predicate propagatesFlowExt(string input, string output, boolean preservesValue) {
|
||||
input = "Argument[self]" and
|
||||
output = "Argument[block].Parameter[0]" and
|
||||
preservesValue = false
|
||||
}
|
||||
}
|
||||
|
||||
/** Flow summary for `Pathname#expand_path`. */
|
||||
private class ExpandPathSummary extends SimpleSummarizedCallable {
|
||||
ExpandPathSummary() { this = "expand_path" }
|
||||
|
||||
override predicate propagatesFlowExt(string input, string output, boolean preservesValue) {
|
||||
input = "Argument[self]" and
|
||||
output = "ReturnValue" and
|
||||
preservesValue = false
|
||||
}
|
||||
}
|
||||
|
||||
/** Flow summary for `Pathname#join`. */
|
||||
private class JoinSummary extends SimpleSummarizedCallable {
|
||||
JoinSummary() { this = "join" }
|
||||
|
||||
override predicate propagatesFlowExt(string input, string output, boolean preservesValue) {
|
||||
input = ["Argument[self]", "Argument[any]"] and
|
||||
output = "ReturnValue" and
|
||||
preservesValue = false
|
||||
}
|
||||
}
|
||||
|
||||
/** Flow summary for `Pathname#parent`. */
|
||||
private class ParentSummary extends SimpleSummarizedCallable {
|
||||
ParentSummary() { this = "parent" }
|
||||
|
||||
override predicate propagatesFlowExt(string input, string output, boolean preservesValue) {
|
||||
input = "Argument[self]" and
|
||||
output = "ReturnValue" and
|
||||
preservesValue = false
|
||||
}
|
||||
}
|
||||
|
||||
/** Flow summary for `Pathname#realpath`. */
|
||||
private class RealpathSummary extends SimpleSummarizedCallable {
|
||||
RealpathSummary() { this = "realpath" }
|
||||
|
||||
override predicate propagatesFlowExt(string input, string output, boolean preservesValue) {
|
||||
input = "Argument[self]" and
|
||||
output = "ReturnValue" and
|
||||
preservesValue = false
|
||||
}
|
||||
}
|
||||
|
||||
/** Flow summary for `Pathname#relative_path_from`. */
|
||||
private class RelativePathFromSummary extends SimpleSummarizedCallable {
|
||||
RelativePathFromSummary() { this = "relative_path_from" }
|
||||
|
||||
override predicate propagatesFlowExt(string input, string output, boolean preservesValue) {
|
||||
input = "Argument[self]" and
|
||||
output = "ReturnValue" and
|
||||
preservesValue = false
|
||||
}
|
||||
}
|
||||
|
||||
/** Flow summary for `Pathname#to_path`. */
|
||||
private class ToPathSummary extends SimpleSummarizedCallable {
|
||||
ToPathSummary() { this = "to_path" }
|
||||
|
||||
override predicate propagatesFlowExt(string input, string output, boolean preservesValue) {
|
||||
input = "Argument[self]" and
|
||||
output = "ReturnValue" and
|
||||
preservesValue = false
|
||||
/** Taint flow summaries for the `Pathname` class. */
|
||||
private class PathnameTaintSummary extends ModelInput::SummaryModelCsv {
|
||||
override predicate row(string row) {
|
||||
row =
|
||||
[
|
||||
// Pathname.new(path)
|
||||
";;Member[Pathname].Method[new];Argument[0];ReturnValue;taint",
|
||||
// Pathname#dirname
|
||||
";Pathname;Method[dirname];Argument[self];ReturnValue;taint",
|
||||
// Pathname#each_filename
|
||||
";Pathname;Method[each_filename];Argument[self];Argument[block].Parameter[0];taint",
|
||||
// Pathname#expand_path
|
||||
";Pathname;Method[expand_path];Argument[self];ReturnValue;taint",
|
||||
// Pathname#join
|
||||
";Pathname;Method[join];Argument[self,any];ReturnValue;taint",
|
||||
// Pathname#parent
|
||||
";Pathname;Method[parent];Argument[self];ReturnValue;taint",
|
||||
// Pathname#realpath
|
||||
";Pathname;Method[realpath];Argument[self];ReturnValue;taint",
|
||||
// Pathname#relative_path_from
|
||||
";Pathname;Method[relative_path_from];Argument[self];ReturnValue;taint",
|
||||
// Pathname#to_path
|
||||
";Pathname;Method[to_path];Argument[self];ReturnValue;taint",
|
||||
// Pathname#basename
|
||||
";Pathname;Method[basename];Argument[self];ReturnValue;taint",
|
||||
// Pathname#cleanpath
|
||||
";Pathname;Method[cleanpath];Argument[self];ReturnValue;taint",
|
||||
// Pathname#sub
|
||||
";Pathname;Method[sub];Argument[self];ReturnValue;taint",
|
||||
// Pathname#sub_ext
|
||||
";Pathname;Method[sub_ext];Argument[self];ReturnValue;taint",
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,89 +2,218 @@ failures
|
||||
edges
|
||||
| pathname_flow.rb:4:10:4:33 | call to new : | pathname_flow.rb:5:10:5:11 | pn |
|
||||
| pathname_flow.rb:4:23:4:32 | call to source : | pathname_flow.rb:4:10:4:33 | call to new : |
|
||||
| pathname_flow.rb:9:6:9:29 | call to new : | pathname_flow.rb:11:7:11:11 | ... + ... |
|
||||
| pathname_flow.rb:9:19:9:28 | call to source : | pathname_flow.rb:9:6:9:29 | call to new : |
|
||||
| pathname_flow.rb:10:6:10:29 | call to new : | pathname_flow.rb:11:7:11:11 | ... + ... |
|
||||
| pathname_flow.rb:10:19:10:28 | call to source : | pathname_flow.rb:10:6:10:29 | call to new : |
|
||||
| pathname_flow.rb:15:7:15:30 | call to new : | pathname_flow.rb:16:7:16:8 | pn : |
|
||||
| pathname_flow.rb:15:20:15:29 | call to source : | pathname_flow.rb:15:7:15:30 | call to new : |
|
||||
| pathname_flow.rb:16:7:16:8 | pn : | pathname_flow.rb:16:7:16:16 | call to dirname |
|
||||
| pathname_flow.rb:20:6:20:29 | call to new : | pathname_flow.rb:21:2:21:2 | a : |
|
||||
| pathname_flow.rb:20:19:20:28 | call to source : | pathname_flow.rb:20:6:20:29 | call to new : |
|
||||
| pathname_flow.rb:21:2:21:2 | a : | pathname_flow.rb:21:22:21:22 | x : |
|
||||
| pathname_flow.rb:21:22:21:22 | x : | pathname_flow.rb:22:8:22:8 | x |
|
||||
| pathname_flow.rb:27:6:27:29 | call to new : | pathname_flow.rb:28:7:28:7 | a : |
|
||||
| pathname_flow.rb:27:19:27:28 | call to source : | pathname_flow.rb:27:6:27:29 | call to new : |
|
||||
| pathname_flow.rb:28:7:28:7 | a : | pathname_flow.rb:28:7:28:21 | call to expand_path |
|
||||
| pathname_flow.rb:32:6:32:29 | call to new : | pathname_flow.rb:35:7:35:7 | a : |
|
||||
| pathname_flow.rb:32:19:32:28 | call to source : | pathname_flow.rb:32:6:32:29 | call to new : |
|
||||
| pathname_flow.rb:34:6:34:29 | call to new : | pathname_flow.rb:35:17:35:17 | c : |
|
||||
| pathname_flow.rb:34:19:34:28 | call to source : | pathname_flow.rb:34:6:34:29 | call to new : |
|
||||
| pathname_flow.rb:35:7:35:7 | a : | pathname_flow.rb:35:7:35:18 | call to join |
|
||||
| pathname_flow.rb:35:17:35:17 | c : | pathname_flow.rb:35:7:35:18 | call to join |
|
||||
| pathname_flow.rb:39:6:39:29 | call to new : | pathname_flow.rb:40:7:40:7 | a : |
|
||||
| pathname_flow.rb:39:19:39:28 | call to source : | pathname_flow.rb:39:6:39:29 | call to new : |
|
||||
| pathname_flow.rb:40:7:40:7 | a : | pathname_flow.rb:40:7:40:16 | call to parent |
|
||||
| pathname_flow.rb:44:6:44:29 | call to new : | pathname_flow.rb:45:7:45:7 | a : |
|
||||
| pathname_flow.rb:44:19:44:28 | call to source : | pathname_flow.rb:44:6:44:29 | call to new : |
|
||||
| pathname_flow.rb:45:7:45:7 | a : | pathname_flow.rb:45:7:45:18 | call to realpath |
|
||||
| pathname_flow.rb:49:6:49:29 | call to new : | pathname_flow.rb:50:7:50:7 | a : |
|
||||
| pathname_flow.rb:49:19:49:28 | call to source : | pathname_flow.rb:49:6:49:29 | call to new : |
|
||||
| pathname_flow.rb:50:7:50:7 | a : | pathname_flow.rb:50:7:50:38 | call to relative_path_from |
|
||||
| pathname_flow.rb:54:6:54:29 | call to new : | pathname_flow.rb:55:7:55:7 | a : |
|
||||
| pathname_flow.rb:54:19:54:28 | call to source : | pathname_flow.rb:54:6:54:29 | call to new : |
|
||||
| pathname_flow.rb:55:7:55:7 | a : | pathname_flow.rb:55:7:55:15 | call to to_path |
|
||||
| pathname_flow.rb:59:6:59:29 | call to new : | pathname_flow.rb:60:7:60:7 | a : |
|
||||
| pathname_flow.rb:59:19:59:28 | call to source : | pathname_flow.rb:59:6:59:29 | call to new : |
|
||||
| pathname_flow.rb:60:7:60:7 | a : | pathname_flow.rb:60:7:60:12 | call to to_s |
|
||||
| pathname_flow.rb:9:7:9:30 | call to new : | pathname_flow.rb:11:8:11:12 | ... + ... |
|
||||
| pathname_flow.rb:9:20:9:29 | call to source : | pathname_flow.rb:9:7:9:30 | call to new : |
|
||||
| pathname_flow.rb:10:7:10:30 | call to new : | pathname_flow.rb:11:8:11:12 | ... + ... |
|
||||
| pathname_flow.rb:10:20:10:29 | call to source : | pathname_flow.rb:10:7:10:30 | call to new : |
|
||||
| pathname_flow.rb:15:8:15:31 | call to new : | pathname_flow.rb:16:8:16:9 | pn : |
|
||||
| pathname_flow.rb:15:21:15:30 | call to source : | pathname_flow.rb:15:8:15:31 | call to new : |
|
||||
| pathname_flow.rb:16:8:16:9 | pn : | pathname_flow.rb:16:8:16:17 | call to dirname |
|
||||
| pathname_flow.rb:20:7:20:30 | call to new : | pathname_flow.rb:21:3:21:3 | a : |
|
||||
| pathname_flow.rb:20:20:20:29 | call to source : | pathname_flow.rb:20:7:20:30 | call to new : |
|
||||
| pathname_flow.rb:21:3:21:3 | a : | pathname_flow.rb:21:23:21:23 | x : |
|
||||
| pathname_flow.rb:21:23:21:23 | x : | pathname_flow.rb:22:10:22:10 | x |
|
||||
| pathname_flow.rb:27:7:27:30 | call to new : | pathname_flow.rb:28:8:28:8 | a : |
|
||||
| pathname_flow.rb:27:20:27:29 | call to source : | pathname_flow.rb:27:7:27:30 | call to new : |
|
||||
| pathname_flow.rb:28:8:28:8 | a : | pathname_flow.rb:28:8:28:22 | call to expand_path |
|
||||
| pathname_flow.rb:32:7:32:30 | call to new : | pathname_flow.rb:35:8:35:8 | a : |
|
||||
| pathname_flow.rb:32:20:32:29 | call to source : | pathname_flow.rb:32:7:32:30 | call to new : |
|
||||
| pathname_flow.rb:34:7:34:30 | call to new : | pathname_flow.rb:35:18:35:18 | c : |
|
||||
| pathname_flow.rb:34:20:34:29 | call to source : | pathname_flow.rb:34:7:34:30 | call to new : |
|
||||
| pathname_flow.rb:35:8:35:8 | a : | pathname_flow.rb:35:8:35:19 | call to join |
|
||||
| pathname_flow.rb:35:18:35:18 | c : | pathname_flow.rb:35:8:35:19 | call to join |
|
||||
| pathname_flow.rb:39:7:39:30 | call to new : | pathname_flow.rb:40:8:40:8 | a : |
|
||||
| pathname_flow.rb:39:20:39:29 | call to source : | pathname_flow.rb:39:7:39:30 | call to new : |
|
||||
| pathname_flow.rb:40:8:40:8 | a : | pathname_flow.rb:40:8:40:17 | call to parent |
|
||||
| pathname_flow.rb:44:7:44:30 | call to new : | pathname_flow.rb:45:8:45:8 | a : |
|
||||
| pathname_flow.rb:44:20:44:29 | call to source : | pathname_flow.rb:44:7:44:30 | call to new : |
|
||||
| pathname_flow.rb:45:8:45:8 | a : | pathname_flow.rb:45:8:45:19 | call to realpath |
|
||||
| pathname_flow.rb:49:7:49:30 | call to new : | pathname_flow.rb:50:8:50:8 | a : |
|
||||
| pathname_flow.rb:49:20:49:29 | call to source : | pathname_flow.rb:49:7:49:30 | call to new : |
|
||||
| pathname_flow.rb:50:8:50:8 | a : | pathname_flow.rb:50:8:50:39 | call to relative_path_from |
|
||||
| pathname_flow.rb:54:7:54:30 | call to new : | pathname_flow.rb:55:8:55:8 | a : |
|
||||
| pathname_flow.rb:54:20:54:29 | call to source : | pathname_flow.rb:54:7:54:30 | call to new : |
|
||||
| pathname_flow.rb:55:8:55:8 | a : | pathname_flow.rb:55:8:55:16 | call to to_path |
|
||||
| pathname_flow.rb:59:7:59:30 | call to new : | pathname_flow.rb:60:8:60:8 | a : |
|
||||
| pathname_flow.rb:59:20:59:29 | call to source : | pathname_flow.rb:59:7:59:30 | call to new : |
|
||||
| pathname_flow.rb:60:8:60:8 | a : | pathname_flow.rb:60:8:60:13 | call to to_s |
|
||||
| pathname_flow.rb:64:7:64:30 | call to new : | pathname_flow.rb:66:8:66:8 | b |
|
||||
| pathname_flow.rb:64:20:64:29 | call to source : | pathname_flow.rb:64:7:64:30 | call to new : |
|
||||
| pathname_flow.rb:70:7:70:30 | call to new : | pathname_flow.rb:72:8:72:8 | b |
|
||||
| pathname_flow.rb:70:20:70:29 | call to source : | pathname_flow.rb:70:7:70:30 | call to new : |
|
||||
| pathname_flow.rb:76:7:76:30 | call to new : | pathname_flow.rb:77:7:77:7 | a : |
|
||||
| pathname_flow.rb:76:20:76:29 | call to source : | pathname_flow.rb:76:7:76:30 | call to new : |
|
||||
| pathname_flow.rb:77:7:77:7 | a : | pathname_flow.rb:77:7:77:16 | call to basename : |
|
||||
| pathname_flow.rb:77:7:77:16 | call to basename : | pathname_flow.rb:78:8:78:8 | b |
|
||||
| pathname_flow.rb:82:7:82:30 | call to new : | pathname_flow.rb:83:7:83:7 | a : |
|
||||
| pathname_flow.rb:82:20:82:29 | call to source : | pathname_flow.rb:82:7:82:30 | call to new : |
|
||||
| pathname_flow.rb:83:7:83:7 | a : | pathname_flow.rb:83:7:83:17 | call to cleanpath : |
|
||||
| pathname_flow.rb:83:7:83:17 | call to cleanpath : | pathname_flow.rb:84:8:84:8 | b |
|
||||
| pathname_flow.rb:88:7:88:30 | call to new : | pathname_flow.rb:89:7:89:7 | a : |
|
||||
| pathname_flow.rb:88:20:88:29 | call to source : | pathname_flow.rb:88:7:88:30 | call to new : |
|
||||
| pathname_flow.rb:89:7:89:7 | a : | pathname_flow.rb:89:7:89:25 | call to sub : |
|
||||
| pathname_flow.rb:89:7:89:25 | call to sub : | pathname_flow.rb:90:8:90:8 | b |
|
||||
| pathname_flow.rb:94:7:94:30 | call to new : | pathname_flow.rb:95:7:95:7 | a : |
|
||||
| pathname_flow.rb:94:20:94:29 | call to source : | pathname_flow.rb:94:7:94:30 | call to new : |
|
||||
| pathname_flow.rb:95:7:95:7 | a : | pathname_flow.rb:95:7:95:23 | call to sub_ext : |
|
||||
| pathname_flow.rb:95:7:95:23 | call to sub_ext : | pathname_flow.rb:96:8:96:8 | b |
|
||||
| pathname_flow.rb:101:7:101:30 | call to new : | pathname_flow.rb:104:8:104:8 | b : |
|
||||
| pathname_flow.rb:101:7:101:30 | call to new : | pathname_flow.rb:107:8:107:8 | c : |
|
||||
| pathname_flow.rb:101:7:101:30 | call to new : | pathname_flow.rb:109:7:109:7 | a : |
|
||||
| pathname_flow.rb:101:7:101:30 | call to new : | pathname_flow.rb:112:7:112:7 | a : |
|
||||
| pathname_flow.rb:101:7:101:30 | call to new : | pathname_flow.rb:115:7:115:7 | a : |
|
||||
| pathname_flow.rb:101:7:101:30 | call to new : | pathname_flow.rb:118:7:118:7 | a : |
|
||||
| pathname_flow.rb:101:7:101:30 | call to new : | pathname_flow.rb:121:7:121:7 | a : |
|
||||
| pathname_flow.rb:101:7:101:30 | call to new : | pathname_flow.rb:124:7:124:7 | a : |
|
||||
| pathname_flow.rb:101:7:101:30 | call to new : | pathname_flow.rb:127:7:127:7 | a : |
|
||||
| pathname_flow.rb:101:7:101:30 | call to new : | pathname_flow.rb:130:7:130:7 | a : |
|
||||
| pathname_flow.rb:101:7:101:30 | call to new : | pathname_flow.rb:133:7:133:7 | a : |
|
||||
| pathname_flow.rb:101:20:101:29 | call to source : | pathname_flow.rb:101:7:101:30 | call to new : |
|
||||
| pathname_flow.rb:104:8:104:8 | b : | pathname_flow.rb:104:8:104:17 | call to realpath |
|
||||
| pathname_flow.rb:107:8:107:8 | c : | pathname_flow.rb:107:8:107:17 | call to realpath |
|
||||
| pathname_flow.rb:109:7:109:7 | a : | pathname_flow.rb:109:7:109:16 | call to basename : |
|
||||
| pathname_flow.rb:109:7:109:16 | call to basename : | pathname_flow.rb:110:8:110:8 | d : |
|
||||
| pathname_flow.rb:110:8:110:8 | d : | pathname_flow.rb:110:8:110:17 | call to realpath |
|
||||
| pathname_flow.rb:112:7:112:7 | a : | pathname_flow.rb:112:7:112:17 | call to cleanpath : |
|
||||
| pathname_flow.rb:112:7:112:17 | call to cleanpath : | pathname_flow.rb:113:8:113:8 | e : |
|
||||
| pathname_flow.rb:113:8:113:8 | e : | pathname_flow.rb:113:8:113:17 | call to realpath |
|
||||
| pathname_flow.rb:115:7:115:7 | a : | pathname_flow.rb:115:7:115:19 | call to expand_path : |
|
||||
| pathname_flow.rb:115:7:115:19 | call to expand_path : | pathname_flow.rb:116:8:116:8 | f : |
|
||||
| pathname_flow.rb:116:8:116:8 | f : | pathname_flow.rb:116:8:116:17 | call to realpath |
|
||||
| pathname_flow.rb:118:7:118:7 | a : | pathname_flow.rb:118:7:118:19 | call to join : |
|
||||
| pathname_flow.rb:118:7:118:19 | call to join : | pathname_flow.rb:119:8:119:8 | g : |
|
||||
| pathname_flow.rb:119:8:119:8 | g : | pathname_flow.rb:119:8:119:17 | call to realpath |
|
||||
| pathname_flow.rb:121:7:121:7 | a : | pathname_flow.rb:121:7:121:16 | call to realpath : |
|
||||
| pathname_flow.rb:121:7:121:16 | call to realpath : | pathname_flow.rb:122:8:122:8 | h : |
|
||||
| pathname_flow.rb:122:8:122:8 | h : | pathname_flow.rb:122:8:122:17 | call to realpath |
|
||||
| pathname_flow.rb:124:7:124:7 | a : | pathname_flow.rb:124:7:124:38 | call to relative_path_from : |
|
||||
| pathname_flow.rb:124:7:124:38 | call to relative_path_from : | pathname_flow.rb:125:8:125:8 | i : |
|
||||
| pathname_flow.rb:125:8:125:8 | i : | pathname_flow.rb:125:8:125:17 | call to realpath |
|
||||
| pathname_flow.rb:127:7:127:7 | a : | pathname_flow.rb:127:7:127:25 | call to sub : |
|
||||
| pathname_flow.rb:127:7:127:25 | call to sub : | pathname_flow.rb:128:8:128:8 | j : |
|
||||
| pathname_flow.rb:128:8:128:8 | j : | pathname_flow.rb:128:8:128:17 | call to realpath |
|
||||
| pathname_flow.rb:130:7:130:7 | a : | pathname_flow.rb:130:7:130:23 | call to sub_ext : |
|
||||
| pathname_flow.rb:130:7:130:23 | call to sub_ext : | pathname_flow.rb:131:8:131:8 | k : |
|
||||
| pathname_flow.rb:131:8:131:8 | k : | pathname_flow.rb:131:8:131:17 | call to realpath |
|
||||
| pathname_flow.rb:133:7:133:7 | a : | pathname_flow.rb:133:7:133:15 | call to to_path : |
|
||||
| pathname_flow.rb:133:7:133:15 | call to to_path : | pathname_flow.rb:134:8:134:8 | l : |
|
||||
| pathname_flow.rb:134:8:134:8 | l : | pathname_flow.rb:134:8:134:17 | call to realpath |
|
||||
nodes
|
||||
| pathname_flow.rb:4:10:4:33 | call to new : | semmle.label | call to new : |
|
||||
| pathname_flow.rb:4:23:4:32 | call to source : | semmle.label | call to source : |
|
||||
| pathname_flow.rb:5:10:5:11 | pn | semmle.label | pn |
|
||||
| pathname_flow.rb:9:6:9:29 | call to new : | semmle.label | call to new : |
|
||||
| pathname_flow.rb:9:19:9:28 | call to source : | semmle.label | call to source : |
|
||||
| pathname_flow.rb:10:6:10:29 | call to new : | semmle.label | call to new : |
|
||||
| pathname_flow.rb:10:19:10:28 | call to source : | semmle.label | call to source : |
|
||||
| pathname_flow.rb:11:7:11:11 | ... + ... | semmle.label | ... + ... |
|
||||
| pathname_flow.rb:15:7:15:30 | call to new : | semmle.label | call to new : |
|
||||
| pathname_flow.rb:15:20:15:29 | call to source : | semmle.label | call to source : |
|
||||
| pathname_flow.rb:16:7:16:8 | pn : | semmle.label | pn : |
|
||||
| pathname_flow.rb:16:7:16:16 | call to dirname | semmle.label | call to dirname |
|
||||
| pathname_flow.rb:20:6:20:29 | call to new : | semmle.label | call to new : |
|
||||
| pathname_flow.rb:20:19:20:28 | call to source : | semmle.label | call to source : |
|
||||
| pathname_flow.rb:21:2:21:2 | a : | semmle.label | a : |
|
||||
| pathname_flow.rb:21:22:21:22 | x : | semmle.label | x : |
|
||||
| pathname_flow.rb:22:8:22:8 | x | semmle.label | x |
|
||||
| pathname_flow.rb:27:6:27:29 | call to new : | semmle.label | call to new : |
|
||||
| pathname_flow.rb:27:19:27:28 | call to source : | semmle.label | call to source : |
|
||||
| pathname_flow.rb:28:7:28:7 | a : | semmle.label | a : |
|
||||
| pathname_flow.rb:28:7:28:21 | call to expand_path | semmle.label | call to expand_path |
|
||||
| pathname_flow.rb:32:6:32:29 | call to new : | semmle.label | call to new : |
|
||||
| pathname_flow.rb:32:19:32:28 | call to source : | semmle.label | call to source : |
|
||||
| pathname_flow.rb:34:6:34:29 | call to new : | semmle.label | call to new : |
|
||||
| pathname_flow.rb:34:19:34:28 | call to source : | semmle.label | call to source : |
|
||||
| pathname_flow.rb:35:7:35:7 | a : | semmle.label | a : |
|
||||
| pathname_flow.rb:35:7:35:18 | call to join | semmle.label | call to join |
|
||||
| pathname_flow.rb:35:17:35:17 | c : | semmle.label | c : |
|
||||
| pathname_flow.rb:39:6:39:29 | call to new : | semmle.label | call to new : |
|
||||
| pathname_flow.rb:39:19:39:28 | call to source : | semmle.label | call to source : |
|
||||
| pathname_flow.rb:40:7:40:7 | a : | semmle.label | a : |
|
||||
| pathname_flow.rb:40:7:40:16 | call to parent | semmle.label | call to parent |
|
||||
| pathname_flow.rb:44:6:44:29 | call to new : | semmle.label | call to new : |
|
||||
| pathname_flow.rb:44:19:44:28 | call to source : | semmle.label | call to source : |
|
||||
| pathname_flow.rb:45:7:45:7 | a : | semmle.label | a : |
|
||||
| pathname_flow.rb:45:7:45:18 | call to realpath | semmle.label | call to realpath |
|
||||
| pathname_flow.rb:49:6:49:29 | call to new : | semmle.label | call to new : |
|
||||
| pathname_flow.rb:49:19:49:28 | call to source : | semmle.label | call to source : |
|
||||
| pathname_flow.rb:50:7:50:7 | a : | semmle.label | a : |
|
||||
| pathname_flow.rb:50:7:50:38 | call to relative_path_from | semmle.label | call to relative_path_from |
|
||||
| pathname_flow.rb:54:6:54:29 | call to new : | semmle.label | call to new : |
|
||||
| pathname_flow.rb:54:19:54:28 | call to source : | semmle.label | call to source : |
|
||||
| pathname_flow.rb:55:7:55:7 | a : | semmle.label | a : |
|
||||
| pathname_flow.rb:55:7:55:15 | call to to_path | semmle.label | call to to_path |
|
||||
| pathname_flow.rb:59:6:59:29 | call to new : | semmle.label | call to new : |
|
||||
| pathname_flow.rb:59:19:59:28 | call to source : | semmle.label | call to source : |
|
||||
| pathname_flow.rb:60:7:60:7 | a : | semmle.label | a : |
|
||||
| pathname_flow.rb:60:7:60:12 | call to to_s | semmle.label | call to to_s |
|
||||
| pathname_flow.rb:9:7:9:30 | call to new : | semmle.label | call to new : |
|
||||
| pathname_flow.rb:9:20:9:29 | call to source : | semmle.label | call to source : |
|
||||
| pathname_flow.rb:10:7:10:30 | call to new : | semmle.label | call to new : |
|
||||
| pathname_flow.rb:10:20:10:29 | call to source : | semmle.label | call to source : |
|
||||
| pathname_flow.rb:11:8:11:12 | ... + ... | semmle.label | ... + ... |
|
||||
| pathname_flow.rb:15:8:15:31 | call to new : | semmle.label | call to new : |
|
||||
| pathname_flow.rb:15:21:15:30 | call to source : | semmle.label | call to source : |
|
||||
| pathname_flow.rb:16:8:16:9 | pn : | semmle.label | pn : |
|
||||
| pathname_flow.rb:16:8:16:17 | call to dirname | semmle.label | call to dirname |
|
||||
| pathname_flow.rb:20:7:20:30 | call to new : | semmle.label | call to new : |
|
||||
| pathname_flow.rb:20:20:20:29 | call to source : | semmle.label | call to source : |
|
||||
| pathname_flow.rb:21:3:21:3 | a : | semmle.label | a : |
|
||||
| pathname_flow.rb:21:23:21:23 | x : | semmle.label | x : |
|
||||
| pathname_flow.rb:22:10:22:10 | x | semmle.label | x |
|
||||
| pathname_flow.rb:27:7:27:30 | call to new : | semmle.label | call to new : |
|
||||
| pathname_flow.rb:27:20:27:29 | call to source : | semmle.label | call to source : |
|
||||
| pathname_flow.rb:28:8:28:8 | a : | semmle.label | a : |
|
||||
| pathname_flow.rb:28:8:28:22 | call to expand_path | semmle.label | call to expand_path |
|
||||
| pathname_flow.rb:32:7:32:30 | call to new : | semmle.label | call to new : |
|
||||
| pathname_flow.rb:32:20:32:29 | call to source : | semmle.label | call to source : |
|
||||
| pathname_flow.rb:34:7:34:30 | call to new : | semmle.label | call to new : |
|
||||
| pathname_flow.rb:34:20:34:29 | call to source : | semmle.label | call to source : |
|
||||
| pathname_flow.rb:35:8:35:8 | a : | semmle.label | a : |
|
||||
| pathname_flow.rb:35:8:35:19 | call to join | semmle.label | call to join |
|
||||
| pathname_flow.rb:35:18:35:18 | c : | semmle.label | c : |
|
||||
| pathname_flow.rb:39:7:39:30 | call to new : | semmle.label | call to new : |
|
||||
| pathname_flow.rb:39:20:39:29 | call to source : | semmle.label | call to source : |
|
||||
| pathname_flow.rb:40:8:40:8 | a : | semmle.label | a : |
|
||||
| pathname_flow.rb:40:8:40:17 | call to parent | semmle.label | call to parent |
|
||||
| pathname_flow.rb:44:7:44:30 | call to new : | semmle.label | call to new : |
|
||||
| pathname_flow.rb:44:20:44:29 | call to source : | semmle.label | call to source : |
|
||||
| pathname_flow.rb:45:8:45:8 | a : | semmle.label | a : |
|
||||
| pathname_flow.rb:45:8:45:19 | call to realpath | semmle.label | call to realpath |
|
||||
| pathname_flow.rb:49:7:49:30 | call to new : | semmle.label | call to new : |
|
||||
| pathname_flow.rb:49:20:49:29 | call to source : | semmle.label | call to source : |
|
||||
| pathname_flow.rb:50:8:50:8 | a : | semmle.label | a : |
|
||||
| pathname_flow.rb:50:8:50:39 | call to relative_path_from | semmle.label | call to relative_path_from |
|
||||
| pathname_flow.rb:54:7:54:30 | call to new : | semmle.label | call to new : |
|
||||
| pathname_flow.rb:54:20:54:29 | call to source : | semmle.label | call to source : |
|
||||
| pathname_flow.rb:55:8:55:8 | a : | semmle.label | a : |
|
||||
| pathname_flow.rb:55:8:55:16 | call to to_path | semmle.label | call to to_path |
|
||||
| pathname_flow.rb:59:7:59:30 | call to new : | semmle.label | call to new : |
|
||||
| pathname_flow.rb:59:20:59:29 | call to source : | semmle.label | call to source : |
|
||||
| pathname_flow.rb:60:8:60:8 | a : | semmle.label | a : |
|
||||
| pathname_flow.rb:60:8:60:13 | call to to_s | semmle.label | call to to_s |
|
||||
| pathname_flow.rb:64:7:64:30 | call to new : | semmle.label | call to new : |
|
||||
| pathname_flow.rb:64:20:64:29 | call to source : | semmle.label | call to source : |
|
||||
| pathname_flow.rb:66:8:66:8 | b | semmle.label | b |
|
||||
| pathname_flow.rb:70:7:70:30 | call to new : | semmle.label | call to new : |
|
||||
| pathname_flow.rb:70:20:70:29 | call to source : | semmle.label | call to source : |
|
||||
| pathname_flow.rb:72:8:72:8 | b | semmle.label | b |
|
||||
| pathname_flow.rb:76:7:76:30 | call to new : | semmle.label | call to new : |
|
||||
| pathname_flow.rb:76:20:76:29 | call to source : | semmle.label | call to source : |
|
||||
| pathname_flow.rb:77:7:77:7 | a : | semmle.label | a : |
|
||||
| pathname_flow.rb:77:7:77:16 | call to basename : | semmle.label | call to basename : |
|
||||
| pathname_flow.rb:78:8:78:8 | b | semmle.label | b |
|
||||
| pathname_flow.rb:82:7:82:30 | call to new : | semmle.label | call to new : |
|
||||
| pathname_flow.rb:82:20:82:29 | call to source : | semmle.label | call to source : |
|
||||
| pathname_flow.rb:83:7:83:7 | a : | semmle.label | a : |
|
||||
| pathname_flow.rb:83:7:83:17 | call to cleanpath : | semmle.label | call to cleanpath : |
|
||||
| pathname_flow.rb:84:8:84:8 | b | semmle.label | b |
|
||||
| pathname_flow.rb:88:7:88:30 | call to new : | semmle.label | call to new : |
|
||||
| pathname_flow.rb:88:20:88:29 | call to source : | semmle.label | call to source : |
|
||||
| pathname_flow.rb:89:7:89:7 | a : | semmle.label | a : |
|
||||
| pathname_flow.rb:89:7:89:25 | call to sub : | semmle.label | call to sub : |
|
||||
| pathname_flow.rb:90:8:90:8 | b | semmle.label | b |
|
||||
| pathname_flow.rb:94:7:94:30 | call to new : | semmle.label | call to new : |
|
||||
| pathname_flow.rb:94:20:94:29 | call to source : | semmle.label | call to source : |
|
||||
| pathname_flow.rb:95:7:95:7 | a : | semmle.label | a : |
|
||||
| pathname_flow.rb:95:7:95:23 | call to sub_ext : | semmle.label | call to sub_ext : |
|
||||
| pathname_flow.rb:96:8:96:8 | b | semmle.label | b |
|
||||
| pathname_flow.rb:101:7:101:30 | call to new : | semmle.label | call to new : |
|
||||
| pathname_flow.rb:101:20:101:29 | call to source : | semmle.label | call to source : |
|
||||
| pathname_flow.rb:104:8:104:8 | b : | semmle.label | b : |
|
||||
| pathname_flow.rb:104:8:104:17 | call to realpath | semmle.label | call to realpath |
|
||||
| pathname_flow.rb:107:8:107:8 | c : | semmle.label | c : |
|
||||
| pathname_flow.rb:107:8:107:17 | call to realpath | semmle.label | call to realpath |
|
||||
| pathname_flow.rb:109:7:109:7 | a : | semmle.label | a : |
|
||||
| pathname_flow.rb:109:7:109:16 | call to basename : | semmle.label | call to basename : |
|
||||
| pathname_flow.rb:110:8:110:8 | d : | semmle.label | d : |
|
||||
| pathname_flow.rb:110:8:110:17 | call to realpath | semmle.label | call to realpath |
|
||||
| pathname_flow.rb:112:7:112:7 | a : | semmle.label | a : |
|
||||
| pathname_flow.rb:112:7:112:17 | call to cleanpath : | semmle.label | call to cleanpath : |
|
||||
| pathname_flow.rb:113:8:113:8 | e : | semmle.label | e : |
|
||||
| pathname_flow.rb:113:8:113:17 | call to realpath | semmle.label | call to realpath |
|
||||
| pathname_flow.rb:115:7:115:7 | a : | semmle.label | a : |
|
||||
| pathname_flow.rb:115:7:115:19 | call to expand_path : | semmle.label | call to expand_path : |
|
||||
| pathname_flow.rb:116:8:116:8 | f : | semmle.label | f : |
|
||||
| pathname_flow.rb:116:8:116:17 | call to realpath | semmle.label | call to realpath |
|
||||
| pathname_flow.rb:118:7:118:7 | a : | semmle.label | a : |
|
||||
| pathname_flow.rb:118:7:118:19 | call to join : | semmle.label | call to join : |
|
||||
| pathname_flow.rb:119:8:119:8 | g : | semmle.label | g : |
|
||||
| pathname_flow.rb:119:8:119:17 | call to realpath | semmle.label | call to realpath |
|
||||
| pathname_flow.rb:121:7:121:7 | a : | semmle.label | a : |
|
||||
| pathname_flow.rb:121:7:121:16 | call to realpath : | semmle.label | call to realpath : |
|
||||
| pathname_flow.rb:122:8:122:8 | h : | semmle.label | h : |
|
||||
| pathname_flow.rb:122:8:122:17 | call to realpath | semmle.label | call to realpath |
|
||||
| pathname_flow.rb:124:7:124:7 | a : | semmle.label | a : |
|
||||
| pathname_flow.rb:124:7:124:38 | call to relative_path_from : | semmle.label | call to relative_path_from : |
|
||||
| pathname_flow.rb:125:8:125:8 | i : | semmle.label | i : |
|
||||
| pathname_flow.rb:125:8:125:17 | call to realpath | semmle.label | call to realpath |
|
||||
| pathname_flow.rb:127:7:127:7 | a : | semmle.label | a : |
|
||||
| pathname_flow.rb:127:7:127:25 | call to sub : | semmle.label | call to sub : |
|
||||
| pathname_flow.rb:128:8:128:8 | j : | semmle.label | j : |
|
||||
| pathname_flow.rb:128:8:128:17 | call to realpath | semmle.label | call to realpath |
|
||||
| pathname_flow.rb:130:7:130:7 | a : | semmle.label | a : |
|
||||
| pathname_flow.rb:130:7:130:23 | call to sub_ext : | semmle.label | call to sub_ext : |
|
||||
| pathname_flow.rb:131:8:131:8 | k : | semmle.label | k : |
|
||||
| pathname_flow.rb:131:8:131:17 | call to realpath | semmle.label | call to realpath |
|
||||
| pathname_flow.rb:133:7:133:7 | a : | semmle.label | a : |
|
||||
| pathname_flow.rb:133:7:133:15 | call to to_path : | semmle.label | call to to_path : |
|
||||
| pathname_flow.rb:134:8:134:8 | l : | semmle.label | l : |
|
||||
| pathname_flow.rb:134:8:134:17 | call to realpath | semmle.label | call to realpath |
|
||||
subpaths
|
||||
#select
|
||||
|
||||
@@ -6,56 +6,130 @@ def m_new
|
||||
end
|
||||
|
||||
def m_plus
|
||||
a = Pathname.new(source 'a')
|
||||
b = Pathname.new(source 'b')
|
||||
sink(a + b) # $ hasTaintFlow=a $ hasTaintFlow=b
|
||||
a = Pathname.new(source 'a')
|
||||
b = Pathname.new(source 'b')
|
||||
sink(a + b) # $ hasTaintFlow=a $ hasTaintFlow=b
|
||||
end
|
||||
|
||||
def m_dirname
|
||||
pn = Pathname.new(source 'a')
|
||||
sink pn.dirname # $ hasTaintFlow=a
|
||||
pn = Pathname.new(source 'a')
|
||||
sink pn.dirname # $ hasTaintFlow=a
|
||||
end
|
||||
|
||||
def m_each_filename
|
||||
a = Pathname.new(source 'a')
|
||||
a.each_filename do |x|
|
||||
sink x # $ hasTaintFlow=a
|
||||
end
|
||||
a = Pathname.new(source 'a')
|
||||
a.each_filename do |x|
|
||||
sink x # $ hasTaintFlow=a
|
||||
end
|
||||
end
|
||||
|
||||
def m_expand_path
|
||||
a = Pathname.new(source 'a')
|
||||
sink a.expand_path() # $ hasTaintFlow=a
|
||||
a = Pathname.new(source 'a')
|
||||
sink a.expand_path() # $ hasTaintFlow=a
|
||||
end
|
||||
|
||||
def m_join
|
||||
a = Pathname.new(source 'a')
|
||||
b = Pathname.new('foo')
|
||||
c = Pathname.new(source 'c')
|
||||
sink a.join(b, c) # $ hasTaintFlow=a $ hasTaintFlow=c
|
||||
a = Pathname.new(source 'a')
|
||||
b = Pathname.new('foo')
|
||||
c = Pathname.new(source 'c')
|
||||
sink a.join(b, c) # $ hasTaintFlow=a $ hasTaintFlow=c
|
||||
end
|
||||
|
||||
def m_parent
|
||||
a = Pathname.new(source 'a')
|
||||
sink a.parent() # $ hasTaintFlow=a
|
||||
a = Pathname.new(source 'a')
|
||||
sink a.parent() # $ hasTaintFlow=a
|
||||
end
|
||||
|
||||
def m_realpath
|
||||
a = Pathname.new(source 'a')
|
||||
sink a.realpath() # $ hasTaintFlow=a
|
||||
a = Pathname.new(source 'a')
|
||||
sink a.realpath() # $ hasTaintFlow=a
|
||||
end
|
||||
|
||||
def m_relative_path_from
|
||||
a = Pathname.new(source 'a')
|
||||
sink a.relative_path_from('/foo/bar') # $ hasTaintFlow=a
|
||||
a = Pathname.new(source 'a')
|
||||
sink a.relative_path_from('/foo/bar') # $ hasTaintFlow=a
|
||||
end
|
||||
|
||||
def m_to_path
|
||||
a = Pathname.new(source 'a')
|
||||
sink a.to_path # $ hasTaintFlow=a
|
||||
a = Pathname.new(source 'a')
|
||||
sink a.to_path # $ hasTaintFlow=a
|
||||
end
|
||||
|
||||
def m_to_s
|
||||
a = Pathname.new(source 'a')
|
||||
sink a.to_s # $ hasTaintFlow=a
|
||||
a = Pathname.new(source 'a')
|
||||
sink a.to_s # $ hasTaintFlow=a
|
||||
end
|
||||
|
||||
def m_plus
|
||||
a = Pathname.new(source 'a')
|
||||
b = a + 'foo'
|
||||
sink b # $ hasTaintFlow=a
|
||||
end
|
||||
|
||||
def m_slash
|
||||
a = Pathname.new(source 'a')
|
||||
b = a / 'foo'
|
||||
sink b # $ hasTaintFlow=a
|
||||
end
|
||||
|
||||
def m_basename
|
||||
a = Pathname.new(source 'a')
|
||||
b = a.basename
|
||||
sink b # $ hasTaintFlow=a
|
||||
end
|
||||
|
||||
def m_cleanpath
|
||||
a = Pathname.new(source 'a')
|
||||
b = a.cleanpath
|
||||
sink b # $ hasTaintFlow=a
|
||||
end
|
||||
|
||||
def m_sub
|
||||
a = Pathname.new(source 'a')
|
||||
b = a.sub('foo', 'bar')
|
||||
sink b # $ hasTaintFlow=a
|
||||
end
|
||||
|
||||
def m_sub_ext
|
||||
a = Pathname.new(source 'a')
|
||||
b = a.sub_ext('.txt')
|
||||
sink b # $ hasTaintFlow=a
|
||||
end
|
||||
|
||||
# Test flow through intermediate pathnames
|
||||
def intermediate_pathnames
|
||||
a = Pathname.new(source 'a')
|
||||
|
||||
b = a + 'foo'
|
||||
sink b.realpath # $ hasTaintFlow=a
|
||||
|
||||
c = a / 'foo'
|
||||
sink c.realpath # $ hasTaintFlow=a
|
||||
|
||||
d = a.basename
|
||||
sink d.realpath # $ hasTaintFlow=a
|
||||
|
||||
e = a.cleanpath
|
||||
sink e.realpath # $ hasTaintFlow=a
|
||||
|
||||
f = a.expand_path
|
||||
sink f.realpath # $ hasTaintFlow=a
|
||||
|
||||
g = a.join('foo')
|
||||
sink g.realpath # $ hasTaintFlow=a
|
||||
|
||||
h = a.realpath
|
||||
sink h.realpath # $ hasTaintFlow=a
|
||||
|
||||
i = a.relative_path_from('/foo/bar')
|
||||
sink i.realpath # $ hasTaintFlow=a
|
||||
|
||||
j = a.sub('foo', 'bar')
|
||||
sink j.realpath # $ hasTaintFlow=a
|
||||
|
||||
k = a.sub_ext('.txt')
|
||||
sink k.realpath # $ hasTaintFlow=a
|
||||
|
||||
l = a.to_path
|
||||
sink l.realpath # $ hasTaintFlow=a
|
||||
end
|
||||
Reference in New Issue
Block a user