Senior SecOps Engineer

Senior SecOps engineer skill for application security, vulnerability management, compliance verification, and secure development practices.

How to use it

Claude Code
  1. Run the line below. It pulls the whole folder into ~/.claude/skills/senior-secops, including the files SKILL.md points to.
  2. Describe your job in plain words. Claude Code follows the skill from there.
Claude Code — installs the whole folder, not just SKILL.md
npx degit alirezarezvani/claude-skills/engineering-team/skills/senior-secops#main ~/.claude/skills/senior-secops

For one project only, change the path to .claude/skills/senior-secops. This skill also uses report.json, vulns.json, package.json, package-lock.json, requirements.txt, compliance.json — copying SKILL.md alone won't be enough. See the folder on GitHub.

Claude (web or desktop app)
  1. On this page open ⋯ → Download .md.
  2. Save it as SKILL.md in a folder, zip the folder, then Customize → Skills → + → Create skill → Upload a skill.
  3. Pick the file and Save. Claude shows the name and description and runs a security scan.
  4. Check the skill is switched on.
  5. Start a new chat and describe your job in plain words. The AI follows the skill from there.
ChatGPT or another app
  1. ChatGPT: make a Project and paste it into Instructions.
  2. Neither? Paste it at the top of a new chat — it works for that chat.
Not working?
  • Check which app you pasted it into — the steps above name the right one.
  • Some skills need the paid tier of Claude or ChatGPT.
Step-by-step guide with screenshots · Ask in the forum

Paste into Claude, ChatGPT or Cursor.

Source of Senior SecOps Engineer

Show the full text506 lines
namedescription
senior-secopsSenior SecOps engineer skill for application security, vulnerability management, compliance verification, and secure development practices. Runs SAST/DAST scans, generates CVE remediation plans, checks dependency vulnerabilities, creates security policies, enforces secure coding patterns, and automates compliance checks against SOC2, PCI-DSS, HIPAA, and GDPR. Use when conducting a security review or audit, responding to a CVE or security incident, hardening infrastructure, implementing authentication or secrets management, running penetration test prep, checking OWASP Top 10 exposure, or enforcing security controls in CI/CD pipelines.

Senior SecOps Engineer

Complete toolkit for Security Operations including vulnerability management, compliance verification, secure coding practices, and security automation.


Table of Contents


Core Capabilities

1. Security Scanner

Scan source code for security vulnerabilities including hardcoded secrets, SQL injection, XSS, command injection, and path traversal.

# Scan project for security issues
python scripts/security_scanner.py /path/to/project

# Filter by severity
python scripts/security_scanner.py /path/to/project --severity high

# JSON output for CI/CD
python scripts/security_scanner.py /path/to/project --json --output report.json

Detects:

  • Hardcoded secrets (API keys, passwords, AWS credentials, GitHub tokens, private keys)
  • SQL injection patterns (string concatenation, f-strings, template literals)
  • XSS vulnerabilities (innerHTML assignment, unsafe DOM manipulation, React unsafe patterns)
  • Command injection (shell=True, exec, eval with user input)
  • Path traversal (file operations with user input)
2. Vulnerability Assessor

Scan dependencies for known CVEs across npm, Python, and Go ecosystems.

# Assess project dependencies
python scripts/vulnerability_assessor.py /path/to/project

# Critical/high only
python scripts/vulnerability_assessor.py /path/to/project --severity high

# Export vulnerability report
python scripts/vulnerability_assessor.py /path/to/project --json --output vulns.json

Scans:

  • package.json and package-lock.json (npm)
  • requirements.txt and pyproject.toml (Python)
  • go.mod (Go)

Output:

  • CVE IDs with CVSS scores
  • Affected package versions
  • Fixed versions for remediation
  • Overall risk score (0-100)
3. Compliance Checker

Verify security compliance against SOC 2, PCI-DSS, HIPAA, and GDPR frameworks.

# Check all frameworks
python scripts/compliance_checker.py /path/to/project

# Specific framework
python scripts/compliance_checker.py /path/to/project --framework soc2
python scripts/compliance_checker.py /path/to/project --framework pci-dss
python scripts/compliance_checker.py /path/to/project --framework hipaa
python scripts/compliance_checker.py /path/to/project --framework gdpr

# Export compliance report
python scripts/compliance_checker.py /path/to/project --json --output compliance.json

Verifies:

  • Access control implementation
  • Encryption at rest and in transit
  • Audit logging
  • Authentication strength (MFA, password hashing)
  • Security documentation
  • CI/CD security controls

Workflows

Workflow 1: Security Audit

Complete security assessment of a codebase.

# Step 1: Scan for code vulnerabilities
python scripts/security_scanner.py . --severity medium
# STOP if exit code 2 — resolve critical findings before continuing
# Step 2: Check dependency vulnerabilities
python scripts/vulnerability_assessor.py . --severity high
# STOP if exit code 2 — patch critical CVEs before continuing
# Step 3: Verify compliance controls
python scripts/compliance_checker.py . --framework all
# STOP if exit code 2 — address critical gaps before proceeding
# Step 4: Generate combined reports
python scripts/security_scanner.py . --json --output security.json
python scripts/vulnerability_assessor.py . --json --output vulns.json
python scripts/compliance_checker.py . --json --output compliance.json
Workflow 2: CI/CD Security Gate

Integrate security checks into deployment pipeline.

# .github/workflows/security.yml
name: "security-scan"

on:
  pull_request:
    branches: [main, develop]

jobs:
  security-scan:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - name: "set-up-python"
        uses: actions/setup-python@v5
        with:
          python-version: '3.11'

      - name: "security-scanner"
        run: python scripts/security_scanner.py . --severity high

      - name: "vulnerability-assessment"
        run: python scripts/vulnerability_assessor.py . --severity critical

      - name: "compliance-check"
        run: python scripts/compliance_checker.py . --framework soc2

Each step fails the pipeline on its respective exit code — no deployment proceeds past a critical finding.

Workflow 3: CVE Triage

Respond to a new CVE affecting your application.

1. ASSESS (0-2 hours)
   - Identify affected systems using vulnerability_assessor.py
   - Check if CVE is being actively exploited
   - Determine CVSS environmental score for your context
   - STOP if CVSS 9.0+ on internet-facing system — escalate immediately

2. PRIORITIZE
   - Critical (CVSS 9.0+, internet-facing): 24 hours
   - High (CVSS 7.0-8.9): 7 days
   - Medium (CVSS 4.0-6.9): 30 days
   - Low (CVSS < 4.0): 90 days

3. REMEDIATE
   - Update affected dependency to fixed version
   - Run security_scanner.py to verify fix (must return exit code 0)
   - STOP if scanner still flags the CVE — do not deploy
   - Test for regressions
   - Deploy with enhanced monitoring

4. VERIFY
   - Re-run vulnerability_assessor.py
   - Confirm CVE no longer reported
   - Document remediation actions
Workflow 4: Incident Response

Security incident handling procedure.

PHASE 1: DETECT & IDENTIFY (0-15 min)
- Alert received and acknowledged
- Initial severity assessment (SEV-1 to SEV-4)
- Incident commander assigned
- Communication channel established

PHASE 2: CONTAIN (15-60 min)
- Affected systems identified
- Network isolation if needed
- Credentials rotated if compromised
- Preserve evidence (logs, memory dumps)

PHASE 3: ERADICATE (1-4 hours)
- Root cause identified
- Malware/backdoors removed
- Vulnerabilities patched (run security_scanner.py; must return exit code 0)
- Systems hardened

PHASE 4: RECOVER (4-24 hours)
- Systems restored from clean backup
- Services brought back online
- Enhanced monitoring enabled
- User access restored

PHASE 5: POST-INCIDENT (24-72 hours)
- Incident timeline documented
- Root cause analysis complete
- Lessons learned documented
- Preventive measures implemented
- Stakeholder report delivered

Tool Reference

security_scanner.py
Option Description
target Directory or file to scan
--severity, -s Minimum severity: critical, high, medium, low
--verbose, -v Show files as they're scanned
--json Output results as JSON
--output, -o Write results to file

Exit Codes: 0 = no critical/high findings · 1 = high severity findings · 2 = critical severity findings

vulnerability_assessor.py
Option Description
target Directory containing dependency files
--severity, -s Minimum severity: critical, high, medium, low
--verbose, -v Show files as they're scanned
--json Output results as JSON
--output, -o Write results to file

Exit Codes: 0 = no critical/high vulnerabilities · 1 = high severity vulnerabilities · 2 = critical severity vulnerabilities

compliance_checker.py
Option Description
target Directory to check
--framework, -f Framework: soc2, pci-dss, hipaa, gdpr, all
--verbose, -v Show checks as they run
--json Output results as JSON
--output, -o Write results to file

Exit Codes: 0 = compliant (90%+ score) · 1 = non-compliant (50-69% score) · 2 = critical gaps (<50% score)


Security Standards

See references/security_standards.md for OWASP Top 10 full guidance, secure coding standards, authentication requirements, and API security controls.

Secure Coding Checklist
## Input Validation
- [ ] Validate all input on server side
- [ ] Use allowlists over denylists
- [ ] Sanitize for specific context (HTML, SQL, shell)

## Output Encoding
- [ ] HTML encode for browser output
- [ ] URL encode for URLs
- [ ] JavaScript encode for script contexts

## Authentication
- [ ] Use bcrypt/argon2 for passwords
- [ ] Implement MFA for sensitive operations
- [ ] Enforce strong password policy

## Session Management
- [ ] Generate secure random session IDs
- [ ] Set HttpOnly, Secure, SameSite flags
- [ ] Implement session timeout (15 min idle)

## Error Handling
- [ ] Log errors with context (no secrets)
- [ ] Return generic messages to users
- [ ] Never expose stack traces in production

## Secrets Management
- [ ] Use environment variables or secrets manager
- [ ] Never commit secrets to version control
- [ ] Rotate credentials regularly

Compliance Frameworks

See references/compliance_requirements.md for full control mappings. Run compliance_checker.py to verify the controls below:

SOC 2 Type II
  • CC6 Logical Access: authentication, authorization, MFA
  • CC7 System Operations: monitoring, logging, incident response
  • CC8 Change Management: CI/CD, code review, deployment controls
PCI-DSS v4.0
  • Req 3/4: Encryption at rest and in transit (TLS 1.2+)
  • Req 6: Secure development (input validation, secure coding)
  • Req 8: Strong authentication (MFA, password policy)
  • Req 10/11: Audit logging, SAST/DAST/penetration testing
HIPAA Security Rule
  • Unique user IDs and audit trails for PHI access (164.312(a)(1), 164.312(b))
  • MFA for person/entity authentication (164.312(d))
  • Transmission encryption via TLS (164.312(e)(1))
GDPR
  • Art 25/32: Privacy by design, encryption, pseudonymization
  • Art 33: Breach notification within 72 hours
  • Art 17/20: Right to erasure and data portability

Best Practices

Secrets Management
# BAD: Hardcoded secret
API_KEY = "sk-1234567890abcdef"

# GOOD: Environment variable
import os
API_KEY = os.environ.get("API_KEY")

# BETTER: Secrets manager
from your_vault_client import get_secret
API_KEY = get_secret("api/key")
SQL Injection Prevention
# BAD: String concatenation
query = f"SELECT * FROM users WHERE id = {user_id}"

# GOOD: Parameterized query
cursor.execute("SELECT * FROM users WHERE id = %s", (user_id,))
XSS Prevention
// BAD: Direct innerHTML assignment is vulnerable
// GOOD: Use textContent (auto-escaped)
element.textContent = userInput;

// GOOD: Use sanitization library for HTML
import DOMPurify from 'dompurify';
const safeHTML = DOMPurify.sanitize(userInput);
Authentication
// Password hashing
const bcrypt = require('bcrypt');
const SALT_ROUNDS = 12;

// Hash password
const hash = await bcrypt.hash(password, SALT_ROUNDS);

// Verify password
const match = await bcrypt.compare(password, hash);
Security Headers
// Express.js security headers
const helmet = require('helmet');
app.use(helmet());

// Or manually set headers:
app.use((req, res, next) => {
  res.setHeader('X-Content-Type-Options', 'nosniff');
  res.setHeader('X-Frame-Options', 'DENY');
  res.setHeader('X-XSS-Protection', '1; mode=block');
  res.setHeader('Strict-Transport-Security', 'max-age=31536000; includeSubDomains');
  res.setHeader('Content-Security-Policy', "default-src 'self'");
  next();
});

OWASP Top 10 Quick-Check

Rapid 15-minute assessment — run through each category and note pass/fail. For deep-dive testing, hand off to the security-pen-testing skill.

# Category One-Line Check
A01 Broken Access Control Verify role checks on every endpoint; test horizontal privilege escalation
A02 Cryptographic Failures Confirm TLS 1.2+ everywhere; no secrets in logs or source
A03 Injection Run parameterized query audit; check ORM raw-query usage
A04 Insecure Design Review threat model exists for critical flows
A05 Security Misconfiguration Check default credentials removed; error pages generic
A06 Vulnerable Components Run vulnerability_assessor.py; zero critical/high CVEs
A07 Auth Failures Verify MFA on admin; brute-force protection active
A08 Software & Data Integrity Confirm CI/CD pipeline signs artifacts; no unsigned deps
A09 Logging & Monitoring Validate audit logs capture auth events; alerts configured
A10 SSRF Test internal URL filters; block metadata endpoints (169.254.169.254)

Deep dive needed? Hand off to security-pen-testing for full OWASP Testing Guide coverage.


Secret Scanning Tools

Choose the right scanner for each stage of your workflow:

Tool Best For Language Pre-commit CI/CD Custom Rules
gitleaks CI pipelines, full-repo scans Go Yes Yes TOML regexes
detect-secrets Pre-commit hooks, incremental Python Yes Partial Plugin-based
truffleHog Deep history scans, entropy Go No Yes Regex + entropy

Recommended setup: Use detect-secrets as a pre-commit hook (catches secrets before they enter history) and gitleaks in CI (catches anything that slips through).

# detect-secrets pre-commit hook (.pre-commit-config.yaml)
- repo: https://github.com/Yelp/detect-secrets
  rev: v1.4.0
  hooks:
    - id: detect-secrets
      args: ['--baseline', '.secrets.baseline']

# gitleaks in GitHub Actions
- name: gitleaks
  uses: gitleaks/gitleaks-action@v2
  env:
    GITLEAKS_LICENSE: ${{ secrets.GITLEAKS_LICENSE }}

Supply Chain Security

Protect against dependency and artifact tampering with SBOM generation, artifact signing, and SLSA compliance.

SBOM Generation:

  • syft — generates SBOMs from container images or source dirs (SPDX, CycloneDX formats)
  • cyclonedx-cli — CycloneDX-native tooling; merge multiple SBOMs for mono-repos
# Generate SBOM from container image
syft packages ghcr.io/org/app:latest -o cyclonedx-json > sbom.json

Artifact Signing (Sigstore/cosign):

# Sign a container image (keyless via OIDC)
cosign sign ghcr.io/org/app:latest
# Verify signature
cosign verify ghcr.io/org/app:latest [email protected] --certificate-oidc-issuer=https://token.actions.githubusercontent.com

SLSA Levels Overview:

Level Requirement What It Proves
1 Build process documented Provenance exists
2 Hosted build service, signed provenance Tamper-resistant provenance
3 Hardened build platform, non-falsifiable provenance Tamper-proof build
4 Two-party review, hermetic builds Maximum supply-chain assurance

Cross-references: security-pen-testing (vulnerability exploitation testing), dependency-auditor (license and CVE audit for dependencies).


Reference Documentation

Document Description
references/security_standards.md OWASP Top 10, secure coding, authentication, API security
references/vulnerability_management_guide.md CVE triage, CVSS scoring, remediation workflows
references/compliance_requirements.md SOC 2, PCI-DSS, HIPAA, GDPR full control mappings
1---
2name: "senior-secops"
3description: Senior SecOps engineer skill for application security, vulnerability management, compliance verification, and secure development practices. Runs SAST/DAST scans, generates CVE remediation plans, checks dependency vulnerabilities, creates security policies, enforces secure coding patterns, and automates compliance checks against SOC2, PCI-DSS, HIPAA, and GDPR. Use when conducting a security review or audit, responding to a CVE or security incident, hardening infrastructure, implementing authentication or secrets management, running penetration test prep, checking OWASP Top 10 exposure, or enforcing security controls in CI/CD pipelines.
4---
5 
6# Senior SecOps Engineer
7 
8Complete toolkit for Security Operations including vulnerability management, compliance verification, secure coding practices, and security automation.
9 
10---
11 
12## Table of Contents
13 
14- [Core Capabilities](#core-capabilities)
15- [Workflows](#workflows)
16- [Tool Reference](#tool-reference)
17- [Security Standards](#security-standards)
18- [Compliance Frameworks](#compliance-frameworks)
19- [Best Practices](#best-practices)
20 
21---
22 
23## Core Capabilities
24 
25### 1. Security Scanner
26 
27Scan source code for security vulnerabilities including hardcoded secrets, SQL injection, XSS, command injection, and path traversal.
28 
29```bash
30# Scan project for security issues
31python scripts/security_scanner.py /path/to/project
32 
33# Filter by severity
34python scripts/security_scanner.py /path/to/project --severity high
35 
36# JSON output for CI/CD
37python scripts/security_scanner.py /path/to/project --json --output report.json
38```
39 
40**Detects:**
41- Hardcoded secrets (API keys, passwords, AWS credentials, GitHub tokens, private keys)
42- SQL injection patterns (string concatenation, f-strings, template literals)
43- XSS vulnerabilities (innerHTML assignment, unsafe DOM manipulation, React unsafe patterns)
44- Command injection (shell=True, exec, eval with user input)
45- Path traversal (file operations with user input)
46 
47### 2. Vulnerability Assessor
48 
49Scan dependencies for known CVEs across npm, Python, and Go ecosystems.
50 
51```bash
52# Assess project dependencies
53python scripts/vulnerability_assessor.py /path/to/project
54 
55# Critical/high only
56python scripts/vulnerability_assessor.py /path/to/project --severity high
57 
58# Export vulnerability report
59python scripts/vulnerability_assessor.py /path/to/project --json --output vulns.json
60```
61 
62**Scans:**
63- `package.json` and `package-lock.json` (npm)
64- `requirements.txt` and `pyproject.toml` (Python)
65- `go.mod` (Go)
66 
67**Output:**
68- CVE IDs with CVSS scores
69- Affected package versions
70- Fixed versions for remediation
71- Overall risk score (0-100)
72 
73### 3. Compliance Checker
74 
75Verify security compliance against SOC 2, PCI-DSS, HIPAA, and GDPR frameworks.
76 
77```bash
78# Check all frameworks
79python scripts/compliance_checker.py /path/to/project
80 
81# Specific framework
82python scripts/compliance_checker.py /path/to/project --framework soc2
83python scripts/compliance_checker.py /path/to/project --framework pci-dss
84python scripts/compliance_checker.py /path/to/project --framework hipaa
85python scripts/compliance_checker.py /path/to/project --framework gdpr
86 
87# Export compliance report
88python scripts/compliance_checker.py /path/to/project --json --output compliance.json
89```
90 
91**Verifies:**
92- Access control implementation
93- Encryption at rest and in transit
94- Audit logging
95- Authentication strength (MFA, password hashing)
96- Security documentation
97- CI/CD security controls
98 
99---
100 
101## Workflows
102 
103### Workflow 1: Security Audit
104 
105Complete security assessment of a codebase.
106 
107```bash
108# Step 1: Scan for code vulnerabilities
109python scripts/security_scanner.py . --severity medium
110# STOP if exit code 2 — resolve critical findings before continuing
111```
112 
113```bash
114# Step 2: Check dependency vulnerabilities
115python scripts/vulnerability_assessor.py . --severity high
116# STOP if exit code 2 — patch critical CVEs before continuing
117```
118 
119```bash
120# Step 3: Verify compliance controls
121python scripts/compliance_checker.py . --framework all
122# STOP if exit code 2 — address critical gaps before proceeding
123```
124 
125```bash
126# Step 4: Generate combined reports
127python scripts/security_scanner.py . --json --output security.json
128python scripts/vulnerability_assessor.py . --json --output vulns.json
129python scripts/compliance_checker.py . --json --output compliance.json
130```
131 
132### Workflow 2: CI/CD Security Gate
133 
134Integrate security checks into deployment pipeline.
135 
136```yaml
137# .github/workflows/security.yml
138name: "security-scan"
139 
140on:
141 pull_request:
142 branches: [main, develop]
143 
144jobs:
145 security-scan:
146 runs-on: ubuntu-latest
147 steps:
148 - uses: actions/checkout@v4
149 
150 - name: "set-up-python"
151 uses: actions/setup-python@v5
152 with:
153 python-version: '3.11'
154 
155 - name: "security-scanner"
156 run: python scripts/security_scanner.py . --severity high
157 
158 - name: "vulnerability-assessment"
159 run: python scripts/vulnerability_assessor.py . --severity critical
160 
161 - name: "compliance-check"
162 run: python scripts/compliance_checker.py . --framework soc2
163```
164 
165Each step fails the pipeline on its respective exit code — no deployment proceeds past a critical finding.
166 
167### Workflow 3: CVE Triage
168 
169Respond to a new CVE affecting your application.
170 
171```
1721. ASSESS (0-2 hours)
173 - Identify affected systems using vulnerability_assessor.py
174 - Check if CVE is being actively exploited
175 - Determine CVSS environmental score for your context
176 - STOP if CVSS 9.0+ on internet-facing system — escalate immediately
177 
1782. PRIORITIZE
179 - Critical (CVSS 9.0+, internet-facing): 24 hours
180 - High (CVSS 7.0-8.9): 7 days
181 - Medium (CVSS 4.0-6.9): 30 days
182 - Low (CVSS < 4.0): 90 days
183 
1843. REMEDIATE
185 - Update affected dependency to fixed version
186 - Run security_scanner.py to verify fix (must return exit code 0)
187 - STOP if scanner still flags the CVE — do not deploy
188 - Test for regressions
189 - Deploy with enhanced monitoring
190 
1914. VERIFY
192 - Re-run vulnerability_assessor.py
193 - Confirm CVE no longer reported
194 - Document remediation actions
195```
196 
197### Workflow 4: Incident Response
198 
199Security incident handling procedure.
200 
201```
202PHASE 1: DETECT & IDENTIFY (0-15 min)
203- Alert received and acknowledged
204- Initial severity assessment (SEV-1 to SEV-4)
205- Incident commander assigned
206- Communication channel established
207 
208PHASE 2: CONTAIN (15-60 min)
209- Affected systems identified
210- Network isolation if needed
211- Credentials rotated if compromised
212- Preserve evidence (logs, memory dumps)
213 
214PHASE 3: ERADICATE (1-4 hours)
215- Root cause identified
216- Malware/backdoors removed
217- Vulnerabilities patched (run security_scanner.py; must return exit code 0)
218- Systems hardened
219 
220PHASE 4: RECOVER (4-24 hours)
221- Systems restored from clean backup
222- Services brought back online
223- Enhanced monitoring enabled
224- User access restored
225 
226PHASE 5: POST-INCIDENT (24-72 hours)
227- Incident timeline documented
228- Root cause analysis complete
229- Lessons learned documented
230- Preventive measures implemented
231- Stakeholder report delivered
232```
233 
234---
235 
236## Tool Reference
237 
238### security_scanner.py
239 
240| Option | Description |
241|--------|-------------|
242| `target` | Directory or file to scan |
243| `--severity, -s` | Minimum severity: critical, high, medium, low |
244| `--verbose, -v` | Show files as they're scanned |
245| `--json` | Output results as JSON |
246| `--output, -o` | Write results to file |
247 
248**Exit Codes:** `0` = no critical/high findings · `1` = high severity findings · `2` = critical severity findings
249 
250### vulnerability_assessor.py
251 
252| Option | Description |
253|--------|-------------|
254| `target` | Directory containing dependency files |
255| `--severity, -s` | Minimum severity: critical, high, medium, low |
256| `--verbose, -v` | Show files as they're scanned |
257| `--json` | Output results as JSON |
258| `--output, -o` | Write results to file |
259 
260**Exit Codes:** `0` = no critical/high vulnerabilities · `1` = high severity vulnerabilities · `2` = critical severity vulnerabilities
261 
262### compliance_checker.py
263 
264| Option | Description |
265|--------|-------------|
266| `target` | Directory to check |
267| `--framework, -f` | Framework: soc2, pci-dss, hipaa, gdpr, all |
268| `--verbose, -v` | Show checks as they run |
269| `--json` | Output results as JSON |
270| `--output, -o` | Write results to file |
271 
272**Exit Codes:** `0` = compliant (90%+ score) · `1` = non-compliant (50-69% score) · `2` = critical gaps (<50% score)
273 
274---
275 
276## Security Standards
277 
278See `references/security_standards.md` for OWASP Top 10 full guidance, secure coding standards, authentication requirements, and API security controls.
279 
280### Secure Coding Checklist
281 
282```markdown
283## Input Validation
284- [ ] Validate all input on server side
285- [ ] Use allowlists over denylists
286- [ ] Sanitize for specific context (HTML, SQL, shell)
287 
288## Output Encoding
289- [ ] HTML encode for browser output
290- [ ] URL encode for URLs
291- [ ] JavaScript encode for script contexts
292 
293## Authentication
294- [ ] Use bcrypt/argon2 for passwords
295- [ ] Implement MFA for sensitive operations
296- [ ] Enforce strong password policy
297 
298## Session Management
299- [ ] Generate secure random session IDs
300- [ ] Set HttpOnly, Secure, SameSite flags
301- [ ] Implement session timeout (15 min idle)
302 
303## Error Handling
304- [ ] Log errors with context (no secrets)
305- [ ] Return generic messages to users
306- [ ] Never expose stack traces in production
307 
308## Secrets Management
309- [ ] Use environment variables or secrets manager
310- [ ] Never commit secrets to version control
311- [ ] Rotate credentials regularly
312```
313 
314---
315 
316## Compliance Frameworks
317 
318See `references/compliance_requirements.md` for full control mappings. Run `compliance_checker.py` to verify the controls below:
319 
320### SOC 2 Type II
321- **CC6** Logical Access: authentication, authorization, MFA
322- **CC7** System Operations: monitoring, logging, incident response
323- **CC8** Change Management: CI/CD, code review, deployment controls
324 
325### PCI-DSS v4.0
326- **Req 3/4**: Encryption at rest and in transit (TLS 1.2+)
327- **Req 6**: Secure development (input validation, secure coding)
328- **Req 8**: Strong authentication (MFA, password policy)
329- **Req 10/11**: Audit logging, SAST/DAST/penetration testing
330 
331### HIPAA Security Rule
332- Unique user IDs and audit trails for PHI access (164.312(a)(1), 164.312(b))
333- MFA for person/entity authentication (164.312(d))
334- Transmission encryption via TLS (164.312(e)(1))
335 
336### GDPR
337- **Art 25/32**: Privacy by design, encryption, pseudonymization
338- **Art 33**: Breach notification within 72 hours
339- **Art 17/20**: Right to erasure and data portability
340 
341---
342 
343## Best Practices
344 
345### Secrets Management
346 
347```python
348# BAD: Hardcoded secret
349API_KEY = "sk-1234567890abcdef"
350 
351# GOOD: Environment variable
352import os
353API_KEY = os.environ.get("API_KEY")
354 
355# BETTER: Secrets manager
356from your_vault_client import get_secret
357API_KEY = get_secret("api/key")
358```
359 
360### SQL Injection Prevention
361 
362```python
363# BAD: String concatenation
364query = f"SELECT * FROM users WHERE id = {user_id}"
365 
366# GOOD: Parameterized query
367cursor.execute("SELECT * FROM users WHERE id = %s", (user_id,))
368```
369 
370### XSS Prevention
371 
372```javascript
373// BAD: Direct innerHTML assignment is vulnerable
374// GOOD: Use textContent (auto-escaped)
375element.textContent = userInput;
376 
377// GOOD: Use sanitization library for HTML
378import DOMPurify from 'dompurify';
379const safeHTML = DOMPurify.sanitize(userInput);
380```
381 
382### Authentication
383 
384```javascript
385// Password hashing
386const bcrypt = require('bcrypt');
387const SALT_ROUNDS = 12;
388 
389// Hash password
390const hash = await bcrypt.hash(password, SALT_ROUNDS);
391 
392// Verify password
393const match = await bcrypt.compare(password, hash);
394```
395 
396### Security Headers
397 
398```javascript
399// Express.js security headers
400const helmet = require('helmet');
401app.use(helmet());
402 
403// Or manually set headers:
404app.use((req, res, next) => {
405 res.setHeader('X-Content-Type-Options', 'nosniff');
406 res.setHeader('X-Frame-Options', 'DENY');
407 res.setHeader('X-XSS-Protection', '1; mode=block');
408 res.setHeader('Strict-Transport-Security', 'max-age=31536000; includeSubDomains');
409 res.setHeader('Content-Security-Policy', "default-src 'self'");
410 next();
411});
412```
413 
414---
415 
416## OWASP Top 10 Quick-Check
417 
418Rapid 15-minute assessment — run through each category and note pass/fail. For deep-dive testing, hand off to the **security-pen-testing** skill.
419 
420| # | Category | One-Line Check |
421|---|----------|----------------|
422| A01 | Broken Access Control | Verify role checks on every endpoint; test horizontal privilege escalation |
423| A02 | Cryptographic Failures | Confirm TLS 1.2+ everywhere; no secrets in logs or source |
424| A03 | Injection | Run parameterized query audit; check ORM raw-query usage |
425| A04 | Insecure Design | Review threat model exists for critical flows |
426| A05 | Security Misconfiguration | Check default credentials removed; error pages generic |
427| A06 | Vulnerable Components | Run `vulnerability_assessor.py`; zero critical/high CVEs |
428| A07 | Auth Failures | Verify MFA on admin; brute-force protection active |
429| A08 | Software & Data Integrity | Confirm CI/CD pipeline signs artifacts; no unsigned deps |
430| A09 | Logging & Monitoring | Validate audit logs capture auth events; alerts configured |
431| A10 | SSRF | Test internal URL filters; block metadata endpoints (169.254.169.254) |
432 
433> **Deep dive needed?** Hand off to `security-pen-testing` for full OWASP Testing Guide coverage.
434 
435---
436 
437## Secret Scanning Tools
438 
439Choose the right scanner for each stage of your workflow:
440 
441| Tool | Best For | Language | Pre-commit | CI/CD | Custom Rules |
442|------|----------|----------|:----------:|:-----:|:------------:|
443| **gitleaks** | CI pipelines, full-repo scans | Go | Yes | Yes | TOML regexes |
444| **detect-secrets** | Pre-commit hooks, incremental | Python | Yes | Partial | Plugin-based |
445| **truffleHog** | Deep history scans, entropy | Go | No | Yes | Regex + entropy |
446 
447**Recommended setup:** Use `detect-secrets` as a pre-commit hook (catches secrets before they enter history) and `gitleaks` in CI (catches anything that slips through).
448 
449```bash
450# detect-secrets pre-commit hook (.pre-commit-config.yaml)
451- repo: https://github.com/Yelp/detect-secrets
452 rev: v1.4.0
453 hooks:
454 - id: detect-secrets
455 args: ['--baseline', '.secrets.baseline']
456 
457# gitleaks in GitHub Actions
458- name: gitleaks
459 uses: gitleaks/gitleaks-action@v2
460 env:
461 GITLEAKS_LICENSE: ${{ secrets.GITLEAKS_LICENSE }}
462```
463 
464---
465 
466## Supply Chain Security
467 
468Protect against dependency and artifact tampering with SBOM generation, artifact signing, and SLSA compliance.
469 
470**SBOM Generation:**
471- **syft** — generates SBOMs from container images or source dirs (SPDX, CycloneDX formats)
472- **cyclonedx-cli** — CycloneDX-native tooling; merge multiple SBOMs for mono-repos
473 
474```bash
475# Generate SBOM from container image
476syft packages ghcr.io/org/app:latest -o cyclonedx-json > sbom.json
477```
478 
479**Artifact Signing (Sigstore/cosign):**
480```bash
481# Sign a container image (keyless via OIDC)
482cosign sign ghcr.io/org/app:latest
483# Verify signature
484cosign verify ghcr.io/org/app:latest [email protected] --certificate-oidc-issuer=https://token.actions.githubusercontent.com
485```
486 
487**SLSA Levels Overview:**
488| Level | Requirement | What It Proves |
489|-------|-------------|----------------|
490| 1 | Build process documented | Provenance exists |
491| 2 | Hosted build service, signed provenance | Tamper-resistant provenance |
492| 3 | Hardened build platform, non-falsifiable provenance | Tamper-proof build |
493| 4 | Two-party review, hermetic builds | Maximum supply-chain assurance |
494 
495> **Cross-references:** `security-pen-testing` (vulnerability exploitation testing), `dependency-auditor` (license and CVE audit for dependencies).
496 
497---
498 
499## Reference Documentation
500 
501| Document | Description |
502|----------|-------------|
503| `references/security_standards.md` | OWASP Top 10, secure coding, authentication, API security |
504| `references/vulnerability_management_guide.md` | CVE triage, CVSS scoring, remediation workflows |
505| `references/compliance_requirements.md` | SOC 2, PCI-DSS, HIPAA, GDPR full control mappings |
506 

Discussion

Alternatives

Also in SecuritySee all 533 in Development →