Skip to content

Security & Safety Summary

Quick Reference: What the Agent Will and Won't Do

✅ SAFE Operations (Agent Can Perform)

Read-Only (Always allowed):

  • Get logs and metrics
  • Describe resource status
  • List resources
  • Health checks
  • Diagnostic queries

Safe Actions (Requires approval):

  • Restart pods/services (graceful)
  • Scale resources UP (never down to 0)
  • Apply configuration changes
  • Create pull/merge requests
  • Retry failed builds
  • Rollback to known-good versions

⚠️ Dangerous Operations (Email Alert Only)

The agent will NEVER execute these. Instead, it sends email with manual commands:

  • Delete pods, deployments, services
  • Terminate instances
  • Drop databases or tables
  • Format disks
  • Remove files or directories
  • Scale to zero
  • Force operations
  • Modify security groups
  • Change firewall rules
  • Delete backups

🚫 Permanently Blocked

These patterns are hardcoded blocked:

kubectl delete
rm -rf
DROP DATABASE
aws ec2 terminate-instances
gcloud compute instances delete
az vm delete
--force-delete
--replicas=0

Email Notification System

When Emails Are Sent

  1. Dangerous Operation Detected

    Subject: [DevOps Agent] 🚨 MANUAL INTERVENTION REQUIRED
    Content: Manual commands provided for review
    

  2. Security Vulnerability Found

    Subject: [DevOps Agent] 🔒 SECURITY ALERT
    Content: Vulnerability details and remediation steps
    

  3. Compliance Violation

    Subject: [DevOps Agent] ⚠️ COMPLIANCE VIOLATION
    Content: Framework, violation type, remediation deadline
    

  4. Critical Incident (P0/P1)

    Subject: [DevOps Agent] 🚨 P1 INCIDENT
    Content: Impact, analysis, next steps
    

Configure Emails

# .env
EMAIL_ENABLED=true
EMAIL_TO=sre-team@company.com,oncall@company.com
EMAIL_CC=security@company.com

Test Configuration:

from tools.email_notifier import get_email_notifier

notifier = get_email_notifier()
notifier.test_email_configuration()

DevSecOps Features

Security Scanning

Automatically detects:

  • Privileged containers
  • Running as root user
  • Exposed secrets (passwords, API keys)
  • Unencrypted HTTP
  • Missing security contexts
  • Latest/unversioned tags
  • Debug mode in production
  • Overly permissive RBAC

Example:

{
  "type": "exposed_secret",
  "severity": "CRITICAL",
  "description": "API key found in ConfigMap",
  "recommendation": "Use Kubernetes Secret instead",
  "location": "configmap/app-config"
}

Compliance Frameworks

Supported:

  • CIS Kubernetes Benchmark
  • SOC 2
  • PCI-DSS
  • HIPAA
  • GDPR

Enable:

ENABLE_COMPLIANCE_CHECKS=true
COMPLIANCE_FRAMEWORKS=CIS,SOC2,PCI

Approval Workflow

┌─────────────────────────────────────────┐
│  Incident Detected                      │
└────────────┬────────────────────────────┘
             │
             ▼
┌─────────────────────────────────────────┐
│  Agent Analyzes Issue                   │
└────────────┬────────────────────────────┘
             │
             ▼
      Is it dangerous?
             │
        ┌────┴────┐
        │         │
       YES       NO
        │         │
        ▼         ▼
  ┌─────────┐ ┌──────────┐
  │ BLOCK   │ │ Is it    │
  │ Send    │ │ safe?    │
  │ Email   │ │          │
  └─────────┘ └────┬─────┘
                   │
              ┌────┴────┐
              │         │
             YES       NO
              │         │
              ▼         ▼
        ┌──────────┐ ┌─────────────┐
        │ Execute  │ │ Request     │
        │ (dry-run)│ │ Approval    │
        └────┬─────┘ └──────┬──────┘
             │              │
             ▼              ▼
        ┌──────────────────────┐
        │ Notify Team          │
        │ Update Audit Log     │
        └──────────────────────┘

Audit Trail

Every action is logged:

{
  "timestamp": "2026-06-12T15:30:00Z",
  "incident_id": "INC-123",
  "action_type": "dangerous_operation_blocked",
  "operation": "kubectl delete pod api-service",
  "reason": "Deletion is destructive",
  "severity": "HIGH",
  "email_sent": true,
  "email_recipients": ["sre-team@company.com"],
  "manual_commands_provided": [
    "kubectl describe pod api-service -n production",
    "# If needed: kubectl delete pod api-service -n production"
  ],
  "ai_reasoning": "Pod is crashing due to config error. Recommended to fix config first rather than delete.",
  "security_scan": {
    "performed": true,
    "findings": 0
  }
}

Emergency Procedures

Emergency Stop

Immediate shutdown:

# Via API
curl -X POST https://agent.company.com/emergency-stop \
  -H "Authorization: Bearer $ADMIN_TOKEN"

# Via environment variable
export AGENT_EMERGENCY_STOP=true

When to use:

  • Agent behaving unexpectedly
  • Security incident suspected
  • Need to pause all operations
  • Production emergency

Investigating Blocked Operations

# View all blocked operations
curl -H "Authorization: Bearer $API_TOKEN" https://agent.company.com/audit | jq '.[] | select(.action_type == "dangerous_operation_blocked")'

# Check email notification status
curl -H "Authorization: Bearer $API_TOKEN" https://agent.company.com/audit | jq '.[] | select(.email_sent == false)'

# Security findings
curl https://agent.company.com/security/findings

Configuration Checklist

Before deployment:

  • [ ] Set AUTO_APPLY=false
  • [ ] Configure email alerts (EMAIL_TO, EMAIL_CC)
  • [ ] Enable security scanning
  • [ ] Set compliance frameworks
  • [ ] Configure RBAC with minimal permissions
  • [ ] Test email configuration
  • [ ] Review SECURITY_POLICY.md
  • [ ] Set up audit log monitoring
  • [ ] Configure emergency stop access
  • [ ] Document incident response procedures

Monitoring

Key Metrics:

agent_dangerous_operations_blocked_total: 12
agent_emails_sent_total: 8
agent_security_findings_total{severity="CRITICAL"}: 2
agent_compliance_violations_total: 1
agent_safe_operations_executed_total: 156
agent_approval_requests_total: 24
agent_approvals_granted_total: 20

Alerts:

# Alert if dangerous operations are frequent
- alert: HighBlockedOperations
  expr: increase(agent_dangerous_operations_blocked_total[1h]) > 5

# Alert on critical security findings
- alert: CriticalSecurityFindings
  expr: agent_security_findings_total{severity="CRITICAL"} > 0

# Alert if emails aren't being sent
- alert: EmailDeliveryFailure
  expr: increase(agent_email_failed_total[5m]) > 0

Best Practices

  1. Start Conservative
  2. AUTO_APPLY=false
  3. Review all decisions for 2 weeks
  4. Gradually increase trust

  5. Monitor Closely

  6. Check audit logs daily
  7. Review blocked operations
  8. Investigate email alerts

  9. Security First

  10. Enable all security scanning
  11. Set up compliance checks
  12. Regular security audits

  13. Have a Plan

  14. Document emergency procedures
  15. Test emergency stop
  16. Practice incident response

  17. Keep Updated

  18. Review security policy monthly
  19. Update blocked patterns
  20. Refresh credentials regularly

Getting Help

  • Security Issues: security@yourcompany.com
  • Blocked Operation Questions: Review email for context
  • False Positives: Update security scanner rules
  • Emergencies: Use emergency stop, then investigate

Resources


Remember: The agent is designed to assist, not replace human judgment. When in doubt, it will always err on the side of caution and notify you.