Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a8ad0d8

Browse files
committed
Ruby: renames for rb/insecure-download
1 parent c973fc1 commit a8ad0d8

3 files changed

Lines changed: 21 additions & 17 deletions

File tree

ruby/ql/lib/codeql/ruby/security/InsecureDownloadQuery.qll

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* Provides a dataflow configuration for reasoning about the download of sensitive file through insecure connection.
33
*
44
* Note, for performance reasons: only import this file if
5-
* `InsecureDownload::Configuration` is needed, otherwise
5+
* `InsecureDownloadFlow` is needed, otherwise
66
* `InsecureDownloadCustomizations` should be imported instead.
77
*/
88

@@ -12,6 +12,8 @@ import InsecureDownloadCustomizations::InsecureDownload
1212

1313
/**
1414
* A taint tracking configuration for download of sensitive file through insecure connection.
15+
*
16+
* DEPRECATED: Use `InsecureDownloadFlow`.
1517
*/
1618
deprecated class Configuration extends DataFlow::Configuration {
1719
Configuration() { this = "InsecureDownload" }
@@ -30,10 +32,7 @@ deprecated class Configuration extends DataFlow::Configuration {
3032
}
3133
}
3234

33-
/**
34-
* A taint tracking configuration for download of sensitive file through insecure connection.
35-
*/
36-
module Config implements DataFlow::StateConfigSig {
35+
private module InsecureDownloadConfig implements DataFlow::StateConfigSig {
3736
class FlowState = string;
3837

3938
predicate isSource(DataFlow::Node source, DataFlow::FlowState label) {
@@ -47,4 +46,13 @@ module Config implements DataFlow::StateConfigSig {
4746
predicate isBarrier(DataFlow::Node node) { node instanceof Sanitizer }
4847
}
4948

50-
module Flow = DataFlow::GlobalWithState<Config>;
49+
/**
50+
* Taint-tracking for download of sensitive file through insecure connection.
51+
*/
52+
module InsecureDownloadFlow = DataFlow::GlobalWithState<InsecureDownloadConfig>;
53+
54+
/** DEPRECATED: Use `InsecureDownloadConfig` */
55+
deprecated module Config = InsecureDownloadConfig;
56+
57+
/** DEPRECATED: Use `InsecureDownloadFlow` */
58+
deprecated module Flow = InsecureDownloadFlow;

ruby/ql/src/queries/security/cwe-829/InsecureDownload.ql

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,10 @@
1111
* external/cwe/cwe-829
1212
*/
1313

14-
import codeql.ruby.AST
15-
import codeql.ruby.DataFlow
1614
import codeql.ruby.security.InsecureDownloadQuery
17-
import Flow::PathGraph
15+
import InsecureDownloadFlow::PathGraph
1816

19-
from Flow::PathNode source, Flow::PathNode sink
20-
where Flow::flowPath(source, sink)
17+
from InsecureDownloadFlow::PathNode source, InsecureDownloadFlow::PathNode sink
18+
where InsecureDownloadFlow::flowPath(source, sink)
2119
select sink.getNode(), source, sink, "$@ of sensitive file from $@.",
2220
sink.getNode().(Sink).getDownloadCall(), "Download", source.getNode(), "HTTP source"
Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
import codeql.ruby.AST
2-
import codeql.ruby.DataFlow
31
import codeql.ruby.security.InsecureDownloadQuery
4-
import Flow::PathGraph
2+
import InsecureDownloadFlow::PathGraph
53
import TestUtilities.InlineExpectationsTest
64
import TestUtilities.InlineFlowTestUtil
75

@@ -10,7 +8,7 @@ module FlowTest implements TestSig {
108

119
predicate hasActualResult(Location location, string element, string tag, string value) {
1210
tag = "BAD" and
13-
exists(DataFlow::Node src, DataFlow::Node sink | Flow::flow(src, sink) |
11+
exists(DataFlow::Node src, DataFlow::Node sink | InsecureDownloadFlow::flow(src, sink) |
1412
sink.getLocation() = location and
1513
element = sink.toString() and
1614
if exists(getSourceArgString(src)) then value = getSourceArgString(src) else value = ""
@@ -20,6 +18,6 @@ module FlowTest implements TestSig {
2018

2119
import MakeTest<FlowTest>
2220

23-
from Flow::PathNode source, Flow::PathNode sink
24-
where Flow::flowPath(source, sink)
21+
from InsecureDownloadFlow::PathNode source, InsecureDownloadFlow::PathNode sink
22+
where InsecureDownloadFlow::flowPath(source, sink)
2523
select sink, source, sink, "$@", source, source.toString()

0 commit comments

Comments
 (0)