tmxcaliber 0.3.15__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- tmxcaliber-0.3.15/LICENSE +201 -0
- tmxcaliber-0.3.15/PKG-INFO +396 -0
- tmxcaliber-0.3.15/README.md +349 -0
- tmxcaliber-0.3.15/pyproject.toml +98 -0
- tmxcaliber-0.3.15/setup.cfg +4 -0
- tmxcaliber-0.3.15/test/test_cli.py +1046 -0
- tmxcaliber-0.3.15/test/test_cli_end_to_end_more.py +450 -0
- tmxcaliber-0.3.15/test/test_cli_helpers_more.py +384 -0
- tmxcaliber-0.3.15/test/test_filter_applier_more.py +370 -0
- tmxcaliber-0.3.15/test/test_lib_cache.py +103 -0
- tmxcaliber-0.3.15/test/test_lib_change_log.py +213 -0
- tmxcaliber-0.3.15/test/test_lib_change_log_contracts.py +83 -0
- tmxcaliber-0.3.15/test/test_lib_control_selector.py +127 -0
- tmxcaliber-0.3.15/test/test_lib_errors_more.py +17 -0
- tmxcaliber-0.3.15/test/test_lib_feature_class_hierarchy.py +211 -0
- tmxcaliber-0.3.15/test/test_lib_filter_applier.py +213 -0
- tmxcaliber-0.3.15/test/test_lib_filter_applier_cascades.py +143 -0
- tmxcaliber-0.3.15/test/test_lib_scf.py +100 -0
- tmxcaliber-0.3.15/test/test_lib_threatmodel_data.py +490 -0
- tmxcaliber-0.3.15/test/test_lib_tools.py +191 -0
- tmxcaliber-0.3.15/test/test_lib_tools_ordering.py +37 -0
- tmxcaliber-0.3.15/test/test_parsers.py +112 -0
- tmxcaliber-0.3.15/test/test_parsers_more.py +43 -0
- tmxcaliber-0.3.15/test/test_schema.py +249 -0
- tmxcaliber-0.3.15/test/test_threatmodel_data_more.py +231 -0
- tmxcaliber-0.3.15/test/test_tm_diff.py +228 -0
- tmxcaliber-0.3.15/tmxcaliber/__init__.py +0 -0
- tmxcaliber-0.3.15/tmxcaliber/cli.py +797 -0
- tmxcaliber-0.3.15/tmxcaliber/lib/__init__.py +0 -0
- tmxcaliber-0.3.15/tmxcaliber/lib/cache.py +51 -0
- tmxcaliber-0.3.15/tmxcaliber/lib/change_log.py +283 -0
- tmxcaliber-0.3.15/tmxcaliber/lib/control_selector.py +173 -0
- tmxcaliber-0.3.15/tmxcaliber/lib/dfd_analyzer.py +707 -0
- tmxcaliber-0.3.15/tmxcaliber/lib/dfd_diff.py +275 -0
- tmxcaliber-0.3.15/tmxcaliber/lib/errors.py +25 -0
- tmxcaliber-0.3.15/tmxcaliber/lib/feature_class_hierarchy.py +84 -0
- tmxcaliber-0.3.15/tmxcaliber/lib/filter.py +49 -0
- tmxcaliber-0.3.15/tmxcaliber/lib/filter_applier.py +267 -0
- tmxcaliber-0.3.15/tmxcaliber/lib/permission_json.py +352 -0
- tmxcaliber-0.3.15/tmxcaliber/lib/scf.py +114 -0
- tmxcaliber-0.3.15/tmxcaliber/lib/threatmodel_data.py +506 -0
- tmxcaliber-0.3.15/tmxcaliber/lib/tm_diff.py +555 -0
- tmxcaliber-0.3.15/tmxcaliber/lib/tools.py +123 -0
- tmxcaliber-0.3.15/tmxcaliber/opacity.py +380 -0
- tmxcaliber-0.3.15/tmxcaliber/params.py +55 -0
- tmxcaliber-0.3.15/tmxcaliber/parsers.py +488 -0
- tmxcaliber-0.3.15/tmxcaliber/schema/__init__.py +0 -0
- tmxcaliber-0.3.15/tmxcaliber/schema/overwatch/20240110.json +85 -0
- tmxcaliber-0.3.15/tmxcaliber/schema/schema.py +281 -0
- tmxcaliber-0.3.15/tmxcaliber/schema/threatmodel/20240423.json +774 -0
- tmxcaliber-0.3.15/tmxcaliber.egg-info/PKG-INFO +396 -0
- tmxcaliber-0.3.15/tmxcaliber.egg-info/SOURCES.txt +54 -0
- tmxcaliber-0.3.15/tmxcaliber.egg-info/dependency_links.txt +1 -0
- tmxcaliber-0.3.15/tmxcaliber.egg-info/entry_points.txt +2 -0
- tmxcaliber-0.3.15/tmxcaliber.egg-info/requires.txt +22 -0
- tmxcaliber-0.3.15/tmxcaliber.egg-info/top_level.txt +1 -0
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
|
@@ -0,0 +1,396 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: tmxcaliber
|
|
3
|
+
Version: 0.3.15
|
|
4
|
+
Summary: CLI utility to filter down one or more TrustOnCloud ThreatModels and get more refined information.
|
|
5
|
+
Author-email: TrustOnCloud <dev@trustoncloud.com>
|
|
6
|
+
License-Expression: Apache-2.0
|
|
7
|
+
Project-URL: Homepage, https://github.com/trustoncloud/tmxcaliber
|
|
8
|
+
Project-URL: Repository, https://github.com/trustoncloud/tmxcaliber
|
|
9
|
+
Project-URL: Issues, https://github.com/trustoncloud/tmxcaliber/issues
|
|
10
|
+
Classifier: Development Status :: 4 - Beta
|
|
11
|
+
Classifier: Environment :: Console
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: Intended Audience :: Information Technology
|
|
14
|
+
Classifier: Operating System :: OS Independent
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
20
|
+
Classifier: Topic :: Security
|
|
21
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
22
|
+
Requires-Python: >=3.10
|
|
23
|
+
Description-Content-Type: text/markdown
|
|
24
|
+
License-File: LICENSE
|
|
25
|
+
Requires-Dist: beautifulsoup4<5,>=4
|
|
26
|
+
Requires-Dist: lxml<7,>=5
|
|
27
|
+
Requires-Dist: colorama<1,>=0.4.6
|
|
28
|
+
Requires-Dist: openpyxl<4,>=3
|
|
29
|
+
Requires-Dist: tqdm<5,>=4
|
|
30
|
+
Requires-Dist: networkx<4,>=3
|
|
31
|
+
Requires-Dist: deepdiff<9,>=8
|
|
32
|
+
Requires-Dist: jsonschema<5,>=4.25
|
|
33
|
+
Provides-Extra: dev
|
|
34
|
+
Requires-Dist: pytest<10,>=9; extra == "dev"
|
|
35
|
+
Requires-Dist: pytest-mock<4,>=3.14; extra == "dev"
|
|
36
|
+
Requires-Dist: coverage<8,>=7; extra == "dev"
|
|
37
|
+
Requires-Dist: ruff<1,>=0.6; extra == "dev"
|
|
38
|
+
Requires-Dist: mypy<2,>=1.11; extra == "dev"
|
|
39
|
+
Requires-Dist: pre-commit<5,>=4; extra == "dev"
|
|
40
|
+
Requires-Dist: types-beautifulsoup4; extra == "dev"
|
|
41
|
+
Requires-Dist: lxml-stubs; extra == "dev"
|
|
42
|
+
Requires-Dist: types-openpyxl; extra == "dev"
|
|
43
|
+
Requires-Dist: types-tqdm; extra == "dev"
|
|
44
|
+
Requires-Dist: types-jsonschema; extra == "dev"
|
|
45
|
+
Requires-Dist: types-colorama; extra == "dev"
|
|
46
|
+
Dynamic: license-file
|
|
47
|
+
|
|
48
|
+
# tmxcaliber
|
|
49
|
+
|
|
50
|
+
`tmxcaliber` is a command-line toolkit for refining, querying, and transforming TrustOnCloud ThreatModels. It helps engineers work with large model files more efficiently by filtering JSON, exporting threats and controls, mapping control objectives to frameworks, generating DFD artifacts, and comparing model versions without writing custom scripts for each task.
|
|
51
|
+
|
|
52
|
+
## Highlights
|
|
53
|
+
|
|
54
|
+
- Filter ThreatModel JSON files by IDs, severity, IAM permissions, and events.
|
|
55
|
+
- List threats, controls, services, and feature classes from a single model or an entire directory.
|
|
56
|
+
- Map control objectives to SCF-supported frameworks or your own custom framework.
|
|
57
|
+
- Write mapping data back into a ThreatModel JSON.
|
|
58
|
+
- Generate threat-focused and feature-class-focused DFD XML and PNG outputs.
|
|
59
|
+
- Create structured change logs in JSON or Markdown.
|
|
60
|
+
- Scan control descriptions with regex patterns or the built-in `guardduty_findings` alias.
|
|
61
|
+
|
|
62
|
+
## Quickstart
|
|
63
|
+
|
|
64
|
+
`tmxcaliber` supports Python `3.10+`.
|
|
65
|
+
|
|
66
|
+
```sh
|
|
67
|
+
pip install tmxcaliber
|
|
68
|
+
tmxcaliber -h
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
Or run it without installing anything, using [uv](https://docs.astral.sh/uv/):
|
|
72
|
+
|
|
73
|
+
```sh
|
|
74
|
+
uvx tmxcaliber -h
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
First commands to try:
|
|
78
|
+
|
|
79
|
+
```sh
|
|
80
|
+
tmxcaliber list threats path/to/threatmodel.json
|
|
81
|
+
tmxcaliber filter path/to/threatmodel.json --severity high --output filtered.json
|
|
82
|
+
tmxcaliber map path/to/threatmodel.json --scf 2025.3.1 --framework-name "NIST CSF v2.0"
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## Installation
|
|
86
|
+
|
|
87
|
+
### Install from PyPI
|
|
88
|
+
|
|
89
|
+
The recommended way to get the CLI:
|
|
90
|
+
|
|
91
|
+
```sh
|
|
92
|
+
pip install tmxcaliber
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
Or run it without installing anything, with [uv](https://docs.astral.sh/uv/):
|
|
96
|
+
|
|
97
|
+
```sh
|
|
98
|
+
uvx tmxcaliber -h
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
Pin a specific version the usual way:
|
|
102
|
+
|
|
103
|
+
```sh
|
|
104
|
+
pip install "tmxcaliber==<version>"
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
Every merge to `main` publishes a new version to PyPI automatically, so the
|
|
108
|
+
latest released code is always there. The Git tags remain the release history
|
|
109
|
+
and carry the same sdist and wheel as attachments.
|
|
110
|
+
|
|
111
|
+
### Install from source
|
|
112
|
+
|
|
113
|
+
For contributors, or to work against unreleased changes. This uses
|
|
114
|
+
[uv](https://docs.astral.sh/uv/) to build the environment from the committed
|
|
115
|
+
`uv.lock`:
|
|
116
|
+
|
|
117
|
+
```sh
|
|
118
|
+
git clone https://github.com/trustoncloud/tmxcaliber.git
|
|
119
|
+
cd tmxcaliber
|
|
120
|
+
uv sync
|
|
121
|
+
uv run tmxcaliber -h
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
If you prefer a manual virtual environment with `pip`:
|
|
125
|
+
|
|
126
|
+
```sh
|
|
127
|
+
python -m venv .venv
|
|
128
|
+
# PowerShell
|
|
129
|
+
.venv\Scripts\Activate.ps1
|
|
130
|
+
# bash / zsh
|
|
131
|
+
source .venv/bin/activate
|
|
132
|
+
|
|
133
|
+
pip install .
|
|
134
|
+
tmxcaliber -h
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
### Docker
|
|
138
|
+
|
|
139
|
+
The repository includes a Dockerfile for containerized use:
|
|
140
|
+
|
|
141
|
+
```sh
|
|
142
|
+
docker build -t tmxcaliber .
|
|
143
|
+
docker run --rm -it tmxcaliber -h
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
### Requirement note for `generate`
|
|
147
|
+
|
|
148
|
+
The `generate` command depends on `drawio`. If the binary is not automatically detected, provide it explicitly with `--bin`.
|
|
149
|
+
|
|
150
|
+
## Command Overview
|
|
151
|
+
|
|
152
|
+
| Command | Purpose | Typical output |
|
|
153
|
+
| --- | --- | --- |
|
|
154
|
+
| `filter` | Produce a refined ThreatModel JSON based on filters. | JSON |
|
|
155
|
+
| `list threats` | Export threat rows from one model or a directory. | CSV |
|
|
156
|
+
| `list controls` | Export control rows from one model or a directory. | CSV |
|
|
157
|
+
| `list services` | List service names and their source files. | CSV or JSON |
|
|
158
|
+
| `list feature-classes` | Inspect feature classes in a single ThreatModel. | CSV or JSON |
|
|
159
|
+
| `map` | Generate a framework mapping from ThreatModel control objectives. | CSV or JSON |
|
|
160
|
+
| `add-mapping` | Insert mapping data into the ThreatModel JSON. | JSON |
|
|
161
|
+
| `scan` | Find controls whose descriptions match a pattern. | JSON |
|
|
162
|
+
| `generate` | Generate XML and PNG DFD artifacts. | Files on disk |
|
|
163
|
+
| `create-change-log` | Compare two ThreatModels and summarize differences. | JSON or Markdown |
|
|
164
|
+
|
|
165
|
+
## Core Workflows
|
|
166
|
+
|
|
167
|
+
### Filter a ThreatModel
|
|
168
|
+
|
|
169
|
+
Use `filter` when you want a refined ThreatModel JSON as the output.
|
|
170
|
+
|
|
171
|
+
```sh
|
|
172
|
+
tmxcaliber filter path/to/threatmodel.json \
|
|
173
|
+
--severity high \
|
|
174
|
+
--output filtered.json
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
Create a filtered file and a companion file containing everything removed:
|
|
178
|
+
|
|
179
|
+
```sh
|
|
180
|
+
tmxcaliber filter path/to/threatmodel.json \
|
|
181
|
+
--permissions s3:GetObject \
|
|
182
|
+
--output filtered.json \
|
|
183
|
+
--output-removed
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
Use `--exclude` to invert an ID-based filter:
|
|
187
|
+
|
|
188
|
+
```sh
|
|
189
|
+
tmxcaliber filter path/to/threatmodel.json \
|
|
190
|
+
--ids S3.T12,S3.CO1 \
|
|
191
|
+
--exclude \
|
|
192
|
+
--output filtered.json
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
### List threats and controls
|
|
196
|
+
|
|
197
|
+
List threats from a single model:
|
|
198
|
+
|
|
199
|
+
```sh
|
|
200
|
+
tmxcaliber list threats path/to/threatmodel.json
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
List only high and very-high severity threats from a directory:
|
|
204
|
+
|
|
205
|
+
```sh
|
|
206
|
+
tmxcaliber list threats path/to/threatmodels \
|
|
207
|
+
--severity high \
|
|
208
|
+
--output threats.csv
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
List controls from a directory:
|
|
212
|
+
|
|
213
|
+
```sh
|
|
214
|
+
tmxcaliber list controls path/to/threatmodels --output controls.csv
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
List only AWS data perimeter controls:
|
|
218
|
+
|
|
219
|
+
```sh
|
|
220
|
+
tmxcaliber list controls path/to/threatmodels \
|
|
221
|
+
--type AWS_DATA_PERIMETER \
|
|
222
|
+
--output perimeter_controls.csv
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
List services across a directory of models:
|
|
226
|
+
|
|
227
|
+
```sh
|
|
228
|
+
tmxcaliber list services path/to/threatmodels --format json
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
List feature classes from a single ThreatModel:
|
|
232
|
+
|
|
233
|
+
```sh
|
|
234
|
+
tmxcaliber list feature-classes path/to/threatmodel.json
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
### Map to a supported or custom framework
|
|
238
|
+
|
|
239
|
+
Generate a mapping to an SCF-supported framework:
|
|
240
|
+
|
|
241
|
+
```sh
|
|
242
|
+
tmxcaliber map path/to/threatmodel.json \
|
|
243
|
+
--scf 2025.3.1 \
|
|
244
|
+
--framework-name "ISO 27001 v2013" \
|
|
245
|
+
--format csv
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
Use the exact framework name from the selected SCF version header when targeting a built-in framework.
|
|
249
|
+
|
|
250
|
+
Generate a mapping to your own framework using the starter CSVs in [`template/`](template):
|
|
251
|
+
|
|
252
|
+
```sh
|
|
253
|
+
tmxcaliber map path/to/threatmodel.json \
|
|
254
|
+
--scf 2025.3.1 \
|
|
255
|
+
--framework-name "My Framework" \
|
|
256
|
+
--framework-map template/myframework.csv \
|
|
257
|
+
--framework-metadata template/mymetadata.csv \
|
|
258
|
+
--format json
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
### Add mapping data back into a ThreatModel
|
|
262
|
+
|
|
263
|
+
If you want the mapping persisted directly into the ThreatModel output:
|
|
264
|
+
|
|
265
|
+
```sh
|
|
266
|
+
tmxcaliber add-mapping path/to/threatmodel.json \
|
|
267
|
+
--scf 2025.3.1 \
|
|
268
|
+
--framework-name "My Framework" \
|
|
269
|
+
--framework-map template/myframework.csv \
|
|
270
|
+
--framework-metadata template/mymetadata.csv \
|
|
271
|
+
--output enriched-threatmodel.json
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
### Generate DFD artifacts
|
|
275
|
+
|
|
276
|
+
`generate` accepts either:
|
|
277
|
+
|
|
278
|
+
- a ThreatModel JSON containing base64-encoded XML in `dfd.body`
|
|
279
|
+
- a raw XML file from the main ThreatModel DFD
|
|
280
|
+
|
|
281
|
+
Generate XML and PNG outputs from JSON:
|
|
282
|
+
|
|
283
|
+
```sh
|
|
284
|
+
tmxcaliber generate path/to/threatmodel.json \
|
|
285
|
+
--threat-dir out/threat-xml \
|
|
286
|
+
--fc-dir out/feature-class-xml \
|
|
287
|
+
--out-dir out/png
|
|
288
|
+
```
|
|
289
|
+
|
|
290
|
+
Generate from XML with an explicit `drawio` binary:
|
|
291
|
+
|
|
292
|
+
```sh
|
|
293
|
+
tmxcaliber generate path/to/provider_service_DFD.xml \
|
|
294
|
+
--bin "C:\Program Files\draw.io\draw.io.exe" \
|
|
295
|
+
--out-dir out/png
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
### Scan control descriptions
|
|
299
|
+
|
|
300
|
+
Search control descriptions with a regex:
|
|
301
|
+
|
|
302
|
+
```sh
|
|
303
|
+
tmxcaliber scan path/to/threatmodel.json --pattern UnauthorizedAccess
|
|
304
|
+
```
|
|
305
|
+
|
|
306
|
+
Use the built-in GuardDuty findings alias:
|
|
307
|
+
|
|
308
|
+
```sh
|
|
309
|
+
tmxcaliber scan path/to/threatmodel.json --pattern guardduty_findings
|
|
310
|
+
```
|
|
311
|
+
|
|
312
|
+
### Create change logs
|
|
313
|
+
|
|
314
|
+
Compare two ThreatModel versions and output JSON:
|
|
315
|
+
|
|
316
|
+
```sh
|
|
317
|
+
tmxcaliber create-change-log path/to/new_tm.json path/to/old_tm.json
|
|
318
|
+
```
|
|
319
|
+
|
|
320
|
+
Generate a Markdown report:
|
|
321
|
+
|
|
322
|
+
```sh
|
|
323
|
+
tmxcaliber create-change-log path/to/new_tm.json path/to/old_tm.json \
|
|
324
|
+
--format md \
|
|
325
|
+
--output changes.md
|
|
326
|
+
```
|
|
327
|
+
|
|
328
|
+
You can also scope the comparison to specific IDs and invert the selection with `--exclude`.
|
|
329
|
+
|
|
330
|
+
## Common Examples
|
|
331
|
+
|
|
332
|
+
```sh
|
|
333
|
+
# List all threats across a directory
|
|
334
|
+
tmxcaliber list threats path/to/threatmodels
|
|
335
|
+
|
|
336
|
+
# Keep only specific controls and objectives in a filtered JSON
|
|
337
|
+
tmxcaliber filter path/to/threatmodel.json --ids S3.C12,S3.CO5 --output filtered.json
|
|
338
|
+
|
|
339
|
+
# Exclude known noisy threats from a threat export
|
|
340
|
+
tmxcaliber list threats path/to/threatmodel.json --ids S3.T2,S3.T9 --exclude
|
|
341
|
+
|
|
342
|
+
# Export services for inventory or reporting
|
|
343
|
+
tmxcaliber list services path/to/threatmodels --output services.csv
|
|
344
|
+
|
|
345
|
+
# Produce a custom-framework mapping
|
|
346
|
+
tmxcaliber map path/to/threatmodel.json --scf 2025.3.1 --framework-name "My Framework" --framework-map template/myframework.csv
|
|
347
|
+
|
|
348
|
+
# Create a Markdown change log between releases
|
|
349
|
+
tmxcaliber create-change-log new.json old.json --format md --output changes.md
|
|
350
|
+
```
|
|
351
|
+
|
|
352
|
+
## Help Reference
|
|
353
|
+
|
|
354
|
+
Use the built-in help to inspect the full CLI surface:
|
|
355
|
+
|
|
356
|
+
```sh
|
|
357
|
+
tmxcaliber -h
|
|
358
|
+
tmxcaliber filter -h
|
|
359
|
+
tmxcaliber map -h
|
|
360
|
+
tmxcaliber add-mapping -h
|
|
361
|
+
tmxcaliber scan -h
|
|
362
|
+
tmxcaliber generate -h
|
|
363
|
+
tmxcaliber list threats -h
|
|
364
|
+
tmxcaliber list controls -h
|
|
365
|
+
tmxcaliber list services -h
|
|
366
|
+
tmxcaliber list feature-classes -h
|
|
367
|
+
tmxcaliber create-change-log -h
|
|
368
|
+
```
|
|
369
|
+
|
|
370
|
+
## Development
|
|
371
|
+
|
|
372
|
+
Set up a local development environment with dev dependencies (Ruff, mypy,
|
|
373
|
+
pytest, coverage, pre-commit, and type stubs):
|
|
374
|
+
|
|
375
|
+
```sh
|
|
376
|
+
uv sync --extra dev
|
|
377
|
+
uv run pre-commit install
|
|
378
|
+
```
|
|
379
|
+
|
|
380
|
+
Run the test suite:
|
|
381
|
+
|
|
382
|
+
```sh
|
|
383
|
+
uv run pytest -q test
|
|
384
|
+
```
|
|
385
|
+
|
|
386
|
+
Lint, format, and type-check:
|
|
387
|
+
|
|
388
|
+
```sh
|
|
389
|
+
uv run ruff format --check .
|
|
390
|
+
uv run ruff check .
|
|
391
|
+
uv run mypy
|
|
392
|
+
```
|
|
393
|
+
|
|
394
|
+
## Contributing
|
|
395
|
+
|
|
396
|
+
Contributions are welcome. If you want to improve the CLI, add tests, or extend the documentation, open an issue or submit a pull request with a clear description of the change and its intended user impact.
|