Skip to content

Commit 0bcacff

Browse files
committed
Threat models
1 parent ed44443 commit 0bcacff

8 files changed

Lines changed: 2876 additions & 0 deletions

File tree

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,7 @@ disable = "logging-fstring-interpolation"
157157
min-similarity-lines = 10
158158

159159
[tool.pylint.MASTER]
160+
ignored-modules = ["pytm"]
160161
ignore-paths = [
161162
"doc/_build/",
162163
"doc/_ext/sphinxcontrib_asciinema",

security/README.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Security
2+
3+
This folder contains the threat models.
4+
5+
They depend on features not yet in a pytm release; install a pinned commit
6+
until an official release is available:
7+
8+
`pip install git+https://github.com/OWASP/pytm.git@279ed14aa13ea8f0b989717812fd4626bfcddf3d`
9+
10+
To update the pin, verify the new commit in the upstream repository and replace
11+
the SHA above.
12+
13+
After this you can generate various reports using:
14+
15+
```bash
16+
python -m security.tm_supply_chain --report security/report_template.md > report.md
17+
python -m security.tm_supply_chain --dfd
18+
python -m security.tm_supply_chain --seq
19+
20+
python -m security.tm_usage --report security/report_template.md > report_usage.md
21+
python -m security.tm_usage --dfd
22+
python -m security.tm_usage --seq
23+
```

security/__init__.py

Whitespace-only changes.

security/report_template.md

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
## System Description
2+
3+
{tm.description}
4+
5+
## Dataflow Diagram - Level 0 DFD
6+
7+
```dot
8+
{tm.dfd:call:}
9+
```
10+
11+
## Dataflows
12+
13+
Name|From|To |Data|Protocol|Port
14+
|:----:|:----:|:---:|:----:|:--------:|:----:|
15+
{dataflows:repeat:|{{item.display_name:call:}}|{{item.source.name}}|{{item.sink.name}}|{{item.data}}|{{item.protocol}}|{{item.dstPort}}|
16+
}
17+
18+
## Data Dictionary
19+
20+
{data:repeat:
21+
Name|{{item.name}}
22+
|:----|:----|
23+
Description|{{item.description}}|
24+
Classification|{{item.classification.name}}|
25+
Carried By|{{item.carriedBy:repeat:{{{{item.name}}}}<br>}}|
26+
Processed By|{{item.processedBy:repeat:{{{{item.name}}}}<br>}}|
27+
28+
{{item:call:getInScopeFindings}}
29+
}
30+
31+
## Actors
32+
33+
{actors:repeat:
34+
Name|{{item.name}}
35+
|:----|:----|
36+
Description|{{item.description}}|
37+
Is Admin|{{item.isAdmin}}|
38+
Finding Count|{{item:call:getFindingCount}}|
39+
40+
{{item:call:getInScopeFindings}}
41+
}
42+
43+
## Boundaries
44+
45+
{boundaries:repeat:
46+
Name|{{item.name}}
47+
|:----|:----|
48+
Description|{{item.description}}|
49+
In Scope|{{item.inScope}}|
50+
Immediate Parent|{{item.parents:if:{{item:call:getParentName}}}}{{item.parents:not:N/A, primary boundary}}|
51+
All Parents|{{item.parents:call:{{{{item.display_name:call:}}}}, }}|
52+
Classification|{{item.maxClassification}}|
53+
Finding Count|{{item:call:getFindingCount}}|
54+
55+
{{item:call:getInScopeFindings}}
56+
}
57+
58+
59+
## Assets
60+
61+
{assets:repeat:
62+
Name|{{item.name}}
63+
|:----|:----|
64+
Description|{{item.description}}|
65+
In Scope|{{item.inScope}}|
66+
Type|{{item:call:getElementType}}|
67+
Finding Count|{{item:call:getFindingCount}}|
68+
69+
{{item:call:getInScopeFindings}}
70+
}
71+
72+
73+
## Data Flows
74+
75+
{dataflows:repeat:
76+
Name|{{item.name}}
77+
|:----|:----|
78+
Description|{{item.description}}|
79+
Sink|{{item.sink}}|
80+
Source|{{item.source}}|
81+
Is Response|{{item.isResponse}}|
82+
In Scope|{{item.inScope}}|
83+
Finding Count|{{item:call:getFindingCount}}|
84+
85+
{{item:call:getInScopeFindings}}
86+
}
87+
88+
89+
{tm.excluded_findings:if:
90+
# Excluded Threats
91+
}
92+
93+
{tm.excluded_findings:repeat:
94+
<details>
95+
<summary>
96+
{{item:call:getThreatId}} - {{item:call:getFindingDescription}}
97+
</summary>
98+
<p>
99+
<b>{{item:call:getThreatId}}</b> was excluded for
100+
<b>{{item:call:getFindingTarget}}</b>
101+
because of the assumption "{{item.assumption.name}}"
102+
</p>
103+
{{item.assumption.description:if:
104+
<h6>Assumption description</h6>
105+
<p>{{item.assumption.description}}</p>
106+
}}
107+
<h6>Severity</h6>
108+
<p>{{item:call:getFindingSeverity}}</p>
109+
<h6>Example Instances</h6>
110+
<p>{{item:call:getFindingExample}}</p>
111+
<h6>References</h6>
112+
<p>{{item:call:getFindingReferences}}</p>
113+
</details>
114+
}

security/threats.json

Lines changed: 497 additions & 0 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)