Ruby: Add InsecureDownload query

This query finds cases where a potentially unsafe file is downloaded
over an unsecured connection.
This commit is contained in:
Harry Maclean
2022-04-05 10:07:56 +12:00
parent ce7675ef43
commit bb3fb0325b
9 changed files with 404 additions and 0 deletions

View File

@@ -0,0 +1,22 @@
import ruby
import codeql.ruby.DataFlow
import PathGraph
import TestUtilities.InlineFlowTest
import codeql.ruby.security.InsecureDownloadQuery
class FlowTest extends InlineFlowTest {
override DataFlow::Configuration getValueFlowConfig() { result = any(Configuration config) }
override DataFlow::Configuration getTaintFlowConfig() { none() }
override string getARelevantTag() { result = "BAD" }
override predicate hasActualResult(Location location, string element, string tag, string value) {
tag = "BAD" and
super.hasActualResult(location, element, "hasValueFlow", value)
}
}
from DataFlow::PathNode source, DataFlow::PathNode sink, Configuration conf
where conf.hasFlowPath(source, sink)
select sink, source, sink, "$@", source, source.toString()