Skip to content

Commit 829eb7f

Browse files
committed
C#/Ruby: Sync FlowSummaryImpl.
1 parent 25fda20 commit 829eb7f

File tree

2 files changed

+38
-8
lines changed

2 files changed

+38
-8
lines changed

csharp/ql/lib/semmle/code/csharp/dataflow/internal/FlowSummaryImpl.qll

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -791,15 +791,30 @@ module Private {
791791
}
792792

793793
/**
794-
* Holds if `arg` flows to `out` using a simple flow summary, that is, a flow
795-
* summary without reads and stores.
794+
* Holds if `arg` flows to `out` using a simple value-preserving flow
795+
* summary, that is, a flow summary without reads and stores.
796796
*
797797
* NOTE: This step should not be used in global data-flow/taint-tracking, but may
798798
* be useful to include in the exposed local data-flow/taint-tracking relations.
799799
*/
800-
predicate summaryThroughStep(ArgNode arg, Node out, boolean preservesValue) {
800+
predicate summaryThroughStepValue(ArgNode arg, Node out) {
801+
exists(ReturnKind rk, ReturnNode ret, DataFlowCall call |
802+
summaryLocalStep(summaryArgParam0(call, arg), ret, true) and
803+
ret.getKind() = rk and
804+
out = getAnOutNode(call, rk)
805+
)
806+
}
807+
808+
/**
809+
* Holds if `arg` flows to `out` using a simple flow summary involving taint
810+
* step, that is, a flow summary without reads and stores.
811+
*
812+
* NOTE: This step should not be used in global data-flow/taint-tracking, but may
813+
* be useful to include in the exposed local data-flow/taint-tracking relations.
814+
*/
815+
predicate summaryThroughStepTaint(ArgNode arg, Node out) {
801816
exists(ReturnNodeExt ret |
802-
summaryLocalStep(summaryArgParam(arg, ret, out), ret, preservesValue)
817+
summaryLocalStep(summaryArgParam(arg, ret, out), ret, false)
803818
)
804819
}
805820

ruby/ql/lib/codeql/ruby/dataflow/internal/FlowSummaryImpl.qll

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -791,15 +791,30 @@ module Private {
791791
}
792792

793793
/**
794-
* Holds if `arg` flows to `out` using a simple flow summary, that is, a flow
795-
* summary without reads and stores.
794+
* Holds if `arg` flows to `out` using a simple value-preserving flow
795+
* summary, that is, a flow summary without reads and stores.
796796
*
797797
* NOTE: This step should not be used in global data-flow/taint-tracking, but may
798798
* be useful to include in the exposed local data-flow/taint-tracking relations.
799799
*/
800-
predicate summaryThroughStep(ArgNode arg, Node out, boolean preservesValue) {
800+
predicate summaryThroughStepValue(ArgNode arg, Node out) {
801+
exists(ReturnKind rk, ReturnNode ret, DataFlowCall call |
802+
summaryLocalStep(summaryArgParam0(call, arg), ret, true) and
803+
ret.getKind() = rk and
804+
out = getAnOutNode(call, rk)
805+
)
806+
}
807+
808+
/**
809+
* Holds if `arg` flows to `out` using a simple flow summary involving taint
810+
* step, that is, a flow summary without reads and stores.
811+
*
812+
* NOTE: This step should not be used in global data-flow/taint-tracking, but may
813+
* be useful to include in the exposed local data-flow/taint-tracking relations.
814+
*/
815+
predicate summaryThroughStepTaint(ArgNode arg, Node out) {
801816
exists(ReturnNodeExt ret |
802-
summaryLocalStep(summaryArgParam(arg, ret, out), ret, preservesValue)
817+
summaryLocalStep(summaryArgParam(arg, ret, out), ret, false)
803818
)
804819
}
805820

0 commit comments

Comments
 (0)