flowstrider.models package

Submodules

flowstrider.models.common_models module

class flowstrider.models.common_models.Cluster(id: str, node_ids: ~typing.Set[str], name: str = '', tags: ~typing.Set[str] = <factory>, attributes: ~typing.Dict[str, ~typing.Any] = <factory>, severity_multiplier: float = 1.0)[source]

Bases: object

Represents a cluster.

id

A unique identifier of the cluster.

Type:

str

node_ids

IDs of the nodes in the cluster.

Type:

Set[str]

name

Name of the cluster.

Type:

str

tags

A set of tags used to specify the type of the cluster [“STRIDE:TrustBoundary”].

Type:

Set[str]

attributes

A dictionary containing metadata about the cluster. Currently, no additional metadata is used here.

Type:

Dict[str, Any]

severity_multiplier

Multiplier for the severity of threats found in this cluster.

Type:

float

attributes: Dict[str, Any]
id: str
name: str = ''
node_ids: Set[str]
severity_multiplier: float = 1.0
tags: Set[str]
class flowstrider.models.common_models.Edge(id: str, source_id: str, sink_id: str, name: str = '', tags: ~typing.Set[str] = <factory>, attributes: ~typing.Dict[str, ~typing.Any] = <factory>)[source]

Bases: object

Represents a edge.

id

A unique identifier of the edge.

Type:

str

source_id

ID of the source node.

Type:

str

sink_id

ID of the sink node.

Type:

str

name

Name of the edge.

Type:

str

tags

A set of tags used to specify the type of the edge: data flow [STRIDE:Dataflow].

Type:

Set[str]

attributes

A dictionary containing metadata about the edge. (see supported metadata).

Type:

Dict[str, Any]

attributes: Dict[str, Any]
id: str
name: str = ''
sink_id: str
source_id: str
tags: Set[str]
class flowstrider.models.common_models.Node(id: str, name: str = '', tags: ~typing.Set[str] = <factory>, attributes: ~typing.Dict[str, ~typing.Any] = <factory>, severity_multiplier: float = 1.0)[source]

Bases: object

Represents a node.

id

A unique identifier for the node.

Type:

str

name

The name of the node.

Type:

str

tags

A set of tags used to specify the type of the node: datastore, process, or external entity [‘STRIDE:DataStore’, ‘STRIDE:Process’, ‘STRIDE:Interactor’].

Type:

Set[str]

attributes

A dictionary containing metadata about the node (see supported metadata).

Type:

Dict[str, Any]

severity_multiplier

Multiplier for the severity of threats found at this node.

Type:

float

attributes: Dict[str, Any]
id: str
name: str = ''
severity_multiplier: float = 1.0
tags: Set[str]

flowstrider.models.dataflowdiagram module

class flowstrider.models.dataflowdiagram.DataflowDiagram(id: str, nodes: ~typing.Dict[str, ~flowstrider.models.common_models.Node], edges: ~typing.Dict[str, ~flowstrider.models.common_models.Edge], clusters: ~typing.Dict[str, ~flowstrider.models.common_models.Cluster], name: str = '', tags: ~typing.Set[str] = <factory>, attributes: ~typing.Dict[str, ~typing.Any] = <factory>)[source]

Bases: object

Represents a data flow diagram.

id

A unique identifier for the diagram.

Type:

str

nodes

The nodes in the diagram. These can represent processes, external entities, or data stores.

Type:

Dict[str, Node]

edges

The edges in the diagram. These represent data flows between nodes.

Type:

Dict[str, Edge]

clusters

The clusters in the diagram. These contain nodes and represent trust boundaries.

Type:

Dict[str, Cluster]

name

The name of the diagram.

Type:

str

tags

A set of tags specifying the rule set to use [‘stride’, ‘bsi_rules’, ‘linddun_rules’].

Type:

Set[str]

attributes

Metadata about the data flow diagram. This information is not used in the current version.

Type:

Dict[str, Any]

attributes: Dict[str, Any]
clusters: Dict[str, Cluster]
edges: Dict[str, Edge]
get_clusters_for_node_id(node_id: str) List[Cluster][source]

Returns all clusters a node is in

get_node_by_id(node_id: str) Node[source]
id: str
name: str = ''
nodes: Dict[str, Node]
tags: Set[str]

flowstrider.models.threat module

class flowstrider.models.threat.Threat(source: str, source_internal: str, location: flowstrider.models.common_models.Node | flowstrider.models.common_models.Edge | flowstrider.models.dataflowdiagram.DataflowDiagram | str, severity: float, short_description: str, long_description: str, mitigation_options: List[str], requirement: str, req_status: str)[source]

Bases: object

display_id(dfd: DataflowDiagram) str[source]

Display identifier for each individal threat; takes names instead of id of elements and is localized; not suitable as a unique id

location: Node | Edge | DataflowDiagram | str
location_str(dfd: DataflowDiagram) str[source]
long_description: str
mitigation_options: List[str]
req_status: str
requirement: str
severity: float
short_description: str
source: str
source_internal: str
uid() str[source]

Unique identifier for each individal threat

flowstrider.models.threat.location_str(location: Node | Edge | DataflowDiagram | str, dfd: DataflowDiagram)[source]

flowstrider.models.threat_management module

class flowstrider.models.threat_management.ThreatManagementDatabase(per_threat_information: Dict[str, flowstrider.models.threat_management.ThreatManagementItem] = <factory>)[source]

Bases: object

get(threat_: Threat, dfd: DataflowDiagram)[source]
per_threat_information: Dict[str, ThreatManagementItem]
should_fail(threats: List[Threat], dfd: DataflowDiagram, level: str) List[Threat][source]
update(threats_in: List[Threat], dfd: DataflowDiagram)[source]
class flowstrider.models.threat_management.ThreatManagementItem(uid: str = '', management_state: flowstrider.models.threat_management.ThreatManagementState = <ThreatManagementState.Undecided: 1>, explanation: str = '')[source]

Bases: object

explanation: str = ''
management_state: ThreatManagementState = 1
uid: str = ''
class flowstrider.models.threat_management.ThreatManagementState(*values)[source]

Bases: Enum

Accept = 5
Avoid = 4
Delegate = 2
Delegated = 6
Mitigate = 3
Mitigated = 7
Undecided = 1

Module contents