diff --git a/go/ql/lib/semmle/go/controlflow/ControlFlowGraph.qll b/go/ql/lib/semmle/go/controlflow/ControlFlowGraph.qll index df9a025915e..d527a650b9d 100644 --- a/go/ql/lib/semmle/go/controlflow/ControlFlowGraph.qll +++ b/go/ql/lib/semmle/go/controlflow/ControlFlowGraph.qll @@ -225,9 +225,11 @@ module ControlFlow { } /** + * DEPRECATED: Use the disjunct of `writesElement` and `writesField` instead. + * * Holds if this node sets any field or element of `base` to `rhs`. */ - predicate writesComponent(DataFlow::Node base, DataFlow::Node rhs) { + deprecated predicate writesComponent(DataFlow::Node base, DataFlow::Node rhs) { this.writesElement(base, _, rhs) or this.writesField(base, _, rhs) } diff --git a/go/ql/lib/semmle/go/frameworks/Protobuf.qll b/go/ql/lib/semmle/go/frameworks/Protobuf.qll index 4103815e7d2..62443eb46af 100644 --- a/go/ql/lib/semmle/go/frameworks/Protobuf.qll +++ b/go/ql/lib/semmle/go/frameworks/Protobuf.qll @@ -141,13 +141,10 @@ module Protobuf { private class WriteMessageFieldStep extends TaintTracking::AdditionalTaintStep { override predicate step(DataFlow::Node pred, DataFlow::Node succ) { [succ.getType(), succ.getType().getPointerType()] instanceof MessageType and - exists(DataFlow::Node n, DataFlow::ReadNode base | - succ.(DataFlow::PostUpdateNode).getPreUpdateNode() = getUnderlyingNode(base) + exists(DataFlow::Write w, DataFlow::ReadNode base | + w.writesElementPreUpdate(base, _, pred) or w.writesFieldPreUpdate(base, _, pred) | - any(DataFlow::Write w).writesComponent(n, pred) and - // The below line only works because `base`'s type, `DataFlow::ReadNode`, - // is incompatible with `DataFlow::PostUpdateNode`. - base = [n, n.(DataFlow::PostUpdateNode).getPreUpdateNode()] + succ.(DataFlow::PostUpdateNode).getPreUpdateNode() = getUnderlyingNode(base) ) } }