Skip to content

Commit 2a3631c

Browse files
committed
Delete WriteNode.writesFieldOnSsaWithFields
This can be easily expressed in terms of `WriteNode.writesFieldPreUpdate`.
1 parent f89f3d3 commit 2a3631c

File tree

6 files changed

+6
-13
lines changed

6 files changed

+6
-13
lines changed

go/ql/lib/semmle/go/controlflow/ControlFlowGraph.qll

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -165,13 +165,6 @@ module ControlFlow {
165165
this.writesFieldInsn(base.asInstruction(), f, rhs.asInstruction())
166166
}
167167

168-
/**
169-
* Holds if this node sets the value of field `f` on `v` to `rhs`.
170-
*/
171-
predicate writesFieldOnSsaWithFields(SsaWithFields v, Field f, DataFlow::Node rhs) {
172-
this.writesFieldPreUpdate(v.getAUse(), f, rhs)
173-
}
174-
175168
private predicate writesFieldInsn(IR::Instruction base, Field f, IR::Instruction rhs) {
176169
exists(IR::FieldTarget trg | trg = super.getLhs() |
177170
(

go/ql/lib/semmle/go/security/OpenUrlRedirectCustomizations.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ module OpenUrlRedirect {
9292
PathAssignmentBarrier() {
9393
exists(Write w, SsaWithFields var |
9494
hasHostnameSanitizingSubstring(w.getRhs()) and
95-
w.writesFieldOnSsaWithFields(var, any(Field f | f.getName() = "Path"), _) and
95+
w.writesFieldPreUpdate(var.getAUse(), any(Field f | f.getName() = "Path"), _) and
9696
useIsDominated(var, w, this)
9797
)
9898
}

go/ql/lib/semmle/go/security/RequestForgery.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ module RequestForgery {
2828
predicate isAdditionalFlowStep(DataFlow::Node pred, DataFlow::Node succ) {
2929
// propagate to a URL when its host is assigned to
3030
exists(Write w, Field f, SsaWithFields v | f.hasQualifiedName("net/url", "URL", "Host") |
31-
w.writesFieldOnSsaWithFields(v, f, pred) and
31+
w.writesFieldPreUpdate(v.getAUse(), f, pred) and
3232
succ = v.getAUse()
3333
)
3434
}

go/ql/lib/semmle/go/security/SafeUrlFlow.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ module SafeUrlFlow {
2424
predicate isAdditionalFlowStep(DataFlow::Node node1, DataFlow::Node node2) {
2525
// propagate to a URL when its host is assigned to
2626
exists(Write w, Field f, SsaWithFields v | f.hasQualifiedName("net/url", "URL", "Host") |
27-
w.writesFieldOnSsaWithFields(v, f, node1) and
27+
w.writesFieldPreUpdate(v.getAUse(), f, node1) and
2828
node2 = v.getAUse()
2929
)
3030
}

go/ql/src/Security/CWE-322/InsecureHostKeyCallback.ql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,8 @@ predicate hostCheckReachesSink(Flow::PathNode sink) {
9898
Flow::flowPath(source, otherSink) and
9999
Config::writeIsSink(sink.getNode(), sinkWrite) and
100100
Config::writeIsSink(otherSink.getNode(), otherSinkWrite) and
101-
sinkWrite.writesFieldOnSsaWithFields(sinkAccessPath, _, sink.getNode()) and
102-
otherSinkWrite.writesFieldOnSsaWithFields(otherSinkAccessPath, _, otherSink.getNode()) and
101+
sinkWrite.writesFieldPreUpdate(sinkAccessPath.getAUse(), _, sink.getNode()) and
102+
otherSinkWrite.writesFieldPreUpdate(otherSinkAccessPath.getAUse(), _, otherSink.getNode()) and
103103
otherSinkAccessPath = sinkAccessPath.similar()
104104
)
105105
)

go/ql/src/experimental/CWE-918/SSRF.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ module ServerSideRequestForgery {
2323
predicate isAdditionalFlowStep(DataFlow::Node node1, DataFlow::Node node2) {
2424
// propagate to a URL when its host is assigned to
2525
exists(Write w, Field f, SsaWithFields v | f.hasQualifiedName("net/url", "URL", "Host") |
26-
w.writesFieldOnSsaWithFields(v, f, node1) and
26+
w.writesFieldPreUpdate(v.getAUse(), f, node1) and
2727
node2 = v.getAUse()
2828
)
2929
}

0 commit comments

Comments
 (0)