Security Audit Workflow

Comprehensive security review workflow with vulnerability scanning, code analysis, and remediation phases

The Security Audit workflow provides a systematic approach to identifying and remediating security vulnerabilities in your application through code review, vulnerability scanning, and guided remediation.

Overview#

PropertyValue
Phases3
TierFree
Typical Duration5-9 days
Best ForPre-launch security review, compliance preparation, periodic audits

Outcomes#

A successful security audit results in:

  • Critical and high vulnerabilities remediated
  • Security findings documented and closed
  • Post-fix verification complete
  • Security posture report generated

Phases#

Phase 1: Code Review (2-3 days)#

Agents: code-review-expert, security-expert

Perform a thorough security-focused code review to identify potential vulnerabilities before automated scanning.

Tasks:

  • Review authentication and authorization logic
  • Analyze input validation and sanitization
  • Check for sensitive data exposure
  • Identify insecure dependencies
  • Review error handling and logging
  • Assess session management implementation

Key Areas:

Authentication Authorization Input Validation │ │ │ ▼ ▼ ▼ ┌─────────┐ ┌──────────┐ ┌────────────┐ │ Login │ │ RBAC │ │ Sanitize │ │ Session │ │ Policies │ │ Validate │ │ MFA │ │ Scopes │ │ Escape │ └─────────┘ └──────────┘ └────────────┘

Phase 2: Vulnerability Scan (1 day)#

Agents: security-expert

Run automated security scanning tools to detect known vulnerabilities and misconfigurations.

Tasks:

  • Run dependency vulnerability scan (npm audit, Snyk)
  • Perform static application security testing (SAST)
  • Check for OWASP Top 10 vulnerabilities
  • Scan for exposed secrets and credentials
  • Review security headers and configurations
  • Test for common attack vectors (XSS, CSRF, SQL injection)

Common Checks:

1# Dependency vulnerabilities 2npm audit 3npx snyk test 4 5# Secret scanning 6npx secretlint "**/*" 7 8# Security headers check 9curl -I https://your-app.com | grep -i security

Phase 3: Remediation (2-5 days)#

Agents: security-expert, backend-expert

Fix identified vulnerabilities and implement security improvements.

Tasks:

  • Prioritize vulnerabilities by severity (Critical, High, Medium, Low)
  • Implement fixes for critical and high severity issues
  • Update vulnerable dependencies
  • Add missing security headers
  • Implement rate limiting where needed
  • Document security improvements

Prioritization Matrix:

┌─────────────────────────────────────────────────┐ │ CRITICAL │ Fix immediately, block deployment │ ├───────────┼─────────────────────────────────────┤ │ HIGH │ Fix before next release │ ├───────────┼─────────────────────────────────────┤ │ MEDIUM │ Plan for upcoming sprint │ ├───────────┼─────────────────────────────────────┤ │ LOW │ Add to backlog │ └───────────┴─────────────────────────────────────┘

Starting the Workflow#

1# Start the workflow 2bootspring workflow start security-audit 3 4# Check current status 5bootspring workflow status 6 7# Advance to next phase 8bootspring workflow next 9 10# Mark a checkpoint complete 11bootspring workflow checkpoint "Security findings closed"

Completion Signals#

Track progress with these checkpoints:

  1. Security findings closed - All critical/high issues resolved
  2. Post-fix verification complete - Fixes verified and tested

Security Checklist#

Use this checklist during your audit:

Authentication#

  • Password requirements enforced (length, complexity)
  • Account lockout after failed attempts
  • Secure password reset flow
  • Session timeout configured
  • MFA available for sensitive operations

Authorization#

  • Role-based access control implemented
  • Least privilege principle applied
  • API endpoints properly protected
  • Resource ownership verified

Data Protection#

  • Sensitive data encrypted at rest
  • TLS enforced for all connections
  • PII properly handled and logged
  • Secure data deletion implemented

Input Validation#

  • All user input validated server-side
  • SQL injection prevention (parameterized queries)
  • XSS prevention (output encoding)
  • CSRF tokens implemented
  • File upload validation

Dependencies#

  • No known vulnerable dependencies
  • Dependencies pinned to specific versions
  • Regular update schedule established

Infrastructure#

  • Security headers configured (CSP, HSTS, etc.)
  • Error messages don't leak sensitive info
  • Debug mode disabled in production
  • Secrets management in place

Security Headers Example#

1// middleware.ts 2import { NextResponse } from 'next/server'; 3import type { NextRequest } from 'next/server'; 4 5export function middleware(request: NextRequest) { 6 const response = NextResponse.next(); 7 8 // Security headers 9 response.headers.set('X-Frame-Options', 'DENY'); 10 response.headers.set('X-Content-Type-Options', 'nosniff'); 11 response.headers.set('X-XSS-Protection', '1; mode=block'); 12 response.headers.set('Referrer-Policy', 'strict-origin-when-cross-origin'); 13 response.headers.set( 14 'Content-Security-Policy', 15 "default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval'; style-src 'self' 'unsafe-inline';" 16 ); 17 response.headers.set( 18 'Strict-Transport-Security', 19 'max-age=31536000; includeSubDomains' 20 ); 21 22 return response; 23}

Tips for Success#

  1. Start with critical paths - Focus on authentication, payments, and data access first
  2. Use multiple tools - Different scanners catch different issues
  3. Document everything - Keep records for compliance and future audits
  4. Test the fixes - Verify each remediation actually works
  5. Plan for ongoing security - Schedule regular audits