Skip to main content

Fluent threat modeling

FluenTM is a tool that enables the creation, validation and maintenance of Threat Models. FluenTM provides a fluent-style API to allow engineers to quickly build threat models.

The goal of FluenTM is go allow engineers to quickly build maintainable threat models.

FluenTM is built for use by GitOps teams, where control systems; configuration and large amounts of documentation are stored in version control. The goal of FluenTM is to allow developers to build meaningful threat models with as little effort as possible and for those diagrams to be maintainable and version controlled.

Typical security review processes suffer from a few common challenges:

  1. Developers hate building diagrams for review.
  2. Diagrams are rarely complete before the review, leading to long reviews.
  3. Reviews (and diagrams), become irrelevant quickly because they're hard to maintain (see 1.)
  4. Reviews (and diagrams) can't be validated easily against reality
  5. Review materials aren't machine readable and can't easily be fed into automation

FluenTM is built to fit into a GitOps workflow. The idea is that developers commit threat models that describe their infrastructure. Security reviewers work through code review tools to collaborate on the model before the final-review. After the review, results are captured in the model as a pull request from the security team. The security review becomes a living, collaboratively maintained document.

Diagram of process, created with FluenTM

The idea is that you can use simplified python, and not even need to understand basic things like variables, or control structures, but still create a useful diagram.

from fluentm.entities import Actor, Boundary, Process, DataFlow
from fluentm.renderer import report

scenes={
        "FluenTM":[
            DataFlow(
                Actor("Security"),
                Process("ThreatModel").inBoundary(Boundary("Version Control")),
                "Pull Request: Empty ThreatModel"
                ),
            DataFlow(Actor("Developer"), Process.get("ThreatModel"), "Update threat model"),
            DataFlow(Actor.get("Security"), Process.get("ThreatModel"), "Comments in review tooling"),
            DataFlow(Process.get("ThreatModel"), Process("Review Meeting"), "Security and Dev attend"),
            DataFlow(Process.get("Review Meeting"), Process.get("ThreatModel"), "Updates from meeting")
            
        ]
    }

if __name__ == "__main__":
    r = report(scenes, outputDir="examples/process", dfdLabels=False)

FluenTM has a series of tenets to govern design decisions:

  1. Users should not need to know python, or pythonic principles to use FluenTM

FluenTM is incomplete; there's whole big chunks of functionality missing:

  • Sequence Diagram Support
  • Detection of common security anti-patterns
  • Reviewer feedback capture mechanism
  • Review linter

Alternatives

  • PyTM is a pythonic framework for threat modelling, it comes with a rich set of primitives, a reporting framework and a database of known threats.
  • Theragile is the open-source toolkit which allows to model an architecture with its assets in an agile declarative fashion as a YAML file
  • Diagrams generates beautifully balanced architecture digrams

Usage

FluenTM is available as a python package in PyPI: https://pypi.org/project/fluentm/

First, make sure your system has graphviz installed, FluentM depends on graphviz to draw diagrams. Next use you favorite python package manager to install FluenTM, use of a virtual environment is recommended:

python3 -m venv .venv && source .venv/bin/activate
pip install fluentm

Developing

# Install graphviz using apt/brew/yum etc.
echo "Replace this echo command with your installation of graphviz"

# Clone this repo
git clone https://github.com/hyakuhei/fluentm

# CD into the repo
cd fluentm

# Create a virtualenv
python3 -m venv .venv

# Load the virtualenv
source .venv/bin/activate

# Install requirements like pytest that don't ship with the package
pip install -r requirements.txt

# Install the fluentm package locally
pip install -e .

# Test by generating one of the included examples
cd examples
python3 example_bookstore.py && open bookstore/ThreatModel.html

Metadata

Release files for fluentm 0.0.21

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for fluentm 0.0.21
File Size Uploaded
fluentm-0.0.21.tar.gz 15.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for fluentm 0.0.21
File Interpreter ABI Platform
fluentm-0.0.21-py3-none-any.whl Python 3 none any Details

Total release size: 29.7 kB

Release files / fluentm-0.0.21.tar.gz

Download URL fluentm-0.0.21.tar.gz
Size 15.5 kB
Tags Source
SHA-256 checksum
How to use checksums
67f18c16b8167294c157712da902eac8747efb66d5a602a623a8339271303eb5
BLAKE2b-256 checksum
How to use checksums
a057ac11b56cc40827b594b66fb80d368e75cd6d7de3aadfedabc43530e51e37
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.4

Release files / fluentm-0.0.21-py3-none-any.whl

Download URL fluentm-0.0.21-py3-none-any.whl
Size 14.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b39108a9974f1b94c0b73cc99c64cc8611dd64549ec848cc46b86e6affbd866d
BLAKE2b-256 checksum
How to use checksums
158e98e3bce8fcdbf0f7086e993ac10800fa10f44f7aaafb0a864c847a44c5fd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.4

Release history Release notifications | RSS feed

This release

0.0.21 This release

2 release files

0.0.2

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page