Integrate rudimentary threat modeling capabilities. #34
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This commit introduces a new system for performing basic threat modeling analysis on an application architecture.
Key features:
Application Architecture Definition:
architecture.pydefines classes (NetworkZone,Component,Service,Database,Application) to represent an application's structure.load_architecture_from_yaml.Threat Modeling Components:
threat_model.pydefines classes (ThreatActor,AttackVector,Vulnerability,SecurityControl,IdentifiedAttackSurface,SuggestedControl) for security analysis.Analysis Logic:
identify_attack_surfaces: Analyzes anApplicationobject to identify potential attack surfaces based on network exposure (e.g., public services) and data sensitivity. Associates known vulnerabilities with these surfaces.suggest_security_controls: RecommendsSecurityControls forIdentifiedAttackSurfaces based on the vulnerabilities they aim to mitigate.Examples & Documentation:
example_architecture.yamlprovides a sample application architecture.example_security_knowledge_base.yamldemonstrates how to define threat actors, attack vectors, vulnerabilities, and controls (note: direct YAML loading for these is not yet implemented; they are instantiated in Python for now).README.mdhas been updated with a section explaining the new features and how to use them, including a conceptual code example.Unit Tests:
tests/test_architecture.pyandtests/test_threat_model.pyprovide unit tests for the new functionality, covering YAML loading, attack surface identification, and security control suggestion.This integration allows you to define your application architecture and perform a basic security assessment to identify potential weaknesses and receive suggestions for appropriate security controls.
Description
Please provide a brief description of your addition or change.
Checklist