Add comment + use flowTo

This commit is contained in:
Joe Farebrother
2023-04-24 15:49:05 +01:00
parent a4d7570788
commit 0ebf529dc4

View File

@@ -82,6 +82,7 @@ private predicate isFileWriteCall(Expr stream, Expr data) {
)
}
/** A configuration for tracking flow from calls that open a file in write mode to methods that write to that file, excluding encrypted streams. */
private module LocalFileOutputStreamConfig implements DataFlow::ConfigSig {
predicate isSource(DataFlow::Node src) { sourceNode(src, "file-write") }
@@ -111,7 +112,7 @@ private module LocalFileOutputStreamFlow = DataFlow::Global<LocalFileOutputStrea
class LocalFileOutputSink extends ExternalLocationSink {
LocalFileOutputSink() {
exists(DataFlow::Node streamSink |
LocalFileOutputStreamFlow::flow(_, streamSink) and
LocalFileOutputStreamFlow::flowTo(streamSink) and
isFileWriteCall(streamSink.asExpr(), this.asExpr())
)
}