threatprism 0.1.0__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.
- threatprism-0.1.0/.github/ISSUE_TEMPLATE/bug_report.yml +53 -0
- threatprism-0.1.0/.github/ISSUE_TEMPLATE/feature_request.yml +45 -0
- threatprism-0.1.0/.github/workflows/ci.yml +38 -0
- threatprism-0.1.0/.gitignore +29 -0
- threatprism-0.1.0/CHANGELOG.md +25 -0
- threatprism-0.1.0/CONTRIBUTING.md +93 -0
- threatprism-0.1.0/LICENSE +21 -0
- threatprism-0.1.0/PKG-INFO +297 -0
- threatprism-0.1.0/README.md +264 -0
- threatprism-0.1.0/evaluation/README.md +40 -0
- threatprism-0.1.0/evaluation/eval_runner.py +273 -0
- threatprism-0.1.0/evaluation/generate_results.py +327 -0
- threatprism-0.1.0/evaluation/ground_truth/dvwa.json +97 -0
- threatprism-0.1.0/evaluation/ground_truth/juice_shop.json +114 -0
- threatprism-0.1.0/evaluation/ground_truth/nodegoat.json +99 -0
- threatprism-0.1.0/evaluation/ground_truth/railsgoat.json +98 -0
- threatprism-0.1.0/evaluation/ground_truth/webgoat.json +97 -0
- threatprism-0.1.0/evaluation/metrics.py +308 -0
- threatprism-0.1.0/pyproject.toml +79 -0
- threatprism-0.1.0/src/threatprism/__init__.py +32 -0
- threatprism-0.1.0/src/threatprism/correlation.py +103 -0
- threatprism-0.1.0/src/threatprism/frameworks/__init__.py +1 -0
- threatprism-0.1.0/src/threatprism/frameworks/attack_tree.py +303 -0
- threatprism-0.1.0/src/threatprism/frameworks/dread.py +174 -0
- threatprism-0.1.0/src/threatprism/frameworks/linddun.py +327 -0
- threatprism-0.1.0/src/threatprism/frameworks/pasta.py +319 -0
- threatprism-0.1.0/src/threatprism/frameworks/stride.py +449 -0
- threatprism-0.1.0/src/threatprism/mappings.py +293 -0
- threatprism-0.1.0/src/threatprism/models.py +185 -0
- threatprism-0.1.0/src/threatprism/reports.py +267 -0
- threatprism-0.1.0/src/threatprism/server.py +429 -0
- threatprism-0.1.0/tests/__init__.py +0 -0
- threatprism-0.1.0/tests/test_correlation.py +88 -0
- threatprism-0.1.0/tests/test_frameworks.py +162 -0
- threatprism-0.1.0/tests/test_scoring.py +135 -0
- threatprism-0.1.0/uv.lock +1707 -0
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
name: Bug Report
|
|
2
|
+
description: Report a bug or unexpected behavior
|
|
3
|
+
labels: ["bug"]
|
|
4
|
+
body:
|
|
5
|
+
- type: markdown
|
|
6
|
+
attributes:
|
|
7
|
+
value: |
|
|
8
|
+
Thanks for reporting a bug! Please fill out the details below.
|
|
9
|
+
- type: textarea
|
|
10
|
+
id: description
|
|
11
|
+
attributes:
|
|
12
|
+
label: Description
|
|
13
|
+
description: What happened? What did you expect to happen?
|
|
14
|
+
placeholder: Describe the bug...
|
|
15
|
+
validations:
|
|
16
|
+
required: true
|
|
17
|
+
- type: textarea
|
|
18
|
+
id: reproduction
|
|
19
|
+
attributes:
|
|
20
|
+
label: Steps to Reproduce
|
|
21
|
+
description: Minimal steps to reproduce the issue
|
|
22
|
+
placeholder: |
|
|
23
|
+
1. Run `threatprism ...`
|
|
24
|
+
2. Call tool `analyze_threats` with ...
|
|
25
|
+
3. See error ...
|
|
26
|
+
validations:
|
|
27
|
+
required: true
|
|
28
|
+
- type: input
|
|
29
|
+
id: python-version
|
|
30
|
+
attributes:
|
|
31
|
+
label: Python Version
|
|
32
|
+
placeholder: "3.12"
|
|
33
|
+
validations:
|
|
34
|
+
required: true
|
|
35
|
+
- type: input
|
|
36
|
+
id: os
|
|
37
|
+
attributes:
|
|
38
|
+
label: Operating System
|
|
39
|
+
placeholder: "macOS 15, Ubuntu 24.04, Windows 11"
|
|
40
|
+
validations:
|
|
41
|
+
required: true
|
|
42
|
+
- type: input
|
|
43
|
+
id: client
|
|
44
|
+
attributes:
|
|
45
|
+
label: MCP Client
|
|
46
|
+
description: Which client are you using?
|
|
47
|
+
placeholder: "Claude Desktop, VS Code Copilot, Cursor, etc."
|
|
48
|
+
- type: textarea
|
|
49
|
+
id: logs
|
|
50
|
+
attributes:
|
|
51
|
+
label: Error Output / Logs
|
|
52
|
+
description: Paste any error messages or stack traces
|
|
53
|
+
render: shell
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
name: Feature Request
|
|
2
|
+
description: Suggest a new feature or improvement
|
|
3
|
+
labels: ["enhancement"]
|
|
4
|
+
body:
|
|
5
|
+
- type: markdown
|
|
6
|
+
attributes:
|
|
7
|
+
value: |
|
|
8
|
+
Have an idea for ThreatPrism? We'd love to hear it!
|
|
9
|
+
- type: textarea
|
|
10
|
+
id: problem
|
|
11
|
+
attributes:
|
|
12
|
+
label: Problem or Motivation
|
|
13
|
+
description: What problem does this solve? Why is it needed?
|
|
14
|
+
placeholder: I often need to...
|
|
15
|
+
validations:
|
|
16
|
+
required: true
|
|
17
|
+
- type: textarea
|
|
18
|
+
id: solution
|
|
19
|
+
attributes:
|
|
20
|
+
label: Proposed Solution
|
|
21
|
+
description: How should this work? What would the API or output look like?
|
|
22
|
+
placeholder: It would be great if...
|
|
23
|
+
validations:
|
|
24
|
+
required: true
|
|
25
|
+
- type: dropdown
|
|
26
|
+
id: area
|
|
27
|
+
attributes:
|
|
28
|
+
label: Area
|
|
29
|
+
options:
|
|
30
|
+
- STRIDE analysis
|
|
31
|
+
- DREAD scoring
|
|
32
|
+
- LINDDUN privacy
|
|
33
|
+
- PASTA modeling
|
|
34
|
+
- Attack trees
|
|
35
|
+
- CWE/MITRE mapping
|
|
36
|
+
- Report generation
|
|
37
|
+
- MCP server / integration
|
|
38
|
+
- Other
|
|
39
|
+
validations:
|
|
40
|
+
required: true
|
|
41
|
+
- type: textarea
|
|
42
|
+
id: alternatives
|
|
43
|
+
attributes:
|
|
44
|
+
label: Alternatives Considered
|
|
45
|
+
description: Any other approaches you've considered?
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [master]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [master]
|
|
8
|
+
|
|
9
|
+
permissions:
|
|
10
|
+
contents: read
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
test:
|
|
14
|
+
runs-on: ubuntu-latest
|
|
15
|
+
strategy:
|
|
16
|
+
matrix:
|
|
17
|
+
python-version: ["3.10", "3.11", "3.12", "3.13"]
|
|
18
|
+
|
|
19
|
+
steps:
|
|
20
|
+
- uses: actions/checkout@v4
|
|
21
|
+
|
|
22
|
+
- name: Install uv
|
|
23
|
+
uses: astral-sh/setup-uv@v4
|
|
24
|
+
|
|
25
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
26
|
+
run: uv python install ${{ matrix.python-version }}
|
|
27
|
+
|
|
28
|
+
- name: Install dependencies
|
|
29
|
+
run: uv sync --all-extras --dev
|
|
30
|
+
|
|
31
|
+
- name: Lint
|
|
32
|
+
run: uv run ruff check .
|
|
33
|
+
|
|
34
|
+
- name: Type check
|
|
35
|
+
run: uv run pyright
|
|
36
|
+
|
|
37
|
+
- name: Test
|
|
38
|
+
run: uv run pytest -v --tb=short
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
__pycache__/
|
|
2
|
+
*.py[cod]
|
|
3
|
+
*$py.class
|
|
4
|
+
*.egg-info/
|
|
5
|
+
dist/
|
|
6
|
+
build/
|
|
7
|
+
.eggs/
|
|
8
|
+
*.egg
|
|
9
|
+
.venv/
|
|
10
|
+
venv/
|
|
11
|
+
.env
|
|
12
|
+
.env.*
|
|
13
|
+
*.log
|
|
14
|
+
.pytest_cache/
|
|
15
|
+
.ruff_cache/
|
|
16
|
+
.pyright/
|
|
17
|
+
.mypy_cache/
|
|
18
|
+
.coverage
|
|
19
|
+
htmlcov/
|
|
20
|
+
*.db
|
|
21
|
+
*.sqlite3
|
|
22
|
+
threat-model.md
|
|
23
|
+
.DS_Store
|
|
24
|
+
Thumbs.db
|
|
25
|
+
.vscode/
|
|
26
|
+
.cursor/
|
|
27
|
+
*.pptx
|
|
28
|
+
evaluation/results/
|
|
29
|
+
paper/
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to ThreatPrism will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/), and this project adheres to [Semantic Versioning](https://semver.org/).
|
|
6
|
+
|
|
7
|
+
## [0.1.0] - 2026-03-22
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
|
|
11
|
+
- **STRIDE** threat identification engine with category-based analysis
|
|
12
|
+
- **DREAD** quantitative risk scoring (1-10 scale with weighted context)
|
|
13
|
+
- **LINDDUN** privacy threat assessment with data type and activity detection
|
|
14
|
+
- **PASTA** process-oriented threat modeling with attack simulation
|
|
15
|
+
- **Attack tree** decomposition with AND/OR nodes and likelihood estimation
|
|
16
|
+
- **CWE** cross-referencing with automatic ID mapping
|
|
17
|
+
- **MITRE ATT&CK** technique correlation
|
|
18
|
+
- **Cross-framework correlation** engine linking findings across all frameworks
|
|
19
|
+
- **Markdown report generation** with comprehensive threat summaries
|
|
20
|
+
- MCP server compatible with Claude Desktop, Claude Code, VS Code (Copilot), and Cursor
|
|
21
|
+
- Full test suite (35 tests), ruff linting, and pyright type checking
|
|
22
|
+
- GitHub Actions CI across Python 3.10–3.13
|
|
23
|
+
- Evaluation framework with ground truth for 5 OWASP projects
|
|
24
|
+
|
|
25
|
+
[0.1.0]: https://github.com/manambharadwaj/threatprism/releases/tag/v0.1.0
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
# Contributing to ThreatPrism
|
|
2
|
+
|
|
3
|
+
Thanks for your interest in contributing! This guide covers everything you need to get started.
|
|
4
|
+
|
|
5
|
+
## Development Setup
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
# Clone the repo
|
|
9
|
+
git clone https://github.com/manambharadwaj/threatprism.git
|
|
10
|
+
cd threatprism
|
|
11
|
+
|
|
12
|
+
# Install uv (if you don't have it)
|
|
13
|
+
curl -LsSf https://astral.sh/uv/install.sh | sh
|
|
14
|
+
|
|
15
|
+
# Install dependencies (including dev tools)
|
|
16
|
+
uv sync --all-extras
|
|
17
|
+
|
|
18
|
+
# Verify everything works
|
|
19
|
+
uv run pytest -q
|
|
20
|
+
uv run ruff check .
|
|
21
|
+
uv run pyright
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Making Changes
|
|
25
|
+
|
|
26
|
+
1. **Fork** the repository and create a branch from `master`
|
|
27
|
+
2. **Write code** — follow the existing style (ruff handles formatting)
|
|
28
|
+
3. **Add tests** for any new functionality in `tests/`
|
|
29
|
+
4. **Run the full check suite** before committing:
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
uv run pytest -q # Tests pass
|
|
33
|
+
uv run ruff check . # Lint clean
|
|
34
|
+
uv run pyright # Types clean
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Project Structure
|
|
38
|
+
|
|
39
|
+
```
|
|
40
|
+
src/threatprism/
|
|
41
|
+
├── __init__.py # Package entry point and CLI
|
|
42
|
+
├── server.py # MCP server and tool definitions
|
|
43
|
+
├── models.py # Pydantic models (Threat, DreadScore, etc.)
|
|
44
|
+
├── correlation.py # Cross-framework correlation engine
|
|
45
|
+
├── reports.py # Markdown report generation
|
|
46
|
+
└── frameworks/
|
|
47
|
+
├── stride.py # STRIDE analysis engine
|
|
48
|
+
├── dread.py # DREAD risk scoring
|
|
49
|
+
├── linddun.py # LINDDUN privacy analysis
|
|
50
|
+
├── pasta.py # PASTA threat modeling
|
|
51
|
+
└── attack_tree.py # Attack tree decomposition
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## What to Contribute
|
|
55
|
+
|
|
56
|
+
**Good first issues:**
|
|
57
|
+
- Improve keyword heuristics in LINDDUN/PASTA detection
|
|
58
|
+
- Add new CWE mappings for under-covered threat categories
|
|
59
|
+
- Expand MITRE ATT&CK technique coverage
|
|
60
|
+
- Improve test coverage for edge cases
|
|
61
|
+
|
|
62
|
+
**Larger contributions:**
|
|
63
|
+
- SARIF output format for CI/CD integration
|
|
64
|
+
- Architecture diagram parsing (Mermaid/PlantUML)
|
|
65
|
+
- New analysis frameworks
|
|
66
|
+
- Performance optimizations
|
|
67
|
+
|
|
68
|
+
## Pull Request Guidelines
|
|
69
|
+
|
|
70
|
+
- Keep PRs focused — one feature or fix per PR
|
|
71
|
+
- Include tests for new functionality
|
|
72
|
+
- Ensure all three checks pass (pytest, ruff, pyright)
|
|
73
|
+
- Write a clear PR description explaining *what* and *why*
|
|
74
|
+
|
|
75
|
+
## Code Style
|
|
76
|
+
|
|
77
|
+
- Line length: 88 characters
|
|
78
|
+
- Python 3.10+ syntax (use `X | Y` union types, not `Union[X, Y]`)
|
|
79
|
+
- Type annotations on all public functions
|
|
80
|
+
- Pydantic models for data structures
|
|
81
|
+
|
|
82
|
+
These are enforced by ruff and pyright — just run the checks and fix what they flag.
|
|
83
|
+
|
|
84
|
+
## Reporting Bugs
|
|
85
|
+
|
|
86
|
+
Open an issue at [github.com/manambharadwaj/threatprism/issues](https://github.com/manambharadwaj/threatprism/issues) with:
|
|
87
|
+
- What you expected vs what happened
|
|
88
|
+
- Minimal reproduction steps
|
|
89
|
+
- Python version and OS
|
|
90
|
+
|
|
91
|
+
## License
|
|
92
|
+
|
|
93
|
+
By contributing, you agree that your contributions will be licensed under the [MIT License](LICENSE).
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Manam Bharadwaj
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,297 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: threatprism
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Multi-framework threat intelligence MCP server — STRIDE, DREAD, LINDDUN, and PASTA analysis for AI coding agents
|
|
5
|
+
Project-URL: Homepage, https://github.com/manambharadwaj/threatprism
|
|
6
|
+
Project-URL: Repository, https://github.com/manambharadwaj/threatprism
|
|
7
|
+
Project-URL: Issues, https://github.com/manambharadwaj/threatprism/issues
|
|
8
|
+
Author: Manam Bharadwaj
|
|
9
|
+
License: MIT
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Keywords: ai-security,dread,linddun,mcp,pasta,security,stride,threat-modeling
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
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 :: Quality Assurance
|
|
22
|
+
Requires-Python: >=3.10
|
|
23
|
+
Requires-Dist: click>=8.0.0
|
|
24
|
+
Requires-Dist: fastmcp>=2.3.4
|
|
25
|
+
Requires-Dist: pydantic>=2.0.0
|
|
26
|
+
Provides-Extra: dev
|
|
27
|
+
Requires-Dist: pre-commit>=4.0.0; extra == 'dev'
|
|
28
|
+
Requires-Dist: pyright>=1.1.390; extra == 'dev'
|
|
29
|
+
Requires-Dist: pytest-asyncio>=0.24.0; extra == 'dev'
|
|
30
|
+
Requires-Dist: pytest>=8.0.0; extra == 'dev'
|
|
31
|
+
Requires-Dist: ruff>=0.8.0; extra == 'dev'
|
|
32
|
+
Description-Content-Type: text/markdown
|
|
33
|
+
|
|
34
|
+
# ThreatPrism
|
|
35
|
+
|
|
36
|
+
**Multi-framework threat intelligence for AI coding agents**
|
|
37
|
+
|
|
38
|
+
[](https://github.com/manambharadwaj/threatprism/actions/workflows/ci.yml)
|
|
39
|
+
[](LICENSE)
|
|
40
|
+
[](https://www.python.org/downloads/)
|
|
41
|
+
|
|
42
|
+
ThreatPrism is an MCP (Model Context Protocol) server that provides **simultaneous threat analysis across four security frameworks** — STRIDE, DREAD, LINDDUN, and PASTA — with automatic cross-referencing to CWE and MITRE ATT&CK.
|
|
43
|
+
|
|
44
|
+
Unlike single-framework tools, ThreatPrism gives you a **multi-dimensional view** of every threat: *what category* (STRIDE), *how severe* (DREAD), *what privacy impact* (LINDDUN), and *what attack process* (PASTA), all correlated in one analysis.
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
## What Makes This Different
|
|
49
|
+
|
|
50
|
+
| Capability | ThreatPrism | Typical Security Tools |
|
|
51
|
+
|---|---|---|
|
|
52
|
+
| Multi-framework correlation | STRIDE + DREAD + LINDDUN + PASTA in one pass | Usually one framework |
|
|
53
|
+
| Quantitative scoring | DREAD 1-10 scores with weighted context | Qualitative High/Med/Low |
|
|
54
|
+
| Privacy-first analysis | Built-in LINDDUN engine | Usually separate DPIA tool |
|
|
55
|
+
| Attack tree generation | AND/OR decomposition with likelihood | Manual diagramming |
|
|
56
|
+
| CWE + MITRE ATT&CK mapping | Automatic cross-reference | Manual lookup |
|
|
57
|
+
| AI agent workflow | MCP server with auto-instructions | IDE plugin or CLI |
|
|
58
|
+
|
|
59
|
+
---
|
|
60
|
+
|
|
61
|
+
## Tools
|
|
62
|
+
|
|
63
|
+
### Analysis
|
|
64
|
+
|
|
65
|
+
| Tool | Framework | Purpose |
|
|
66
|
+
|------|-----------|---------|
|
|
67
|
+
| `analyze_threat_landscape` | STRIDE | Categorise threats from a system description |
|
|
68
|
+
| `score_risks` | DREAD | Quantitative risk scoring (1-10 per dimension) |
|
|
69
|
+
| `assess_privacy_impact` | LINDDUN | Privacy threat assessment for personal data |
|
|
70
|
+
| `run_pasta_analysis` | PASTA | 7-stage attack simulation process |
|
|
71
|
+
| `build_attack_tree` | Attack Trees | AND/OR decomposition of attack paths |
|
|
72
|
+
|
|
73
|
+
### Cross-Reference
|
|
74
|
+
|
|
75
|
+
| Tool | Purpose |
|
|
76
|
+
|------|---------|
|
|
77
|
+
| `correlate_frameworks` | Map threats across STRIDE → DREAD → LINDDUN → CWE → MITRE ATT&CK |
|
|
78
|
+
| `map_to_cwe` | Link threats to CWE entries with remediation links |
|
|
79
|
+
| `suggest_mitigations` | Prioritised mitigation strategies |
|
|
80
|
+
|
|
81
|
+
### Documentation
|
|
82
|
+
|
|
83
|
+
| Tool | Purpose |
|
|
84
|
+
|------|---------|
|
|
85
|
+
| `generate_threat_report` | Full markdown report combining all frameworks |
|
|
86
|
+
|
|
87
|
+
---
|
|
88
|
+
|
|
89
|
+
## Quick Start
|
|
90
|
+
|
|
91
|
+
### Install
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
# Using uv (recommended)
|
|
95
|
+
uv pip install .
|
|
96
|
+
|
|
97
|
+
# Or with pip
|
|
98
|
+
pip install .
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
### Run the Server
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
# stdio (default — for IDE integration)
|
|
105
|
+
threatprism
|
|
106
|
+
|
|
107
|
+
# HTTP transport (for shared/team use)
|
|
108
|
+
threatprism --transport streamable-http --port 8000
|
|
109
|
+
|
|
110
|
+
# SSE transport
|
|
111
|
+
threatprism --transport sse --port 8000
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
---
|
|
115
|
+
|
|
116
|
+
## IDE Integration
|
|
117
|
+
|
|
118
|
+
### Cursor
|
|
119
|
+
|
|
120
|
+
Add to `.cursor/mcp.json`:
|
|
121
|
+
|
|
122
|
+
```json
|
|
123
|
+
{
|
|
124
|
+
"mcpServers": {
|
|
125
|
+
"threatprism": {
|
|
126
|
+
"command": "threatprism",
|
|
127
|
+
"args": []
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
Or with uv (no install required):
|
|
134
|
+
|
|
135
|
+
```json
|
|
136
|
+
{
|
|
137
|
+
"mcpServers": {
|
|
138
|
+
"threatprism": {
|
|
139
|
+
"command": "uv",
|
|
140
|
+
"args": ["run", "--directory", "/path/to/threatprism", "threatprism"]
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
### Claude Desktop
|
|
147
|
+
|
|
148
|
+
Add to `claude_desktop_config.json` (macOS: `~/Library/Application Support/Claude/`, Windows: `%APPDATA%\Claude\`):
|
|
149
|
+
|
|
150
|
+
```json
|
|
151
|
+
{
|
|
152
|
+
"mcpServers": {
|
|
153
|
+
"threatprism": {
|
|
154
|
+
"command": "threatprism",
|
|
155
|
+
"args": []
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
Or with uv (no install required):
|
|
162
|
+
|
|
163
|
+
```json
|
|
164
|
+
{
|
|
165
|
+
"mcpServers": {
|
|
166
|
+
"threatprism": {
|
|
167
|
+
"command": "uv",
|
|
168
|
+
"args": ["run", "--directory", "/path/to/threatprism", "threatprism"]
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
### Claude Code (CLI)
|
|
175
|
+
|
|
176
|
+
```bash
|
|
177
|
+
claude mcp add threatprism -- threatprism
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
Or with uv:
|
|
181
|
+
|
|
182
|
+
```bash
|
|
183
|
+
claude mcp add threatprism -- uv run --directory /path/to/threatprism threatprism
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
### VS Code (GitHub Copilot)
|
|
187
|
+
|
|
188
|
+
Add to `.vscode/mcp.json`:
|
|
189
|
+
|
|
190
|
+
```json
|
|
191
|
+
{
|
|
192
|
+
"servers": {
|
|
193
|
+
"threatprism": {
|
|
194
|
+
"command": "threatprism",
|
|
195
|
+
"args": []
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
### Docker
|
|
202
|
+
|
|
203
|
+
```bash
|
|
204
|
+
docker build -t threatprism:latest .
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
```json
|
|
208
|
+
{
|
|
209
|
+
"mcpServers": {
|
|
210
|
+
"threatprism": {
|
|
211
|
+
"command": "docker",
|
|
212
|
+
"args": ["run", "--rm", "-i", "threatprism:latest"]
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
---
|
|
219
|
+
|
|
220
|
+
## Agent Workflow
|
|
221
|
+
|
|
222
|
+
When an AI agent connects, ThreatPrism automatically sends workflow instructions via the MCP handshake. The agent will follow this flow:
|
|
223
|
+
|
|
224
|
+
```
|
|
225
|
+
┌─────────────────────────────┐
|
|
226
|
+
│ 1. analyze_threat_landscape │ ← STRIDE categorisation
|
|
227
|
+
├─────────────────────────────┤
|
|
228
|
+
│ 2. score_risks │ ← DREAD quantitative scoring
|
|
229
|
+
├─────────────────────────────┤
|
|
230
|
+
│ 3. assess_privacy_impact │ ← LINDDUN privacy analysis
|
|
231
|
+
├─────────────────────────────┤
|
|
232
|
+
│ 4. build_attack_tree │ ← Attack path decomposition
|
|
233
|
+
├─────────────────────────────┤
|
|
234
|
+
│ 5. correlate_frameworks │ ← Multi-framework mapping
|
|
235
|
+
├─────────────────────────────┤
|
|
236
|
+
│ 6. generate_threat_report │ ← Comprehensive documentation
|
|
237
|
+
└─────────────────────────────┘
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
No manual configuration needed — the agent receives the instructions on connect.
|
|
241
|
+
|
|
242
|
+
---
|
|
243
|
+
|
|
244
|
+
## Example Output
|
|
245
|
+
|
|
246
|
+
### DREAD Score Table
|
|
247
|
+
|
|
248
|
+
| Threat | D | R | E | A | D | Overall | Rating |
|
|
249
|
+
|--------|---|---|---|---|---|---------|--------|
|
|
250
|
+
| Authentication Bypass | 8.0 | 7.5 | 7.0 | 8.5 | 6.5 | **7.5** | HIGH |
|
|
251
|
+
| Input Manipulation | 9.0 | 6.0 | 6.5 | 7.0 | 5.5 | **6.8** | HIGH |
|
|
252
|
+
| Session Hijacking | 7.5 | 6.0 | 5.5 | 7.0 | 5.5 | **6.3** | HIGH |
|
|
253
|
+
|
|
254
|
+
### Cross-Framework Correlation
|
|
255
|
+
|
|
256
|
+
| Threat | STRIDE | DREAD | LINDDUN | CWE | MITRE |
|
|
257
|
+
|--------|--------|-------|---------|-----|-------|
|
|
258
|
+
| Auth Bypass | SPOO | 7.5 | IDEN, NON_ | CWE-287, CWE-290 | T1078, T1110 |
|
|
259
|
+
| Data Exposure | INFO | 6.8 | DISC, LINK, IDEN | CWE-200, CWE-312 | T1530, T1567 |
|
|
260
|
+
|
|
261
|
+
---
|
|
262
|
+
|
|
263
|
+
## Frameworks
|
|
264
|
+
|
|
265
|
+
### STRIDE (Threat Categorisation)
|
|
266
|
+
Classifies threats into six categories: **S**poofing, **T**ampering, **R**epudiation, **I**nformation Disclosure, **D**enial of Service, **E**levation of Privilege.
|
|
267
|
+
|
|
268
|
+
### DREAD (Risk Scoring)
|
|
269
|
+
Quantitative scoring on five dimensions (1-10 each): **D**amage, **R**eproducibility, **E**xploitability, **A**ffected Users, **D**iscoverability. Overall score = average.
|
|
270
|
+
|
|
271
|
+
### LINDDUN (Privacy Threats)
|
|
272
|
+
Privacy-specific analysis across seven categories: **L**inkability, **I**dentifiability, **N**on-repudiation, **D**etectability, **D**isclosure, **U**nawareness, **N**on-compliance.
|
|
273
|
+
|
|
274
|
+
### PASTA (Attack Simulation)
|
|
275
|
+
Seven-stage process: Business Objectives → Technical Scope → Decomposition → Threat Analysis → Vulnerability Analysis → Attack Modeling → Risk/Impact Analysis.
|
|
276
|
+
|
|
277
|
+
---
|
|
278
|
+
|
|
279
|
+
## Development
|
|
280
|
+
|
|
281
|
+
```bash
|
|
282
|
+
# Install with dev dependencies
|
|
283
|
+
uv sync --frozen --all-extras --dev
|
|
284
|
+
|
|
285
|
+
# Run tests
|
|
286
|
+
uv run pytest
|
|
287
|
+
|
|
288
|
+
# Lint & type-check
|
|
289
|
+
uv run ruff check .
|
|
290
|
+
uv run pyright
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
---
|
|
294
|
+
|
|
295
|
+
## License
|
|
296
|
+
|
|
297
|
+
MIT — see [LICENSE](LICENSE).
|