Skip to content

Commit 8f7c690

Browse files
committed
revert some mistakes
1 parent 1d1c476 commit 8f7c690

File tree

4 files changed

+13
-137
lines changed

4 files changed

+13
-137
lines changed
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
private import java
2-
private import semmle.code.java.dataflow.ExternalFlow
32
private import semmle.code.java.dataflow.internal.DataFlowPrivate
3+
private import semmle.code.java.dataflow.internal.FlowSummaryImpl
44
private import semmle.code.java.dataflow.internal.ModelExclusions
55
private import ModelEditor
66

77
/**
88
* A class of effectively public callables from source code.
99
*/
1010
class PublicEndpointFromSource extends Endpoint, ModelApi {
11-
override predicate isSource() { this instanceof SourceCallable }
11+
override predicate isSource() { SourceSinkInterpretationInput::sourceElement(this, _, _, _, _) }
1212

13-
override predicate isSink() { this instanceof SinkCallable }
13+
override predicate isSink() { SourceSinkInterpretationInput::sinkElement(this, _, _, _, _) }
1414
}

java/ql/src/utils/modelgenerator/internal/CaptureModels.qll

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -41,21 +41,18 @@ private module Printing implements PrintingSig {
4141

4242
module ModelPrinting = PrintingImpl<Printing>;
4343

44-
/**
45-
* Holds if `c` is a relevant content kind, where the underlying type is relevant.
46-
*/
47-
private predicate isRelevantTypeInContent(DataFlow::Content c) {
48-
isRelevantType(getUnderlyingContentType(c))
49-
}
50-
5144
/**
5245
* Holds if data can flow from `node1` to `node2` either via a read or a write of an intermediate field `f`.
5346
*/
5447
private predicate isRelevantTaintStep(DataFlow::Node node1, DataFlow::Node node2) {
5548
exists(DataFlow::Content f |
5649
DataFlowPrivate::readStep(node1, f, node2) and
57-
// Partially restrict the content types used for intermediate steps.
58-
(not exists(getUnderlyingContentType(f)) or isRelevantTypeInContent(f))
50+
if f instanceof DataFlow::FieldContent
51+
then isRelevantType(f.(DataFlow::FieldContent).getField().getType())
52+
else
53+
if f instanceof DataFlow::SyntheticFieldContent
54+
then isRelevantType(f.(DataFlow::SyntheticFieldContent).getField().getType())
55+
else any()
5956
)
6057
or
6158
exists(DataFlow::Content f | DataFlowPrivate::storeStep(node1, f, node2) |
@@ -64,11 +61,12 @@ private predicate isRelevantTaintStep(DataFlow::Node node1, DataFlow::Node node2
6461
}
6562

6663
/**
67-
* Holds if content `c` is either a field, a synthetic field or language specific
68-
* content of a relevant type or a container like content.
64+
* Holds if content `c` is either a field or synthetic field of a relevant type
65+
* or a container like content.
6966
*/
7067
private predicate isRelevantContent(DataFlow::Content c) {
71-
isRelevantTypeInContent(c) or
68+
isRelevantType(c.(DataFlow::FieldContent).getField().getType()) or
69+
isRelevantType(c.(DataFlow::SyntheticFieldContent).getField().getType()) or
7270
DataFlowPrivate::containerContent(c)
7371
}
7472

@@ -260,10 +258,6 @@ module PropagateToSinkConfig implements DataFlow::ConfigSig {
260258
predicate isBarrier(DataFlow::Node node) { sinkModelSanitizer(node) }
261259

262260
DataFlow::FlowFeature getAFeature() { result instanceof DataFlow::FeatureHasSourceCallContext }
263-
264-
predicate isAdditionalFlowStep(DataFlow::Node node1, DataFlow::Node node2) {
265-
isRelevantTaintStep(node1, node2)
266-
}
267261
}
268262

269263
private module PropagateToSink = TaintTracking::Global<PropagateToSinkConfig>;

java/ql/src/utils/modelgenerator/internal/CaptureModelsSpecific.qll

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -186,14 +186,6 @@ predicate isRelevantType(J::Type t) {
186186
)
187187
}
188188

189-
/**
190-
* Gets the underlying type of the content `c`.
191-
*/
192-
J::Type getUnderlyingContentType(DataFlow::Content c) {
193-
result = c.(DataFlow::FieldContent).getField().getType() or
194-
result = c.(DataFlow::SyntheticFieldContent).getField().getType()
195-
}
196-
197189
/**
198190
* Gets the MaD string representation of the qualifier.
199191
*/

java/ql/test/query-tests/security/CWE-022/semmle/tests/NewPathInjection/PathInjection/pom.xml

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

0 commit comments

Comments
 (0)