✓ Verified 💻 Development ✓ Enhanced Data

Senior Security

Security engineering toolkit for threat modeling, vulnerability analysis, secure architecture, and p

Rating
4 (158 reviews)
Downloads
32,127 downloads
Version
1.0.0

Overview

Security engineering toolkit for threat modeling, vulnerability analysis, secure architecture, and penetration.

Complete Documentation

View Source →

Senior Security Engineer

Security engineering tools for threat modeling, vulnerability analysis, secure architecture design, and penetration testing.


Table of Contents


Threat Modeling Workflow

Identify and analyze security threats using STRIDE methodology.

Workflow: Conduct Threat Model

  • Define system scope and boundaries:
  • Identify assets to protect
  • Map trust boundaries
  • Document data flows
  • Create data flow diagram:
  • External entities (users, services)
  • Processes (application components)
  • Data stores (databases, caches)
  • Data flows (APIs, network connections)
  • Apply STRIDE to each DFD element (see STRIDE per Element Matrix below)
  • Score risks using DREAD:
  • Damage potential (1-10)
  • Reproducibility (1-10)
  • Exploitability (1-10)
  • Affected users (1-10)
  • Discoverability (1-10)
  • Prioritize threats by risk score
  • Define mitigations for each threat
  • Document in threat model report
  • Validation: All DFD elements analyzed; STRIDE applied; threats scored; mitigations mapped

STRIDE Threat Categories

CategorySecurity PropertyMitigation Focus
SpoofingAuthenticationMFA, certificates, strong auth
TamperingIntegritySigning, checksums, validation
RepudiationNon-repudiationAudit logs, digital signatures
Information DisclosureConfidentialityEncryption, access controls
Denial of ServiceAvailabilityRate limiting, redundancy
Elevation of PrivilegeAuthorizationRBAC, least privilege

STRIDE per Element Matrix

DFD ElementSTRIDE
External EntityXX
ProcessXXXXXX
Data StoreXXXX
Data FlowXXX
See: references/threat-modeling-guide.md


Security Architecture Workflow

Design secure systems using defense-in-depth principles.

Workflow: Design Secure Architecture

  • Define security requirements:
  • Compliance requirements (GDPR, HIPAA, PCI-DSS)
  • Data classification (public, internal, confidential, restricted)
  • Threat model inputs
  • Apply defense-in-depth layers:
  • Perimeter: WAF, DDoS protection, rate limiting
  • Network: Segmentation, IDS/IPS, mTLS
  • Host: Patching, EDR, hardening
  • Application: Input validation, authentication, secure coding
  • Data: Encryption at rest and in transit
  • Implement Zero Trust principles:
  • Verify explicitly (every request)
  • Least privilege access (JIT/JEA)
  • Assume breach (segment, monitor)
  • Configure authentication and authorization:
  • Identity provider selection
  • MFA requirements
  • RBAC/ABAC model
  • Design encryption strategy:
  • Key management approach
  • Algorithm selection
  • Certificate lifecycle
  • Plan security monitoring:
  • Log aggregation
  • SIEM integration
  • Alerting rules
  • Document architecture decisions
  • Validation: Defense-in-depth layers defined; Zero Trust applied; encryption strategy documented; monitoring planned

Defense-in-Depth Layers

text
Layer 1: PERIMETER
  WAF, DDoS mitigation, DNS filtering, rate limiting

Layer 2: NETWORK
  Segmentation, IDS/IPS, network monitoring, VPN, mTLS

Layer 3: HOST
  Endpoint protection, OS hardening, patching, logging

Layer 4: APPLICATION
  Input validation, authentication, secure coding, SAST

Layer 5: DATA
  Encryption at rest/transit, access controls, DLP, backup

Authentication Pattern Selection

Use CaseRecommended Pattern
Web applicationOAuth 2.0 + PKCE with OIDC
API authenticationJWT with short expiration + refresh tokens
Service-to-servicemTLS with certificate rotation
CLI/AutomationAPI keys with IP allowlisting
High securityFIDO2/WebAuthn hardware keys
See: references/security-architecture-patterns.md


Vulnerability Assessment Workflow

Identify and remediate security vulnerabilities in applications.

Workflow: Conduct Vulnerability Assessment

  • Define assessment scope:
  • In-scope systems and applications
  • Testing methodology (black box, gray box, white box)
  • Rules of engagement
  • Gather information:
  • Technology stack inventory
  • Architecture documentation
  • Previous vulnerability reports
  • Perform automated scanning:
  • SAST (static analysis)
  • DAST (dynamic analysis)
  • Dependency scanning
  • Secret detection
  • Conduct manual testing:
  • Business logic flaws
  • Authentication bypass
  • Authorization issues
  • Injection vulnerabilities
  • Classify findings by severity:
  • Critical: Immediate exploitation risk
  • High: Significant impact, easier to exploit
  • Medium: Moderate impact or difficulty
  • Low: Minor impact
  • Develop remediation plan:
  • Prioritize by risk
  • Assign owners
  • Set deadlines
  • Verify fixes and document
  • Validation: Scope defined; automated and manual testing complete; findings classified; remediation tracked
For OWASP Top 10 vulnerability descriptions and testing guidance, refer to owasp.org/Top10.

Vulnerability Severity Matrix

Impact \ ExploitabilityEasyModerateDifficult
CriticalCriticalCriticalHigh
HighCriticalHighMedium
MediumHighMediumLow
LowMediumLowLow

Secure Code Review Workflow

Review code for security vulnerabilities before deployment.

Workflow: Conduct Security Code Review

  • Establish review scope:
  • Changed files and functions
  • Security-sensitive areas (auth, crypto, input handling)
  • Third-party integrations
  • Run automated analysis:
  • SAST tools (Semgrep, CodeQL, Bandit)
  • Secret scanning
  • Dependency vulnerability check
  • Review authentication code:
  • Password handling (hashing, storage)
  • Session management
  • Token validation
  • Review authorization code:
  • Access control checks
  • RBAC implementation
  • Privilege boundaries
  • Review data handling:
  • Input validation
  • Output encoding
  • SQL query construction
  • File path handling
  • Review cryptographic code:
  • Algorithm selection
  • Key management
  • Random number generation
  • Document findings with severity
  • Validation: Automated scans passed; auth/authz reviewed; data handling checked; crypto verified; findings documented

Security Code Review Checklist

CategoryCheckRisk
Input ValidationAll user input validated and sanitizedInjection
Output EncodingContext-appropriate encoding appliedXSS
AuthenticationPasswords hashed with Argon2/bcryptCredential theft
SessionSecure cookie flags set (HttpOnly, Secure, SameSite)Session hijacking
AuthorizationServer-side permission checks on all endpointsPrivilege escalation
SQLParameterized queries used exclusivelySQL injection
File AccessPath traversal sequences rejectedPath traversal
SecretsNo hardcoded credentials or keysInformation disclosure
DependenciesKnown vulnerable packages updatedSupply chain
LoggingSensitive data not loggedInformation disclosure

Secure vs Insecure Patterns

PatternIssueSecure Alternative
SQL string formattingSQL injectionUse parameterized queries with placeholders
Shell command buildingCommand injectionUse subprocess with argument lists, no shell
Path concatenationPath traversalValidate and canonicalize paths
MD5/SHA1 for passwordsWeak hashingUse Argon2id or bcrypt
Math.random for tokensPredictable valuesUse crypto.getRandomValues

Inline Code Examples

SQL Injection — insecure vs. secure (Python):

python
# ❌ Insecure: string formatting allows SQL injection
query = f"SELECT * FROM users WHERE username = '{username}'"
cursor.execute(query)

# ✅ Secure: parameterized query — user input never interpreted as SQL
query = "SELECT * FROM users WHERE username = %s"
cursor.execute(query, (username,))

Password Hashing with Argon2id (Python):

python
from argon2 import PasswordHasher

ph = PasswordHasher()          # uses secure defaults (time_cost, memory_cost)

# On registration
hashed = ph.hash(plain_password)

# On login — raises argon2.exceptions.VerifyMismatchError on failure
ph.verify(hashed, plain_password)

Secret Scanning — core pattern matching (Python):

python
import re, pathlib

SECRET_PATTERNS = {
    "aws_access_key":  re.compile(r"AKIA[0-9A-Z]{16}"),
    "github_token":    re.compile(r"ghp_[A-Za-z0-9]{36}"),
    "private_key":     re.compile(r"-----BEGIN (RSA |EC )?PRIVATE KEY-----"),
    "generic_secret":  re.compile(r'(?i)(password|secret|api_key)\s*=\s*["\']?\S{8,}'),
}

def scan_file(path: pathlib.Path) -> list[dict]:
    findings = []
    for lineno, line in enumerate(path.read_text(errors="replace").splitlines(), 1):
        for name, pattern in SECRET_PATTERNS.items():
            if pattern.search(line):
                findings.append({"file": str(path), "line": lineno, "type": name})
    return findings


Incident Response Workflow

Respond to and contain security incidents.

Workflow: Handle Security Incident

  • Identify and triage:
  • Validate incident is genuine
  • Assess initial scope and severity
  • Activate incident response team
  • Contain the threat:
  • Isolate affected systems
  • Block malicious IPs/accounts
  • Disable compromised credentials
  • Eradicate root cause:
  • Remove malware/backdoors
  • Patch vulnerabilities
  • Update configurations
  • Recover operations:
  • Restore from clean backups
  • Verify system integrity
  • Monitor for recurrence
  • Conduct post-mortem:
  • Timeline reconstruction
  • Root cause analysis
  • Lessons learned
  • Implement improvements:
  • Update detection rules
  • Enhance controls
  • Update runbooks
  • Document and report
  • Validation: Threat contained; root cause eliminated; systems recovered; post-mortem complete; improvements implemented

Incident Severity Levels

LevelResponse TimeEscalation
P1 - Critical (active breach/exfiltration)ImmediateCISO, Legal, Executive
P2 - High (confirmed, contained)1 hourSecurity Lead, IT Director
P3 - Medium (potential, under investigation)4 hoursSecurity Team
P4 - Low (suspicious, low impact)24 hoursOn-call engineer

Incident Response Checklist

PhaseActions
IdentificationValidate alert, assess scope, determine severity
ContainmentIsolate systems, preserve evidence, block access
EradicationRemove threat, patch vulnerabilities, reset credentials
RecoveryRestore services, verify integrity, increase monitoring
Lessons LearnedDocument timeline, identify gaps, update procedures

Security Tools Reference

Recommended Security Tools

CategoryTools
SASTSemgrep, CodeQL, Bandit (Python), ESLint security plugins
DASTOWASP ZAP, Burp Suite, Nikto
Dependency ScanningSnyk, Dependabot, npm audit, pip-audit
Secret DetectionGitLeaks, TruffleHog, detect-secrets
Container SecurityTrivy, Clair, Anchore
InfrastructureCheckov, tfsec, ScoutSuite
NetworkWireshark, Nmap, Masscan
PenetrationMetasploit, sqlmap, Burp Suite Pro

Cryptographic Algorithm Selection

Use CaseAlgorithmKey Size
Symmetric encryptionAES-256-GCM256 bits
Password hashingArgon2idN/A (use defaults)
Message authenticationHMAC-SHA256256 bits
Digital signaturesEd25519256 bits
Key exchangeX25519256 bits
TLSTLS 1.3N/A
See: references/cryptography-implementation.md


Tools and References

Scripts

ScriptPurpose
threat_modeler.pySTRIDE threat analysis with DREAD risk scoring; JSON and text output; interactive guided mode
secret_scanner.pyDetect hardcoded secrets and credentials across 20+ patterns; CI/CD integration ready
For usage, see the inline code examples in Secure Code Review Workflow and the script source files directly.

References

DocumentContent
security-architecture-patterns.mdZero Trust, defense-in-depth, authentication patterns, API security
threat-modeling-guide.mdSTRIDE methodology, attack trees, DREAD scoring, DFD creation
cryptography-implementation.mdAES-GCM, RSA, Ed25519, password hashing, key management

Security Standards Reference

Security Headers Checklist

HeaderRecommended Value
Content-Security-Policydefault-src self; script-src self
X-Frame-OptionsDENY
X-Content-Type-Optionsnosniff
Strict-Transport-Securitymax-age=31536000; includeSubDomains
Referrer-Policystrict-origin-when-cross-origin
Permissions-Policygeolocation=(), microphone=(), camera=()
For compliance framework requirements (OWASP ASVS, CIS Benchmarks, NIST CSF, PCI-DSS, HIPAA, SOC 2), refer to the respective official documentation.


Related Skills

SkillIntegration Point
senior-devopsCI/CD security, infrastructure hardening
senior-secopsSecurity monitoring, incident response
senior-backendSecure API development
senior-architectSecurity architecture decisions

Installation

Terminal bash

openclaw install senior-security
    
Copied!

💻Code Examples

Encryption at rest/transit, access controls, DLP, backup

-encryption-at-resttransit-access-controls-dlp-backup.txt
### Authentication Pattern Selection

| Use Case | Recommended Pattern |
|----------|---------------------|
| Web application | OAuth 2.0 + PKCE with OIDC |
| API authentication | JWT with short expiration + refresh tokens |
| Service-to-service | mTLS with certificate rotation |
| CLI/Automation | API keys with IP allowlisting |
| High security | FIDO2/WebAuthn hardware keys |

See: [references/security-architecture-patterns.md](references/security-architecture-patterns.md)

---

## Vulnerability Assessment Workflow

Identify and remediate security vulnerabilities in applications.

### Workflow: Conduct Vulnerability Assessment

1. Define assessment scope:
   - In-scope systems and applications
   - Testing methodology (black box, gray box, white box)
   - Rules of engagement
2. Gather information:
   - Technology stack inventory
   - Architecture documentation
   - Previous vulnerability reports
3. Perform automated scanning:
   - SAST (static analysis)
   - DAST (dynamic analysis)
   - Dependency scanning
   - Secret detection
4. Conduct manual testing:
   - Business logic flaws
   - Authentication bypass
   - Authorization issues
   - Injection vulnerabilities
5. Classify findings by severity:
   - Critical: Immediate exploitation risk
   - High: Significant impact, easier to exploit
   - Medium: Moderate impact or difficulty
   - Low: Minor impact
6. Develop remediation plan:
   - Prioritize by risk
   - Assign owners
   - Set deadlines
7. Verify fixes and document
8. **Validation:** Scope defined; automated and manual testing complete; findings classified; remediation tracked

For OWASP Top 10 vulnerability descriptions and testing guidance, refer to [owasp.org/Top10](https://owasp.org/Top10).

### Vulnerability Severity Matrix

| Impact \ Exploitability | Easy | Moderate | Difficult |
|-------------------------|------|----------|-----------|
| Critical | Critical | Critical | High |
| High | Critical | High | Medium |
| Medium | High | Medium | Low |
| Low | Medium | Low | Low |

---

## Secure Code Review Workflow

Review code for security vulnerabilities before deployment.

### Workflow: Conduct Security Code Review

1. Establish review scope:
   - Changed files and functions
   - Security-sensitive areas (auth, crypto, input handling)
   - Third-party integrations
2. Run automated analysis:
   - SAST tools (Semgrep, CodeQL, Bandit)
   - Secret scanning
   - Dependency vulnerability check
3. Review authentication code:
   - Password handling (hashing, storage)
   - Session management
   - Token validation
4. Review authorization code:
   - Access control checks
   - RBAC implementation
   - Privilege boundaries
5. Review data handling:
   - Input validation
   - Output encoding
   - SQL query construction
   - File path handling
6. Review cryptographic code:
   - Algorithm selection
   - Key management
   - Random number generation
7. Document findings with severity
8. **Validation:** Automated scans passed; auth/authz reviewed; data handling checked; crypto verified; findings documented

### Security Code Review Checklist

| Category | Check | Risk |
|----------|-------|------|
| Input Validation | All user input validated and sanitized | Injection |
| Output Encoding | Context-appropriate encoding applied | XSS |
| Authentication | Passwords hashed with Argon2/bcrypt | Credential theft |
| Session | Secure cookie flags set (HttpOnly, Secure, SameSite) | Session hijacking |
| Authorization | Server-side permission checks on all endpoints | Privilege escalation |
| SQL | Parameterized queries used exclusively | SQL injection |
| File Access | Path traversal sequences rejected | Path traversal |
| Secrets | No hardcoded credentials or keys | Information disclosure |
| Dependencies | Known vulnerable packages updated | Supply chain |
| Logging | Sensitive data not logged | Information disclosure |

### Secure vs Insecure Patterns

| Pattern | Issue | Secure Alternative |
|---------|-------|-------------------|
| SQL string formatting | SQL injection | Use parameterized queries with placeholders |
| Shell command building | Command injection | Use subprocess with argument lists, no shell |
| Path concatenation | Path traversal | Validate and canonicalize paths |
| MD5/SHA1 for passwords | Weak hashing | Use Argon2id or bcrypt |
| Math.random for tokens | Predictable values | Use crypto.getRandomValues |

### Inline Code Examples

**SQL Injection — insecure vs. secure (Python):**
example.txt
Layer 1: PERIMETER
  WAF, DDoS mitigation, DNS filtering, rate limiting

Layer 2: NETWORK
  Segmentation, IDS/IPS, network monitoring, VPN, mTLS

Layer 3: HOST
  Endpoint protection, OS hardening, patching, logging

Layer 4: APPLICATION
  Input validation, authentication, secure coding, SAST

Layer 5: DATA
  Encryption at rest/transit, access controls, DLP, backup
example.py
# ❌ Insecure: string formatting allows SQL injection
query = f"SELECT * FROM users WHERE username = '{username}'"
cursor.execute(query)

# ✅ Secure: parameterized query — user input never interpreted as SQL
query = "SELECT * FROM users WHERE username = %s"
cursor.execute(query, (username,))
example.py
from argon2 import PasswordHasher

ph = PasswordHasher()          # uses secure defaults (time_cost, memory_cost)

# On registration
hashed = ph.hash(plain_password)

# On login — raises argon2.exceptions.VerifyMismatchError on failure
ph.verify(hashed, plain_password)
example.py
import re, pathlib

SECRET_PATTERNS = {
    "aws_access_key":  re.compile(r"AKIA[0-9A-Z]{16}"),
    "github_token":    re.compile(r"ghp_[A-Za-z0-9]{36}"),
    "private_key":     re.compile(r"-----BEGIN (RSA |EC )?PRIVATE KEY-----"),
    "generic_secret":  re.compile(r'(?i)(password|secret|api_key)\s*=\s*["\']?\S{8,}'),
}

def scan_file(path: pathlib.Path) -> list[dict]:
    findings = []
    for lineno, line in enumerate(path.read_text(errors="replace").splitlines(), 1):
        for name, pattern in SECRET_PATTERNS.items():
            if pattern.search(line):
                findings.append({"file": str(path), "line": lineno, "type": name})
    return findings

Tags

#coding_agents-and-ides #security

Quick Info

Category Development
Model Claude 3.5
Complexity One-Click
Author alirezarezvani
Last Updated 3/10/2026
🚀
Optimized for
Claude 3.5
🧠

Ready to Install?

Get started with this skill in seconds

openclaw install senior-security