PS: Use the existing MaD rows to model file reads as flow sources.

This commit is contained in:
Mathias Vorreiter Pedersen
2025-04-10 20:25:17 +01:00
parent 1637df0a3f
commit 43de3a131b
2 changed files with 36 additions and 0 deletions

View File

@@ -2,6 +2,7 @@
private import semmle.code.powershell.dataflow.internal.DataFlowPublic as DataFlow
import semmle.code.powershell.dataflow.flowsources.Remote
import semmle.code.powershell.dataflow.flowsources.Local
import semmle.code.powershell.dataflow.flowsources.Stored
import semmle.code.powershell.frameworks.data.internal.ApiGraphModels
/**

View File

@@ -0,0 +1,35 @@
/**
* Provides classes representing sources of stored data.
*/
import powershell
private import FlowSources
/** A data flow source of stored user input. */
abstract class StoredFlowSource extends SourceNode {
override string getThreatModel() { result = "local" }
}
/**
* A node with input from a database.
*/
abstract class DatabaseInputSource extends StoredFlowSource {
override string getThreatModel() { result = "database" }
override string getSourceType() { result = "database input" }
}
private class ExternalDatabaseInputSource extends DatabaseInputSource {
ExternalDatabaseInputSource() { this = ModelOutput::getASourceNode("database", _).asSource() }
}
/** A file stream source is considered a stored flow source. */
abstract class FileStreamStoredFlowSource extends StoredFlowSource {
override string getThreatModel() { result = "file" }
override string getSourceType() { result = "file stream" }
}
private class ExternalFileStreamStoredFlowSource extends FileStreamStoredFlowSource {
ExternalFileStreamStoredFlowSource() { this = ModelOutput::getASourceNode("file", _).asSource() }
}