Skip to content

Commit d29df68

Browse files
committed
Introduce the SourceNode and ThreatModelFlowSource classes
1. Introduces the `SourceNode` class which allows dataflow nodes representing sources to indicate the threat model they are associated with. 2. Introduces the `ThreatModelFlowSource` class which represents a source node which respects the threat model configuration
1 parent ad093fd commit d29df68

File tree

1 file changed

+26
-0
lines changed
  • csharp/ql/lib/semmle/code/csharp/security/dataflow/flowsources

1 file changed

+26
-0
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
private import semmle.code.csharp.dataflow.internal.ExternalFlow
2+
private import codeql.threatmodels.ThreatModels
3+
4+
/**
5+
* A data flow source.
6+
*/
7+
abstract class SourceNode extends DataFlow::Node {
8+
/**
9+
* Gets a string that represents the source kind with respect to threat modeling.
10+
*/
11+
abstract string getThreatModel();
12+
}
13+
14+
/**
15+
* A class of data flow sources that respects the
16+
* current threat model configuration.
17+
*/
18+
class ThreatModelFlowSource extends DataFlow::Node {
19+
ThreatModelFlowSource() {
20+
exists(string kind |
21+
// Specific threat model.
22+
currentThreatModel(kind) and
23+
(this.(SourceNode).getThreatModel() = kind or sourceNode(this, kind))
24+
)
25+
}
26+
}

0 commit comments

Comments
 (0)