Metadata-Version: 2.4
Name: threat-modeling-py
Version: 1.0.0
Summary: Threat Modeling as Code - a declarative STRIDE threat-modeling library for Python
Author-email: Parthiv Rawat <parthiv05022000@gmail.com>
Maintainer-email: Parthiv Rawat <parthiv05022000@gmail.com>
License-Expression: MIT
Project-URL: Homepage, https://github.com/parthivrawat/threat-modeling
Project-URL: Documentation, https://github.com/parthivrawat/threat-modeling/tree/main/python#readme
Project-URL: Repository, https://github.com/parthivrawat/threat-modeling
Project-URL: Bug Tracker, https://github.com/parthivrawat/threat-modeling/issues
Project-URL: Changelog, https://github.com/parthivrawat/threat-modeling/blob/main/python/CHANGELOG.md
Keywords: threat,threat-modeling,stride,security,risk,mitigation,trust-boundary,component,data-flow
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Security
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Typing :: Typed
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Provides-Extra: dev
Requires-Dist: pytest>=7.0.0; extra == "dev"
Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
Requires-Dist: black>=23.0.0; extra == "dev"
Requires-Dist: mypy>=1.0.0; extra == "dev"
Requires-Dist: ruff>=0.1.0; extra == "dev"
Dynamic: license-file

# Threat Modeling as Code (Python)

A declarative threat-modeling library for Python. Express your system as
components, trust boundaries, and data flows, then analyze it with the STRIDE
methodology to get actionable, version-controlled mitigations.

## Features

- Declarative `Model`, `Component`, `Boundary`, and `DataFlow` types
- STRIDE threat classification: **Spoofing**, **Tampering**, **Repudiation**, **Information Disclosure**, **Denial of Service**, **Elevation of Privilege**
- Trust-boundary-aware data flow analysis
- Built-in, context-aware mitigation catalog
- Zero runtime dependencies
- Type hints included (`py.typed`)

## Installation

```bash
pip install threat-modeling-py
```

## Quick Start

```python
from threat_modeling import Model, Component, Boundary

app = Model('payment-api')
app.add(Component('api', component_type='api', environment='k8s',
                  stores=['user-data'], exposed=True))
app.add(Boundary('internet', untrusted=True, trusts=['api']))

for threat in app.analyze():
    print(threat.kind, threat.target)
    for mitigation in threat.mitigations:
        print('  -', mitigation)
```

## Development

```bash
cd implementations/security/threat-modeling/python
pip install -e ".[dev]"
pytest test_threat_modeling.py -v
```

## Publishing to PyPI

```bash
cd implementations/security/threat-modeling/python
python -m build
python -m twine check dist/*
python -m twine upload dist/*
```

## License

MIT License
