Ruby: Implement new data flow interface

This commit is contained in:
Tom Hvitved 2024-03-08 09:04:29 +01:00
Родитель e82e3180f0
Коммит 4291290277
10 изменённых файлов: 19 добавлений и 13 удалений

Просмотреть файл

@ -5,7 +5,7 @@ private import codeql.ruby.dataflow.internal.DataFlowImplSpecific
private import codeql.ruby.dataflow.internal.TaintTrackingImplSpecific
private import codeql.dataflow.internal.DataFlowImplConsistency
private module Input implements InputSig<RubyDataFlow> {
private module Input implements InputSig<Location, RubyDataFlow> {
private import RubyDataFlow
predicate postWithInFlowExclude(Node n) { n instanceof FlowSummaryNode }
@ -46,4 +46,4 @@ private module Input implements InputSig<RubyDataFlow> {
}
}
import MakeConsistency<RubyDataFlow, RubyTaintTracking, Input>
import MakeConsistency<Location, RubyDataFlow, RubyTaintTracking, Input>

Просмотреть файл

@ -12,6 +12,6 @@ import codeql.Locations
module DataFlow {
private import codeql.ruby.dataflow.internal.DataFlowImplSpecific
private import codeql.dataflow.DataFlow
import DataFlowMake<RubyDataFlow>
import DataFlowMake<Location, RubyDataFlow>
import codeql.ruby.dataflow.internal.DataFlowImpl1
}

Просмотреть файл

@ -7,6 +7,7 @@ module TaintTracking {
private import codeql.ruby.dataflow.internal.DataFlowImplSpecific
private import codeql.ruby.dataflow.internal.TaintTrackingImplSpecific
private import codeql.dataflow.TaintTracking
import TaintFlowMake<RubyDataFlow, RubyTaintTracking>
private import codeql.Locations
import TaintFlowMake<Location, RubyDataFlow, RubyTaintTracking>
import codeql.ruby.dataflow.internal.tainttracking1.TaintTrackingImpl
}

Просмотреть файл

@ -1,3 +1,4 @@
private import codeql.Locations
private import DataFlowImplSpecific
private import codeql.dataflow.internal.DataFlowImpl
import MakeImpl<RubyDataFlow>
import MakeImpl<Location, RubyDataFlow>

Просмотреть файл

@ -1,3 +1,4 @@
private import codeql.Locations
private import DataFlowImplSpecific
private import codeql.dataflow.internal.DataFlowImplCommon
import MakeImplCommon<RubyDataFlow>
import MakeImplCommon<Location, RubyDataFlow>

Просмотреть файл

@ -2,6 +2,7 @@
* Provides Ruby-specific definitions for use in the data flow library.
*/
private import codeql.Locations
private import codeql.dataflow.DataFlow
module Private {
@ -13,7 +14,7 @@ module Public {
import DataFlowPublic
}
module RubyDataFlow implements InputSig {
module RubyDataFlow implements InputSig<Location> {
import Private
import Public

Просмотреть файл

@ -35,7 +35,7 @@ class Node extends TNode {
* For more information, see
* [Locations](https://codeql.github.com/docs/writing-codeql-queries/providing-locations-in-codeql-queries/).
*/
predicate hasLocationInfo(
deprecated predicate hasLocationInfo(
string filepath, int startline, int startcolumn, int endline, int endcolumn
) {
this.getLocation().hasLocationInfo(filepath, startline, startcolumn, endline, endcolumn)

Просмотреть файл

@ -9,7 +9,7 @@ private import codeql.ruby.dataflow.internal.DataFlowImplSpecific as DataFlowImp
private import DataFlowImplSpecific::Private
private import DataFlowImplSpecific::Public
module Input implements InputSig<DataFlowImplSpecific::RubyDataFlow> {
module Input implements InputSig<Location, DataFlowImplSpecific::RubyDataFlow> {
class SummarizedCallableBase = string;
ArgumentPosition callbackSelfParameterPosition() { result.isLambdaSelf() }
@ -146,7 +146,7 @@ module Input implements InputSig<DataFlowImplSpecific::RubyDataFlow> {
}
}
private import Make<DataFlowImplSpecific::RubyDataFlow, Input> as Impl
private import Make<Location, DataFlowImplSpecific::RubyDataFlow, Input> as Impl
private module StepsInput implements Impl::Private::StepsInputSig {
DataFlowCall getACall(Public::SummarizedCallable sc) {

Просмотреть файл

@ -2,9 +2,10 @@
* Provides Ruby-specific definitions for use in the taint tracking library.
*/
private import codeql.Locations
private import codeql.dataflow.TaintTracking
private import DataFlowImplSpecific
module RubyTaintTracking implements InputSig<RubyDataFlow> {
module RubyTaintTracking implements InputSig<Location, RubyDataFlow> {
import TaintTrackingPrivate
}

Просмотреть файл

@ -4,12 +4,13 @@
*/
import ruby
private import codeql.Locations
private import codeql.dataflow.test.InlineFlowTest
private import codeql.ruby.dataflow.internal.DataFlowImplSpecific
private import codeql.ruby.dataflow.internal.TaintTrackingImplSpecific
private import internal.InlineExpectationsTestImpl
private module FlowTestImpl implements InputSig<RubyDataFlow> {
private module FlowTestImpl implements InputSig<Location, RubyDataFlow> {
import TestUtilities.InlineFlowTestUtil
bindingset[src, sink]
@ -19,4 +20,4 @@ private module FlowTestImpl implements InputSig<RubyDataFlow> {
}
}
import InlineFlowTestMake<RubyDataFlow, RubyTaintTracking, Impl, FlowTestImpl>
import InlineFlowTestMake<Location, RubyDataFlow, RubyTaintTracking, Impl, FlowTestImpl>