Event: MindSprint 2K25 Hackathon
Team: DevOps Security Experts
Achievement: π₯ First Place - Security Innovation
DevOps Shield is a zero-trust security layer for CI/CD pipelines that combines advanced AI-powered threat detection with blockchain-backed immutability. The platform provides real-time fraud detection, supply chain security, and comprehensive risk intelligence from commit to release.
- Machine Learning Models for anomaly detection and pattern recognition
- Real-time Risk Scoring with configurable thresholds
- Behavioral Analysis for identifying suspicious activities
- Predictive Analytics for proactive threat prevention
- Source Integrity Scoring with cryptographic verification
- Dependency Whitelisting and vulnerability scanning
- Runner Verification and secure execution environments
- Multi-Layer Authentication and access controls
- Immutable Ledger for security events and transactions
- Smart Contract Integration for automated compliance
- Cryptographic Proofs for data integrity verification
- Decentralized Storage for audit trails
- Attack Scenarios including supply-chain, secret-leak, and rogue-runner drills
- Offline Capability with deterministic fallbacks
- Custom Threat Models and simulation parameters
- Performance Benchmarking and stress testing
- Real-time Dashboards with interactive visualizations
- Centralized Logging with structured data format
- WebSocket Streaming for live updates
- Performance Metrics and health monitoring
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β π Frontend (React 18) β
β βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ β
β β Dashboard β β Simulation Lab β β Security UI β β
β β - Real-time β β - Attack Sims β β - Risk Scores β β
β β - Analytics β β - Threat Modelsβ β - Zero Trust β β
β βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β π§ Backend (FastAPI) β
β βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ β
β β API Gateway β β Security Core β β AI/ML Engine β β
β β - REST APIs β β - Zero Trust β β - Anomaly Det. β β
β β - WebSocket β β - Risk Engine β β - Pattern Rec. β β
β βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ β
β βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ β
β β Middleware β β Services β β Utils β β
β β - Rate Limiter β β - Blockchain β β - Logger β β
β β - Auth β β - Database β β - Validators β β
β βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β ποΈ Infrastructure Layer β
β βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ β
β β Blockchain β β Database β β Storage β β
β β - Ethereum β β - PostgreSQL β β - File System β β
β β - Smart Contractsβ β - Redis Cache β β - Cloud Storage β β
β βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
devops-shield/
βββ π frontend/ # React 18 Frontend Application
β βββ π public/
β β βββ π index.html # Enhanced HTML with SEO & Accessibility
β β βββ π manifest.json # PWA Manifest
β β βββ π assets/ # Static assets (icons, images)
β βββ π src/
β β βββ π App.jsx # Main React application
β β βββ π pages/ # Application pages
β β β βββ π Dashboard.jsx # Security dashboard
β β β βββ π Simulation.jsx # Attack simulation lab
β β β βββ π Security.jsx # Security configuration
β β β βββ π Analytics.jsx # Analytics and reporting
β β βββ π components/ # Reusable UI components
β β β βββ π SecurityCard.jsx # Security metric cards
β β β βββ π ThreatChart.jsx # Threat visualization
β β β βββ π AlertPanel.jsx # Alert management
β β βββ π services/ # API and business logic
β β β βββ π apiClient.js # HTTP client with error handling
β β β βββ π zeroTrustService.js # Zero-trust API integration
β β β βββ π websocketService.js # Real-time updates
β β βββ π utils/ # Utility functions
β βββ π package.json # Frontend dependencies
β βββ π Dockerfile # Frontend container
β
βββ π backend/ # FastAPI Backend Application
β βββ π main.py # Application entry point
β βββ π start.sh # Startup script
β βββ π requirements.txt # Python dependencies
β βββ π src/
β β βββ π api/ # API routers
β β β βββ π simulate.py # Attack simulation endpoints
β β β βββ π fraud.py # Fraud detection endpoints
β β β βββ π alerts.py # Alert management
β β β βββ π zero_trust.py # Zero-trust controls
β β β βββ π analytics.py # Analytics and reporting
β β βββ π core/ # Core security logic
β β β βββ π fraud_engine.py # Fraud detection engine
β β β βββ π anomaly_detector.py # ML-based anomaly detection
β β β βββ π risk_scorer.py # Risk scoring algorithms
β β β βββ π threat_models.py # Threat modeling
β β βββ π security/ # Security orchestrator
β β β βββ π zero_trust.py # Zero-trust implementation
β β β βββ π pipeline_guard.py # Pipeline security
β β β βββ π access_control.py # Access management
β β βββ π services/ # External services
β β β βββ π blockchain.py # Blockchain integration
β β β βββ π database.py # Database operations
β β β βββ π email.py # Email notifications
β β β βββ π slack.py # Slack integration
β β βββ π middleware/ # Custom middleware
β β β βββ π rate_limiter.py # DoS protection
β β β βββ π auth.py # Authentication
β β β βββ π logging.py # Request logging
β β βββ π utils/ # Utilities
β β βββ π config.py # Configuration management
β β βββ π logger.py # Structured logging
β β βββ π validators.py # Input validation
β β βββ π threat_signatures.py # Threat patterns
β βββ π Dockerfile # Backend container
β
βββ π infra/ # Infrastructure as Code
β βββ π docker/
β β βββ π backend.Dockerfile # Backend container definition
β β βββ π frontend.Dockerfile # Frontend container definition
β β βββ π docker-compose.yml # Multi-container setup
β βββ π railway.toml # Railway deployment config
β βββ π Dockerfile # All-in-one container
β
βββ π docs/ # Documentation
β βββ π API.md # API documentation
β βββ π SECURITY.md # Security architecture
β βββ π DEPLOYMENT.md # Deployment guide
β βββ π CONTRIBUTING.md # Contributing guidelines
β
βββ π README.md # Project documentation
βββ π .gitignore # Git ignore rules
βββ π LICENSE # MIT License
- Docker & Docker Compose
- Node.js 16+ for frontend development
- Python 3.9+ for backend development
- Ethereum wallet (for blockchain features)
-
π½ Clone Repository
git clone https://github.com/yourusername/devops-shield.git cd devops-shield -
π³ Docker Compose Setup
# Start all services docker-compose up -d # View logs docker-compose logs -f # Stop services docker-compose down
-
π§ Manual Setup (Optional)
# Backend setup cd backend python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate pip install -r requirements.txt ./start.sh # Frontend setup (new terminal) cd frontend npm install npm start
- Frontend Dashboard: http://localhost:3000
- Backend API: http://localhost:8000
- API Documentation: http://localhost:8000/docs
- Health Check: http://localhost:8000/api/health
# Database Configuration
DATABASE_URL=postgresql://user:password@localhost:5432/devops_shield
REDIS_URL=redis://localhost:6379
# Security Configuration
SECRET_KEY=your-secret-key-here
JWT_SECRET_KEY=your-jwt-secret-key
BLOCKCHAIN_ENABLED=true
ETHEREUM_RPC_URL=https://mainnet.infura.io/v3/YOUR-PROJECT-ID
# External Services
SLACK_WEBHOOK_URL=https://hooks.slack.com/services/YOUR/SLACK/WEBHOOK
EMAIL_SMTP_HOST=smtp.gmail.com
EMAIL_SMTP_PORT=587
EMAIL_USERNAME=your-email@gmail.com
EMAIL_PASSWORD=your-app-password
# Development Settings
DEBUG=false
LOG_LEVEL=INFO
RATE_LIMIT_PER_MINUTE=100# API Configuration
REACT_APP_API_URL=http://localhost:8000
REACT_APP_WS_URL=ws://localhost:8000/ws
# Feature Flags
REACT_APP_ENABLE_BLOCKCHAIN=true
REACT_APP_ENABLE_SIMULATIONS=true
REACT_APP_ENABLE_ANALYTICS=true
# UI Configuration
REACT_APP_THEME=dark
REACT_APP_REFRESH_INTERVAL=5000# Cryptographic hash verification for source code
def verify_source_integrity(commit_hash: str, expected_hash: str) -> bool:
calculated_hash = sha256(commit_hash.encode()).hexdigest()
return calculated_hash == expected_hash# Automated vulnerability scanning for dependencies
def scan_dependencies(dependencies: List[str]) -> SecurityReport:
vulnerabilities = []
for dep in dependencies:
vuln = check_vulnerability_database(dep)
if vuln.severity >= Severity.MEDIUM:
vulnerabilities.append(vuln)
return SecurityReport(vulnerabilities)# Multi-factor authentication for pipeline execution
def authenticate_pipeline_execution(pipeline_id: str, credentials: Credentials) -> bool:
# Verify multiple authentication factors
return verify_api_key(credentials.api_key) and \
verify_jwt_token(credentials.jwt_token) and \
verify_blockchain_signature(credentials.signature)# Machine learning-based anomaly detection
class AnomalyDetector:
def __init__(self):
self.model = IsolationForest(contamination=0.1)
self.scaler = StandardScaler()
def detect_anomalies(self, metrics: List[Dict]) -> List[Anomaly]:
features = self.extract_features(metrics)
scaled_features = self.scaler.transform(features)
predictions = self.model.predict(scaled_features)
anomalies = []
for i, pred in enumerate(predictions):
if pred == -1: # Anomaly detected
anomalies.append(Anomaly(
timestamp=metrics[i]['timestamp'],
severity=self.calculate_severity(metrics[i]),
description=self.generate_description(metrics[i])
))
return anomalies# Comprehensive risk scoring system
def calculate_risk_score(event: SecurityEvent) -> RiskScore:
factors = {
'severity': event.severity * 0.3,
'frequency': event.frequency * 0.2,
'impact': event.impact * 0.25,
'likelihood': event.likelihood * 0.15,
'mitigation': event.mitigation * 0.1
}
base_score = sum(factors.values())
# Apply contextual modifiers
if event.source == 'external':
base_score *= 1.2
if event.time_of_day in ['night', 'weekend']:
base_score *= 1.1
return RiskScore(
score=min(base_score, 100),
level=determine_risk_level(base_score),
recommendations=generate_recommendations(event)
)// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
contract DevOpsShield {
struct SecurityEvent {
uint256 timestamp;
string eventType;
address source;
bytes32 dataHash;
uint8 severity;
bool resolved;
}
mapping(bytes32 => SecurityEvent) public events;
mapping(address => uint256) public reputationScores;
event SecurityEventLogged(
bytes32 indexed eventId,
string eventType,
address indexed source,
uint8 severity
);
function logSecurityEvent(
string memory eventType,
bytes32 dataHash,
uint8 severity
) public returns (bytes32) {
bytes32 eventId = keccak256(
abi.encodePacked(block.timestamp, msg.sender, dataHash)
);
events[eventId] = SecurityEvent({
timestamp: block.timestamp,
eventType: eventType,
source: msg.sender,
dataHash: dataHash,
severity: severity,
resolved: false
});
emit SecurityEventLogged(eventId, eventType, msg.sender, severity);
return eventId;
}
function verifyEventIntegrity(
bytes32 eventId,
bytes memory data
) public view returns (bool) {
SecurityEvent memory event = events[eventId];
bytes32 computedHash = keccak256(data);
return event.dataHash == computedHash;
}
}# Blockchain transaction monitoring
class BlockchainMonitor:
def __init__(self, web3_provider: str):
self.web3 = Web3(HTTPProvider(web3_provider))
self.contract = self.web3.eth.contract(
address=CONTRACT_ADDRESS,
abi=CONTRACT_ABI
)
def get_security_events(self, from_block: int, to_block: int) -> List[Dict]:
events = self.contract.events.SecurityEventLogged.get_logs(
fromBlock=from_block,
toBlock=to_block
)
return [
{
'eventId': event.args.eventId.hex(),
'eventType': event.args.eventType,
'source': event.args.source,
'severity': event.args.severity,
'timestamp': event.args.timestamp
}
for event in events
]
def verify_chain_integrity(self) -> bool:
latest_block = self.web3.eth.block_number
block_hash = self.web3.eth.get_block(latest_block)['hash']
# Verify block hash against expected value
return self.verify_expected_hash(block_hash.hex())- Threat Detection Rate: Real-time monitoring of identified threats
- False Positive Rate: Accuracy measurement of detection algorithms
- Response Time: Average time from detection to resolution
- Risk Distribution: Visualization of risk levels across components
- API Response Time: Latency monitoring for all endpoints
- Database Performance: Query optimization and indexing effectiveness
- Blockchain Sync Time: Time to record and retrieve blockchain data
- System Resource Usage: CPU, memory, and network utilization
# Security trend analysis
class SecurityAnalytics:
def analyze_trends(self, time_range: str) -> TrendReport:
data = self.get_security_data(time_range)
return TrendReport(
threat_trends=self.calculate_threat_trends(data),
vulnerability_trends=self.calculate_vulnerability_trends(data),
compliance_trends=self.calculate_compliance_trends(data),
recommendations=self.generate_trend_recommendations(data)
)
def predict_future_threats(self) -> ThreatPrediction:
historical_data = self.get_historical_data(days=90)
model = self.train_prediction_model(historical_data)
return model.predict_next_period()# Automated compliance reporting
class ComplianceReporter:
def generate_compliance_report(self, standard: str) -> ComplianceReport:
requirements = self.get_compliance_requirements(standard)
current_state = self.assess_current_state(requirements)
return ComplianceReport(
standard=standard,
compliance_score=self.calculate_compliance_score(current_state),
gaps=self.identify_compliance_gaps(requirements, current_state),
remediation_plan=self.generate_remediation_plan(gaps),
audit_trail=self.generate_audit_trail()
)class SupplyChainSimulator:
def simulate_dependency_compromise(self, target_dependency: str) -> SimulationResult:
# Simulate compromised dependency
compromised_package = self.create_malicious_package(target_dependency)
# Test detection capabilities
detection_result = self.test_detection(compromised_package)
return SimulationResult(
scenario="Dependency Compromise",
detection_time=detection_result.time_to_detect,
impact_assessment=self.assess_impact(compromised_package),
mitigation_effectiveness=self.test_mitigation(compromised_package)
)class SecretLeakSimulator:
def simulate_secret_exposure(self, secret_type: str) -> SimulationResult:
# Simulate exposed secrets
exposed_secrets = self.generate_exposed_secrets(secret_type)
# Test detection and response
detection_result = self.test_secret_detection(exposed_secrets)
response_result = self.test_incident_response(exposed_secrets)
return SimulationResult(
scenario="Secret Leak",
secrets_exposed=len(exposed_secrets),
detection_rate=detection_result.detection_rate,
response_time=response_result.response_time,
data_breach_risk=self.assess_breach_risk(exposed_secrets)
)# docker-compose.yml
version: '3.8'
services:
frontend:
build:
context: ./frontend
dockerfile: Dockerfile
ports:
- "3000:3000"
environment:
- REACT_APP_API_URL=http://backend:8000
depends_on:
- backend
networks:
- devops-shield-network
backend:
build:
context: ./backend
dockerfile: Dockerfile
ports:
- "8000:8000"
environment:
- DATABASE_URL=postgresql://postgres:5432/devops_shield
- REDIS_URL=redis://redis:6379
- BLOCKCHAIN_ENABLED=true
depends_on:
- postgres
- redis
networks:
- devops-shield-network
postgres:
image: postgres:15
environment:
- POSTGRES_DB=devops_shield
- POSTGRES_USER=devops
- POSTGRES_PASSWORD=secure_password
volumes:
- postgres_data:/var/lib/postgresql/data
networks:
- devops-shield-network
redis:
image: redis:7-alpine
ports:
- "6379:6379"
networks:
- devops-shield-network
volumes:
postgres_data:
networks:
devops-shield-network:
driver: bridge# Production deployment with Railway
railway up
# Or with Docker Swarm
docker swarm init
docker stack deploy -c docker-compose.yml devops-shield# Deploy to AWS ECS
aws ecs create-cluster --cluster-name devops-shield
aws ecs register-task-definition --cli-input-json task-definition.json
aws ecs create-service --cluster devops-shield --service-name devops-shield-api# k8s-deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: devops-shield-backend
spec:
replicas: 3
selector:
matchLabels:
app: devops-shield
template:
metadata:
labels:
app: devops-shield
spec:
containers:
- name: backend
image: devops-shield/backend:latest
ports:
- containerPort: 8000
env:
- name: DATABASE_URL
valueFrom:
secretKeyRef:
name: devops-shield-secrets
key: database-url# Test fraud detection engine
class TestFraudEngine(unittest.TestCase):
def setUp(self):
self.engine = FraudEngine()
def test_anomaly_detection(self):
# Test with known anomaly patterns
anomalous_data = self.generate_anomalous_data()
result = self.engine.detect_fraud(anomalous_data)
self.assertTrue(result.is_fraud)
self.assertGreater(result.confidence, 0.8)
def test_normal_behavior(self):
# Test with normal behavior patterns
normal_data = self.generate_normal_data()
result = self.engine.detect_fraud(normal_data)
self.assertFalse(result.is_fraud)
self.assertLess(result.confidence, 0.3)# Test API integration
class TestAPIIntegration(unittest.TestCase):
def setUp(self):
self.client = TestClient(app)
def test_security_endpoint(self):
response = self.client.post('/api/security/scan',
json={'pipeline_id': 'test-123'})
self.assertEqual(response.status_code, 200)
self.assertIn('risk_score', response.json())
def test_blockchain_integration(self):
response = self.client.post('/api/blockchain/log-event',
json={'event_type': 'test', 'data': 'test-data'})
self.assertEqual(response.status_code, 201)
self.assertIn('transaction_hash', response.json())# Load testing with Locust
class SecurityAPILoadTest(HttpUser):
wait_time = between(1, 3)
def on_start(self):
self.client.post('/api/auth/login', json={
'username': 'test_user',
'password': 'test_password'
})
@task
def scan_pipeline(self):
self.client.get('/api/security/scan/pipeline-123')
@task
def check_threats(self):
self.client.get('/api/threats/active')- Bug Reports: GitHub Issues
- Feature Requests: GitHub Discussions
- Security Issues: security@devops-shield.com (private, for security vulnerabilities)
- API Documentation: https://docs.devops-shield.com/api
- Security Guide: https://docs.devops-shield.com/security
- Deployment Guide: https://docs.devops-shield.com/deployment
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add 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.
- MindSprint 2K25 Hackathon for the opportunity and platform
- FastAPI Team for the excellent web framework
- React Community for the amazing UI library
- Ethereum Foundation for blockchain infrastructure
- Open Source Contributors for tools and libraries