Skip to content

Commit 946e116

Browse files
hugo-synclaude
andcommitted
C#: inline TestAdditionalTaintStep.qll into AdditionalTaintStep.ql
Addresses review comment: the test-only AdditionalTaintStep subclass only has a single consumer, so fold it directly into the query file instead of keeping it in a separate .qll. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
1 parent ce7fee4 commit 946e116

2 files changed

Lines changed: 18 additions & 20 deletions

File tree

csharp/ql/test/library-tests/dataflow/additional-taint-step/AdditionalTaintStep.ql

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,23 @@
11
import csharp
2+
import semmle.code.csharp.dataflow.FlowSteps
23
import semmle.code.csharp.dataflow.internal.TaintTrackingPrivate
3-
import TestAdditionalTaintStep
4+
5+
/**
6+
* A test-only additional taint step that treats calls to `Marker.Step` as
7+
* propagating taint from the argument to the call result, to verify that
8+
* `AdditionalTaintStep` subclasses are picked up by `defaultAdditionalTaintStep`.
9+
*/
10+
private class MarkerStepTaintStep extends AdditionalTaintStep {
11+
override predicate step(DataFlow::Node node1, DataFlow::Node node2) {
12+
exists(MethodCall mc |
13+
mc.getTarget().hasName("Step") and
14+
mc.getTarget().getDeclaringType().hasName("Marker")
15+
|
16+
node1.asExpr() = mc.getArgument(0) and
17+
node2.asExpr() = mc
18+
)
19+
}
20+
}
421

522
from DataFlow::Node src, DataFlow::Node sink, string model
623
where defaultAdditionalTaintStep(src, sink, model) and model = "AdditionalTaintStep"

csharp/ql/test/library-tests/dataflow/additional-taint-step/TestAdditionalTaintStep.qll

Lines changed: 0 additions & 19 deletions
This file was deleted.

0 commit comments

Comments
 (0)