Security Engineering
Comprehensive security engineering skill covering application security, infrastructure security, compliance, and incident response.
When to Use This Skill
- Designing security architecture
- Implementing authentication and authorization
- Conducting threat modeling
- Security code review
- Implementing compliance controls (SOC2, HIPAA, PCI-DSS)
- Incident response planning
- Security monitoring and alerting
Security Architecture
Defense in Depth
Layer security controls at multiple levels:
| Layer |
Controls |
| Perimeter |
Firewall, WAF, DDoS protection |
| Network |
Segmentation, IDS/IPS, VPN |
| Host |
Hardening, EDR, patch management |
| Application |
Input validation, secure coding, SAST/DAST |
| Data |
Encryption, access control, DLP |
| Identity |
MFA, SSO, privileged access management |
Zero Trust Architecture
Core Principles:
- Never trust, always verify
- Assume breach mentality
- Least privilege access
- Micro-segmentation
- Continuous verification
Implementation:
- Identity-based access (not network-based)
- Device health verification
- Continuous authentication
- Encrypted communications everywhere
- Detailed logging and monitoring
Authentication Patterns
OAuth 2.0 / OIDC
Grant Types:
| Grant |
Use Case |
| Authorization Code + PKCE |
Web/mobile apps |
| Client Credentials |
Service-to-service |
| Device Code |
CLI tools, IoT |
Token Best Practices:
- Short-lived access tokens (15 min - 1 hour)
- Secure refresh token storage
- Token rotation on use
- Revocation capabilities
Session Management
- Secure, HttpOnly, SameSite cookies
- Session timeout (idle and absolute)
- Session invalidation on logout
- Concurrent session limits
- Session binding to device/IP
Multi-Factor Authentication
- TOTP (authenticator apps)
- WebAuthn/FIDO2 (hardware keys)
- Push notifications
- SMS (last resort, vulnerable to SIM swap)
Authorization Patterns
RBAC (Role-Based Access Control)
Users → Roles → Permissions
Best for: Well-defined organizational hierarchies
ABAC (Attribute-Based Access Control)
If user.department == "engineering" AND
resource.classification == "internal" AND
time.hour BETWEEN 9 AND 17
THEN allow
Best for: Complex, dynamic access requirements
Policy as Code
Use OPA/Rego or Cedar for externalized policy:
- Version controlled policies
- Testable access rules
- Audit trail
- Separation of concerns
Secure Development
OWASP Top 10 Mitigations
| Risk |
Mitigation |
| Injection |
Parameterized queries, input validation |
| Broken Auth |
Strong password policy, MFA, rate limiting |
| Sensitive Data |
Encryption, minimal data collection |
| XXE |
Disable external entities |
| Broken Access |
Authorization checks, default deny |
| Misconfig |
Secure defaults, hardening guides |
| XSS |
Output encoding, CSP |
| Deserialization |
Integrity checks, avoid untrusted data |
| Components |
Dependency scanning, updates |
| Logging |
Centralized logging, alerting |
Security Testing
SAST (Static Analysis):
- Run on every commit
- Block high-severity findings
- Tools: Semgrep, CodeQL, SonarQube
DAST (Dynamic Analysis):
- Run against staging/dev
- Tools: OWASP ZAP, Burp Suite
Dependency Scanning:
- Check for known vulnerabilities
- Tools: Snyk, Dependabot, npm audit
Secrets Management
Never:
- Commit secrets to git
- Log secrets
- Pass secrets in URLs
- Hardcode secrets
Do:
- Use secret managers (Vault, AWS Secrets Manager)
- Rotate secrets regularly
- Audit secret access
- Use short-lived credentials
Compliance Frameworks
Common Requirements
| Framework |
Focus Area |
| SOC 2 |
Trust services (security, availability, etc.) |
| HIPAA |
Healthcare data protection |
| PCI-DSS |
Payment card data |
| GDPR |
EU personal data protection |
| ISO 27001 |
Information security management |
Key Controls
- Access control and authentication
- Encryption (at rest and in transit)
- Logging and monitoring
- Incident response procedures
- Business continuity planning
- Vendor management
- Employee security training
Incident Response
Response Phases
- Preparation: Runbooks, tools, training
- Detection: Monitoring, alerting, triage
- Containment: Isolate, preserve evidence
- Eradication: Remove threat, patch vulnerabilities
- Recovery: Restore services, verify clean
- Lessons Learned: Post-mortem, improvements
Severity Levels
| Level |
Description |
Response Time |
| P1 |
Active breach, data exfiltration |
Immediate |
| P2 |
Vulnerability being exploited |
< 4 hours |
| P3 |
High-risk vulnerability discovered |
< 24 hours |
| P4 |
Security improvement needed |
Next sprint |
Reference Files
references/threat_modeling.md - STRIDE methodology and examples
references/compliance_controls.md - Framework-specific control mappings
Integration with Other Skills
- cloud-infrastructure - For cloud security
- debugging - For security incident investigation
- testing - For security testing patterns
1---
2name: security-engineering
3description: Security architecture and implementation patterns. Use when designing
4 security controls, implementing authentication/authorization, conducting threat
5 modeling, or ensuring compliance with security frameworks.
6author: Joseph OBrien
7status: unpublished
8updated: '2025-12-23'
9version: 1.0.1
10tag: skill
11type: skill
12metadata:
13 source: https://skillmd.com/skills/aibot88/security-engineering
14---
15
16# Security Engineering
17
18Comprehensive security engineering skill covering application security, infrastructure security, compliance, and incident response.
19
20## When to Use This Skill
21
22- Designing security architecture
23- Implementing authentication and authorization
24- Conducting threat modeling
25- Security code review
26- Implementing compliance controls (SOC2, HIPAA, PCI-DSS)
27- Incident response planning
28- Security monitoring and alerting
29
30## Security Architecture
31
32### Defense in Depth
33
34Layer security controls at multiple levels:
35
36| Layer | Controls |
37|-------|----------|
38| Perimeter | Firewall, WAF, DDoS protection |
39| Network | Segmentation, IDS/IPS, VPN |
40| Host | Hardening, EDR, patch management |
41| Application | Input validation, secure coding, SAST/DAST |
42| Data | Encryption, access control, DLP |
43| Identity | MFA, SSO, privileged access management |
44
45### Zero Trust Architecture
46
47**Core Principles:**
48
491. Never trust, always verify
502. Assume breach mentality
513. Least privilege access
524. Micro-segmentation
535. Continuous verification
54
55**Implementation:**
56
57- Identity-based access (not network-based)
58- Device health verification
59- Continuous authentication
60- Encrypted communications everywhere
61- Detailed logging and monitoring
62
63## Authentication Patterns
64
65### OAuth 2.0 / OIDC
66
67**Grant Types:**
68
69| Grant | Use Case |
70|-------|----------|
71| Authorization Code + PKCE | Web/mobile apps |
72| Client Credentials | Service-to-service |
73| Device Code | CLI tools, IoT |
74
75**Token Best Practices:**
76
77- Short-lived access tokens (15 min - 1 hour)
78- Secure refresh token storage
79- Token rotation on use
80- Revocation capabilities
81
82### Session Management
83
84- Secure, HttpOnly, SameSite cookies
85- Session timeout (idle and absolute)
86- Session invalidation on logout
87- Concurrent session limits
88- Session binding to device/IP
89
90### Multi-Factor Authentication
91
92- TOTP (authenticator apps)
93- WebAuthn/FIDO2 (hardware keys)
94- Push notifications
95- SMS (last resort, vulnerable to SIM swap)
96
97## Authorization Patterns
98
99### RBAC (Role-Based Access Control)
100
101```
102Users → Roles → Permissions
103```
104
105Best for: Well-defined organizational hierarchies
106
107### ABAC (Attribute-Based Access Control)
108
109```
110If user.department == "engineering" AND
111 resource.classification == "internal" AND
112 time.hour BETWEEN 9 AND 17
113THEN allow
114```
115
116Best for: Complex, dynamic access requirements
117
118### Policy as Code
119
120Use OPA/Rego or Cedar for externalized policy:
121
122- Version controlled policies
123- Testable access rules
124- Audit trail
125- Separation of concerns
126
127## Secure Development
128
129### OWASP Top 10 Mitigations
130
131| Risk | Mitigation |
132|------|------------|
133| Injection | Parameterized queries, input validation |
134| Broken Auth | Strong password policy, MFA, rate limiting |
135| Sensitive Data | Encryption, minimal data collection |
136| XXE | Disable external entities |
137| Broken Access | Authorization checks, default deny |
138| Misconfig | Secure defaults, hardening guides |
139| XSS | Output encoding, CSP |
140| Deserialization | Integrity checks, avoid untrusted data |
141| Components | Dependency scanning, updates |
142| Logging | Centralized logging, alerting |
143
144### Security Testing
145
146**SAST (Static Analysis):**
147
148- Run on every commit
149- Block high-severity findings
150- Tools: Semgrep, CodeQL, SonarQube
151
152**DAST (Dynamic Analysis):**
153
154- Run against staging/dev
155- Tools: OWASP ZAP, Burp Suite
156
157**Dependency Scanning:**
158
159- Check for known vulnerabilities
160- Tools: Snyk, Dependabot, npm audit
161
162### Secrets Management
163
164**Never:**
165
166- Commit secrets to git
167- Log secrets
168- Pass secrets in URLs
169- Hardcode secrets
170
171**Do:**
172
173- Use secret managers (Vault, AWS Secrets Manager)
174- Rotate secrets regularly
175- Audit secret access
176- Use short-lived credentials
177
178## Compliance Frameworks
179
180### Common Requirements
181
182| Framework | Focus Area |
183|-----------|------------|
184| SOC 2 | Trust services (security, availability, etc.) |
185| HIPAA | Healthcare data protection |
186| PCI-DSS | Payment card data |
187| GDPR | EU personal data protection |
188| ISO 27001 | Information security management |
189
190### Key Controls
191
192- Access control and authentication
193- Encryption (at rest and in transit)
194- Logging and monitoring
195- Incident response procedures
196- Business continuity planning
197- Vendor management
198- Employee security training
199
200## Incident Response
201
202### Response Phases
203
2041. **Preparation**: Runbooks, tools, training
2052. **Detection**: Monitoring, alerting, triage
2063. **Containment**: Isolate, preserve evidence
2074. **Eradication**: Remove threat, patch vulnerabilities
2085. **Recovery**: Restore services, verify clean
2096. **Lessons Learned**: Post-mortem, improvements
210
211### Severity Levels
212
213| Level | Description | Response Time |
214|-------|-------------|---------------|
215| P1 | Active breach, data exfiltration | Immediate |
216| P2 | Vulnerability being exploited | < 4 hours |
217| P3 | High-risk vulnerability discovered | < 24 hours |
218| P4 | Security improvement needed | Next sprint |
219
220## Reference Files
221
222- **`references/threat_modeling.md`** - STRIDE methodology and examples
223- **`references/compliance_controls.md`** - Framework-specific control mappings
224
225## Integration with Other Skills
226
227- **cloud-infrastructure** - For cloud security
228- **debugging** - For security incident investigation
229- **testing** - For security testing patterns