Java: Delete old deprecated code.

This commit is contained in:
Anders Schack-Mulligen
2019-07-23 10:09:51 +02:00
parent 247848c931
commit a8c10e218c
4 changed files with 6 additions and 154 deletions

View File

@@ -798,16 +798,6 @@ class LogicExpr extends Expr {
* `<=`, `>=`, `<` or `>`.
*/
abstract class ComparisonExpr extends BinaryExpr {
/**
* DEPRECATED: use `getLesserOperand()` instead.
*/
deprecated Expr getLesser() { result = getLesserOperand() }
/**
* DEPRECATED: use `getGreaterOperand()` instead.
*/
deprecated Expr getGreater() { result = getGreaterOperand() }
/**
* Gets the lesser operand of this comparison expression.
*

View File

@@ -216,7 +216,7 @@ private predicate typeArgumentContainsAux1(RefType s, RefType t, int n) {
|
exists(RefType tUpperBound | tUpperBound = t.(Wildcard).getUpperBound().getType() |
// ? extends T <= ? extends S if T <: S
hasSubtypeStar0(s.(Wildcard).getUpperBound().getType(), tUpperBound)
hasSubtypeStar(s.(Wildcard).getUpperBound().getType(), tUpperBound)
or
// ? extends T <= ?
s.(Wildcard).isUnconstrained()
@@ -224,7 +224,7 @@ private predicate typeArgumentContainsAux1(RefType s, RefType t, int n) {
or
exists(RefType tLowerBound | tLowerBound = t.(Wildcard).getLowerBound().getType() |
// ? super T <= ? super S if s <: T
hasSubtypeStar0(tLowerBound, s.(Wildcard).getLowerBound().getType())
hasSubtypeStar(tLowerBound, s.(Wildcard).getLowerBound().getType())
or
// ? super T <= ?
s.(Wildcard).isUnconstrained()
@@ -237,10 +237,10 @@ private predicate typeArgumentContainsAux1(RefType s, RefType t, int n) {
s = t
or
// T <= ? extends T
hasSubtypeStar0(s.(Wildcard).getUpperBound().getType(), t)
hasSubtypeStar(s.(Wildcard).getUpperBound().getType(), t)
or
// T <= ? super T
hasSubtypeStar0(t, s.(Wildcard).getLowerBound().getType())
hasSubtypeStar(t, s.(Wildcard).getLowerBound().getType())
)
}
@@ -249,17 +249,12 @@ private predicate wildcardExtendsObject(Wildcard wc) {
wc.getUpperBound().getType() instanceof TypeObject
}
/**
* DEPRECATED: Use `hasSubtype*` instead.
*/
deprecated predicate hasSubtypeStar(RefType t, RefType sub) { hasSubtype*(t, sub) }
private predicate hasSubtypeStar0(RefType t, RefType sub) {
private predicate hasSubtypeStar(RefType t, RefType sub) {
sub = t
or
hasSubtype(t, sub)
or
exists(RefType mid | hasSubtypeStar0(t, mid) and hasSubtype(mid, sub))
exists(RefType mid | hasSubtypeStar(t, mid) and hasSubtype(mid, sub))
}
/** Holds if type `t` declares member `m`. */

View File

@@ -150,70 +150,6 @@ abstract class UserInput extends DataFlow::Node { }
*/
deprecated class RemoteUserInput extends UserInput {
RemoteUserInput() { this instanceof RemoteFlowSource }
/**
* DEPRECATED: Use a configuration with a defined sink instead.
*
* Holds if taint can flow from this `RemoteUserInput` to `sink`.
*
* In addition to the basic taint flow, this allows a path to end in a number
* of steps through instance fields.
*/
deprecated predicate flowsTo(DataFlow::Node sink) { remoteUserInputFlow(this, sink) }
}
/**
* Holds if taint can flow from `node1` to `node2` in either one local step or
* through an instance field.
*/
private predicate localInstanceFieldStep(DataFlow::Node node1, DataFlow::Node node2) {
TaintTracking::localTaintStep(node1, node2)
or
exists(InstanceField field |
node1.asExpr() = field.getAnAssignedValue()
or
exists(Assignment assign | assign.getRhs() = node1.asExpr() |
assign.getDest().(ArrayAccess).getArray() = field.getAnAccess()
)
|
node2.asExpr() = field.getAnAccess()
)
}
private module RemoteUserInputFlow {
private import semmle.code.java.dataflow.internal.DataFlowImplDepr
private import semmle.code.java.security.SecurityTests
private import semmle.code.java.security.Validation
deprecated class RemoteUserInputConfig extends Configuration {
RemoteUserInputConfig() { this = "FlowSources.qll:RemoteUserInputConfig" }
override predicate isSource(DataFlow::Node source) { source instanceof RemoteUserInput }
override predicate isSink(DataFlow::Node sink) { any() }
override int fieldFlowBranchLimit() { result = 0 }
override predicate isBarrier(DataFlow::Node node) {
// Ignore paths through test code.
node.getEnclosingCallable().getDeclaringType() instanceof NonSecurityTestClass or
exists(ValidatedVariable var | node.asExpr() = var.getAnAccess())
}
override predicate isAdditionalFlowStep(DataFlow::Node node1, DataFlow::Node node2) {
TaintTracking::localAdditionalTaintStep(node1, node2)
}
}
}
cached
deprecated private predicate remoteUserInputFlow(RemoteUserInput src, DataFlow::Node sink) {
any(RemoteUserInputFlow::RemoteUserInputConfig config).hasFlow(src, sink)
or
exists(DataFlow::Node mid |
remoteUserInputFlow(src, mid) and
localInstanceFieldStep(mid, sink)
)
}
/** Input that may be controlled by a local user. */

View File

@@ -1,69 +0,0 @@
import java
private import semmle.code.java.controlflow.Guards as Guards
private import semmle.code.java.controlflow.Dominance
/**
* DEPRECATED: Use semmle.code.java.controlflow.Guards instead.
*
* A basic block that terminates in a condition, splitting the subsequent control flow.
*/
deprecated class ConditionBlock = Guards::ConditionBlock;
/** Holds if `n` updates the locally scoped variable `v`. */
deprecated predicate variableUpdate(ControlFlowNode n, LocalScopeVariable v) {
exists(VariableUpdate a | a = n | a.getDestVar() = v)
}
/** Holds if `bb` updates the locally scoped variable `v`. */
deprecated private predicate variableUpdateBB(BasicBlock bb, LocalScopeVariable v) {
variableUpdate(bb.getANode(), v)
}
/** Indicates the position of phi-nodes in an SSA representation. */
deprecated private predicate needPhiNode(BasicBlock bb, LocalScopeVariable v) {
exists(BasicBlock def | dominanceFrontier(def, bb) |
variableUpdateBB(def, v) or needPhiNode(def, v)
)
}
/** Locally scoped variable `v` occurs in the condition of `cb`. */
deprecated private predicate relevantVar(ConditionBlock cb, LocalScopeVariable v) {
v.getAnAccess() = cb.getCondition().getAChildExpr*()
}
/** Blocks controlled by the condition in `cb` for which `v` is unchanged. */
deprecated private predicate controlsBlockWithSameVar(
ConditionBlock cb, boolean testIsTrue, LocalScopeVariable v, BasicBlock controlled
) {
cb.controls(controlled, testIsTrue) and
relevantVar(cb, v) and
not needPhiNode(controlled, v) and
(
controlled = cb.getTestSuccessor(testIsTrue)
or
exists(BasicBlock mid |
controlsBlockWithSameVar(cb, testIsTrue, v, mid) and
not variableUpdateBB(mid, v) and
controlled = mid.getABBSuccessor()
)
)
}
/**
* DEPRECATED: Use semmle.code.java.dataflow.SSA instead.
*
* Statements controlled by the condition in `s` for which `v` is unchanged (`v` is the same SSA
* variable in both `s` and `controlled`). The condition in `s` must contain an access of `v`.
*/
deprecated predicate controlsNodeWithSameVar(
ConditionNode cn, boolean testIsTrue, LocalScopeVariable v, ControlFlowNode controlled
) {
exists(ConditionBlock cb, BasicBlock controlledBB, int i |
cb.getConditionNode() = cn and
controlsBlockWithSameVar(cb, testIsTrue, v, controlledBB) and
controlled = controlledBB.getNode(i) and
not exists(ControlFlowNode update, int j |
update = controlledBB.getNode(j) and j < i and variableUpdate(update, v)
)
)
}