Integrate rudimentary threat modeling capabilities.#34
Open
Mwessc wants to merge 2 commits intogoogle-labs-code:mainfrom
Open
Integrate rudimentary threat modeling capabilities.#34Mwessc wants to merge 2 commits intogoogle-labs-code:mainfrom
Mwessc wants to merge 2 commits intogoogle-labs-code:mainfrom
Conversation
This commit introduces a new system for performing basic threat modeling analysis on an application architecture.
Key features:
- **Application Architecture Definition:**
- `architecture.py` defines classes (`NetworkZone`, `Component`, `Service`, `Database`, `Application`) to represent an application's structure.
- Architectures can be loaded from YAML files using `load_architecture_from_yaml`.
- **Threat Modeling Components:**
- `threat_model.py` defines classes (`ThreatActor`, `AttackVector`, `Vulnerability`, `SecurityControl`, `IdentifiedAttackSurface`, `SuggestedControl`) for security analysis.
- **Analysis Logic:**
- `identify_attack_surfaces`: Analyzes an `Application` object 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`: Recommends `SecurityControl`s for `IdentifiedAttackSurface`s based on the vulnerabilities they aim to mitigate.
- **Examples & Documentation:**
- `example_architecture.yaml` provides a sample application architecture.
- `example_security_knowledge_base.yaml` demonstrates 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.md` has been updated with a section explaining the new features and how to use them, including a conceptual code example.
- **Unit Tests:**
- `tests/test_architecture.py` and `tests/test_threat_model.py` provide 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.
…g library. This includes richer data models for ThreatActor, AttackVector, Vulnerability, and SecurityControl; refined analysis functions; YAML loading for threat intelligence; and updated tests and examples.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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