Installation
Pick a client and clone the repository into its skills directory.
Installation
About this skill
Python-based threat modeling using pytm library for programmatic STRIDE analysis, data flow diagram generation, and automated security threat identification. Use when: (1) Creating threat models programmatically using Python code, (2) Generating data flow diagrams (DFDs) with automatic STRIDE threat identification, (3) Integrating threat modeling into CI/CD pipelines and shift-left security practices, (4) Analyzing system architecture for security threats across trust boundaries, (5) Producing threat reports with STRIDE categories and mitigation recommendations, (6) Maintaining threat models as code for version control and automation.
How to use
Zainstaluj wymagane zależności: Python 3.7 lub nowszy, bibliotekę pytm oraz Graphviz. Uruchom
pip install pytm graphvizw swoim środowisku.Utwórz plik Python z definicją modelu zagrożeń. Zaimportuj niezbędne klasy z pytm: TM (threat model), Server, Dataflow, Boundary i Actor. Zainicjuj nowy model zagrożeń, nadając mu nazwę i opis (np. "E-commerce web application").
Zdefiniuj granice zaufania (Boundary) reprezentujące różne strefy bezpieczeństwa, takie jak Internet, DMZ czy sieć wewnętrzna. Dodaj elementy systemu (serwery, bazy danych, aktorów) przypisując je do odpowiednich granic.
Zdefiniuj przepływy danych (Dataflow) między elementami systemu, opisując jak dane przesyłane są między komponentami. Każdy przepływ powinien zawierać informacje o typie danych i protokołach komunikacji.
Uruchom analizę STRIDE na modelu, aby automatycznie zidentyfikować potencjalne zagrożenia dla każdego przepływu danych i elementu systemu. Biblioteka wygeneruje listę zagrożeń przypisanych do kategorii STRIDE (Spoofing, Tampering, Repudiation, Information Disclosure, Denial of Service, Elevation of Privilege).
Wygeneruj diagram przepływu danych (DFD) w formacie graficznym oraz raport zagrożeń zawierający rekomendacje mitygacji. Zintegruj ten proces w swoim potoku CI/CD, aby przeprowadzać ciągłą analizę bezpieczeństwa architektury systemu.