mirror of
https://github.com/github/codeql.git
synced 2025-12-16 16:53:25 +01:00
Delete WriteNode.writesFieldOnSsaWithFields
This can be easily expressed in terms of `WriteNode.writesFieldPreUpdate`.
This commit is contained in:
@@ -165,13 +165,6 @@ module ControlFlow {
|
||||
this.writesFieldInsn(base.asInstruction(), f, rhs.asInstruction())
|
||||
}
|
||||
|
||||
/**
|
||||
* Holds if this node sets the value of field `f` on `v` to `rhs`.
|
||||
*/
|
||||
predicate writesFieldOnSsaWithFields(SsaWithFields v, Field f, DataFlow::Node rhs) {
|
||||
this.writesFieldPreUpdate(v.getAUse(), f, rhs)
|
||||
}
|
||||
|
||||
private predicate writesFieldInsn(IR::Instruction base, Field f, IR::Instruction rhs) {
|
||||
exists(IR::FieldTarget trg | trg = super.getLhs() |
|
||||
(
|
||||
|
||||
@@ -92,7 +92,7 @@ module OpenUrlRedirect {
|
||||
PathAssignmentBarrier() {
|
||||
exists(Write w, SsaWithFields var |
|
||||
hasHostnameSanitizingSubstring(w.getRhs()) and
|
||||
w.writesFieldOnSsaWithFields(var, any(Field f | f.getName() = "Path"), _) and
|
||||
w.writesFieldPreUpdate(var.getAUse(), any(Field f | f.getName() = "Path"), _) and
|
||||
useIsDominated(var, w, this)
|
||||
)
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ module RequestForgery {
|
||||
predicate isAdditionalFlowStep(DataFlow::Node pred, DataFlow::Node succ) {
|
||||
// propagate to a URL when its host is assigned to
|
||||
exists(Write w, Field f, SsaWithFields v | f.hasQualifiedName("net/url", "URL", "Host") |
|
||||
w.writesFieldOnSsaWithFields(v, f, pred) and
|
||||
w.writesFieldPreUpdate(v.getAUse(), f, pred) and
|
||||
succ = v.getAUse()
|
||||
)
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ module SafeUrlFlow {
|
||||
predicate isAdditionalFlowStep(DataFlow::Node node1, DataFlow::Node node2) {
|
||||
// propagate to a URL when its host is assigned to
|
||||
exists(Write w, Field f, SsaWithFields v | f.hasQualifiedName("net/url", "URL", "Host") |
|
||||
w.writesFieldOnSsaWithFields(v, f, node1) and
|
||||
w.writesFieldPreUpdate(v.getAUse(), f, node1) and
|
||||
node2 = v.getAUse()
|
||||
)
|
||||
}
|
||||
|
||||
@@ -98,8 +98,8 @@ predicate hostCheckReachesSink(Flow::PathNode sink) {
|
||||
Flow::flowPath(source, otherSink) and
|
||||
Config::writeIsSink(sink.getNode(), sinkWrite) and
|
||||
Config::writeIsSink(otherSink.getNode(), otherSinkWrite) and
|
||||
sinkWrite.writesFieldOnSsaWithFields(sinkAccessPath, _, sink.getNode()) and
|
||||
otherSinkWrite.writesFieldOnSsaWithFields(otherSinkAccessPath, _, otherSink.getNode()) and
|
||||
sinkWrite.writesFieldPreUpdate(sinkAccessPath.getAUse(), _, sink.getNode()) and
|
||||
otherSinkWrite.writesFieldPreUpdate(otherSinkAccessPath.getAUse(), _, otherSink.getNode()) and
|
||||
otherSinkAccessPath = sinkAccessPath.similar()
|
||||
)
|
||||
)
|
||||
|
||||
@@ -23,7 +23,7 @@ module ServerSideRequestForgery {
|
||||
predicate isAdditionalFlowStep(DataFlow::Node node1, DataFlow::Node node2) {
|
||||
// propagate to a URL when its host is assigned to
|
||||
exists(Write w, Field f, SsaWithFields v | f.hasQualifiedName("net/url", "URL", "Host") |
|
||||
w.writesFieldOnSsaWithFields(v, f, node1) and
|
||||
w.writesFieldPreUpdate(v.getAUse(), f, node1) and
|
||||
node2 = v.getAUse()
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user