ThreatShield is a comprehensive AI-powered threat modeling platform designed to assist security engineers in identifying, analyzing, and mitigating potential security threats. Leveraging OpenAI's advanced language models, ThreatShield transforms security assessment workflows with intelligent automation and insightful visualizations.
If you find ThreatShield useful, please consider starring the repository on GitHub. This helps more people discover the tool. Your support is greatly appreciated! β
- RAG-powered Analysis: Process and analyze technical documentation, architecture diagrams, and security requirements
- Confluence Integration: Direct import from Confluence spaces for seamless workflow
- PDF Processing: Extract and analyze content from PDF documents
- Image Analysis: Extract architecture information from diagrams and flowcharts
- AI-driven Threat Modeling: Generate comprehensive threat models based on application details
- DREAD Risk Assessment: Quantify risks using the DREAD methodology (Damage, Reproducibility, Exploitability, Affected users, Discoverability)
- Attack Tree Visualization: Interactive attack trees to visualize potential attack paths
- Mitigation Strategies: AI-generated recommendations for addressing identified threats
- Security Test Cases: Automated generation of security test cases to verify mitigations
- Natural Language Chat: Interact with your security data using natural language queries
- Custom Prompting: Tailor the analysis with custom security requirements
- Report History: Access and manage previous security assessments
- Analytics Dashboard: Visualize security metrics and insights
- Python 3.8+
- Node.js 14+ (for the frontend)
- OpenAI API key
-
Clone the Repository:
git clone https://github.com/threatshield/threatshield.git cd ThreatShield -
Install Backend Dependencies:
pip install -r requirements.txt
-
Configure Environment Variables: Create a
.envfile in the root directory with the following variables:API Keys and Authentication
OPENAI_API_KEY=your_openai_api_key CONFLUENCE_API_KEY=your_confluence_api_key CONFLUENCE_USERNAME=your_confluence_username SLACK_API_TOKEN=your_slack_bot_tokenLLM Provider Configuration
LLM_METHOD=OPENAI # Change to BEDROCK when using Bedrock**Bedrock Configuration (required when LLM_METHOD=BEDROCK)
BEDROCK_BASE_URL=your_bedrock_api_url BEDROCK_API_KEY=your_bedrock_api_key BEDROCK_MODEL=your_bedrock_model_name -
Start the Backend Server:
python app.py
-
Install and Run Frontend (optional, for development):
cd threat-shield npm install npm start
-
Clone the Repository:
git clone https://github.com/threatshield/threatshield.git cd ThreatShield -
Configure Environment Variables: Create a
.envfile in the root directory with the following variables:API Keys and Authentication
OPENAI_API_KEY=your_openai_api_key CONFLUENCE_API_KEY=your_confluence_api_key CONFLUENCE_USERNAME=your_confluence_username SLACK_API_TOKEN=your_slack_bot_tokenLLM Provider Configuration
LLM_METHOD=OPENAI # Change to BEDROCK when using BedrockBedrock Configuration (required when LLM_METHOD=BEDROCK)
BEDROCK_BASE_URL=your_bedrock_api_url BEDROCK_API_KEY=your_bedrock_api_key BEDROCK_MODEL=your_bedrock_model_name -
Build and Run with Docker Compose:
docker-compose up --build
This will:
- Build the backend Docker image (Python Flask on port 5001)
- Build the frontend Docker image (React on port 3000)
- Start both services in a shared network
- Create volumes for storage and uploads
-
Access the Application:
- Frontend: http://localhost:3000
- Backend API: http://localhost:5001
-
Stop the Services:
docker-compose down
Docker Compose Configuration Details:
- Backend Service: Runs on port 5001, mounts
./storageand./uploadsdirectories - Frontend Service: Runs on port 3000, depends on backend service
- Network: Both services communicate via
app-networkbridge network - Environment: Loads variables from
.envfile for backend, sets PORT=3000 for frontend
Note: ThreatShield requires the following OpenAI models to be enabled:
- gpt-4o: for threat modeling and analysis (any other reasoning model can also be used)
- text-embedding-3-large: for vector database creation
ThreatShield combines a Flask backend with a React frontend to deliver a seamless security assessment experience:
- Backend: Python/Flask API server with OpenAI integration
- Frontend: React with TypeScript and Tailwind CSS
- Document Processing: PDF mining and RAG (Retrieval Augmented Generation)
- Storage: File-based storage system for assessment data
app.py: Main application file that sets up the Flask server and routesllm/openai_module.py: OpenAI API integration for AI capabilitiesrag/rag_handler.py: Document processing and RAG implementationcore/: Core modules for security assessment functionalitythreat_modeling.py: Threat model generationdread.py: DREAD risk assessmentmitigation.py: Mitigation strategy generationattack_tree.py: Attack tree visualizationchat.py: Natural language interaction
utils/: Utility modules for configuration and document handlingthreat-shield/: React frontend application
POST /api/upload: Upload documents and images for processing
GET /api/threat-model: Generate a threat modelGET /api/dread-assessment: Generate a DREAD assessmentGET /api/attack-tree: Generate an attack treeGET /api/mitigations: Generate mitigation strategies
POST /api/query-ai: Query the AI with natural languageGET /api/storage: Access stored assessment data
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.