Terminal.skills
Skills/soc2-compliance
>

soc2-compliance

Achieve SOC 2 Type II compliance for SaaS — Trust Service Criteria, evidence collection, and controls implementation. Use when preparing for a SOC 2 audit, meeting B2B SaaS security requirements, or onboarding enterprise customers who require a SOC 2 report.

#soc2#compliance#saas#audit#trust-services
terminal-skillsv1.0.0
Works with:claude-codeopenai-codexgemini-clicursor
Source

Usage

$
✓ Installed soc2-compliance v1.0.0

Getting Started

  1. Install the skill using the command above
  2. Open your AI coding agent (Claude Code, Codex, Gemini CLI, or Cursor)
  3. Reference the skill in your prompt
  4. The AI will use the skill's capabilities automatically

Example Prompts

  • "Review the open pull requests and summarize what needs attention"
  • "Generate a changelog from the last 20 commits on the main branch"

Information

Version
1.0.0
Author
terminal-skills
Category
Development
License
Apache-2.0

Documentation

Overview

SOC 2 (System and Organization Controls 2) is an auditing standard developed by the AICPA for service organizations. A SOC 2 Type II report covers a period of 6-12 months, demonstrating controls are operating effectively — not just designed. Enterprise buyers almost universally require SOC 2 before signing contracts.

Trust Service Criteria (TSC)

CriteriaAbbrevRequired?Description
SecurityCC✅ AlwaysProtection against unauthorized access
AvailabilityAOptionalSystem available for operation and use
ConfidentialityCOptionalInformation designated as confidential is protected
Processing IntegrityPIOptionalProcessing is complete, valid, accurate, timely
PrivacyPOptionalPersonal information collected, used, retained, disclosed properly

Most SaaS companies start with Security + Availability. Add Confidentiality if handling sensitive data; add Privacy if handling personal data covered by GDPR/CCPA.

Common Controls Framework (CC)

CC1 — Control Environment

  • Written security policies reviewed annually
  • Code of conduct acknowledged by all staff
  • Org chart with clear security accountability

CC2 — Communication and Information

  • Security policies communicated to all personnel
  • Vendor risk assessments documented
  • Security awareness training records

CC3 — Risk Assessment

markdown
Risk Register entry:
- Risk ID: RISK-001
- Title: Unauthorized database access
- Likelihood: Medium
- Impact: High
- Inherent Risk: High
- Controls: MFA, network segmentation, IAM least-privilege
- Residual Risk: Low
- Owner: CTO
- Review Date: 2025-01-15

CC4 — Monitoring Activities

  • Automated vulnerability scanning (weekly minimum)
  • Quarterly access reviews
  • Intrusion detection alerts reviewed daily

CC5 — Control Activities

  • Change management process with peer review
  • Incident response plan tested annually
  • Penetration testing annually

CC6 — Logical and Physical Access Controls

MFA enforcement (Node.js example):

javascript
// Enforce MFA for all admin users
const requireMFA = async (req, res, next) => {
  const user = req.user;
  if (user.role === 'admin' && !user.mfaVerified) {
    return res.status(403).json({
      error: 'MFA required for admin access',
      code: 'MFA_REQUIRED'
    });
  }
  next();
};

// Log all authentication events for CC6 evidence
const logAuthEvent = async (userId, event, success, ipAddress) => {
  await db.auditLog.create({
    userId,
    event,        // 'login' | 'logout' | 'mfa_verify' | 'password_reset'
    success,
    ipAddress,
    userAgent: req.headers['user-agent'],
    timestamp: new Date().toISOString()
  });
};

Access review automation:

python
import boto3
from datetime import datetime, timedelta

def generate_access_review_report():
    """Generate quarterly access review evidence for CC6."""
    iam = boto3.client('iam')
    report = []
    
    users = iam.list_users()['Users']
    for user in users:
        # Check last activity
        login_profile = None
        try:
            login_profile = iam.get_login_profile(UserName=user['UserName'])
        except iam.exceptions.NoSuchEntityException:
            pass
        
        groups = iam.list_groups_for_user(UserName=user['UserName'])
        policies = iam.list_attached_user_policies(UserName=user['UserName'])
        
        report.append({
            "user": user['UserName'],
            "created": user['CreateDate'].isoformat(),
            "groups": [g['GroupName'] for g in groups['Groups']],
            "policies": [p['PolicyName'] for p in policies['AttachedPolicies']],
            "has_console_access": login_profile is not None,
            "review_date": datetime.utcnow().isoformat(),
            "reviewed_by": "security-team"
        })
    
    return report

CC7 — System Operations

  • Infrastructure monitoring with alerts
  • Log aggregation and anomaly detection
  • Capacity planning reviews

CC8 — Change Management

Git-based change management:

bash
# All changes via PR (enforced in GitHub branch protection)
# - Required reviewers: 2
# - Required CI checks: tests, security scan, lint
# - No direct pushes to main

# Deployment approval record (for audit evidence)
cat deployment-log.json
# {
#   "deploy_id": "deploy-2024-0115-001",
#   "author": "alice@company.com",
#   "reviewer": "bob@company.com",
#   "approved_at": "2024-01-15T14:30:00Z",
#   "deployed_at": "2024-01-15T14:45:00Z",
#   "changes": "JIRA-123: Add MFA to admin panel",
#   "rollback_plan": "Revert commit abc123"
# }

CC9 — Risk Mitigation

  • Vendor management program
  • Business continuity plan
  • Cyber insurance

Evidence Collection

SOC 2 auditors need evidence that controls operated continuously during the audit period.

ControlEvidence TypeFrequencyStorage
MFA enabledScreenshot + IAM exportQuarterlyVanta/Drata
Access reviewsSigned review recordsQuarterlyGoogle Drive
Vulnerability scansScan reportsWeeklyS3/Drive
Pen testReport + remediationAnnualDrive
Security trainingCompletion certificatesAnnualHRIS
Incident response testTabletop exercise notesAnnualDrive
Encryption at restConfig screenshotChange-basedDrive
Backup testedRestore test logQuarterlyDrive

Automation Tools

Vanta (recommended for startups)

bash
# Vanta connects to your cloud accounts and auto-collects evidence
# Integrations: AWS, GCP, Azure, GitHub, Okta, Google Workspace, Slack

# After connecting, Vanta auto-monitors:
# - MFA enforcement (CC6.1)
# - Encryption at rest (CC6.7)
# - Vulnerability scanning (CC7.1)
# - Background checks (CC1.1)
# - Access reviews (CC6.2)

Drata / Secureframe

Both offer similar automation: continuous control monitoring + auditor portal for evidence sharing. Drata is strong on integrations; Secureframe has a good self-service audit experience.

Key Policies to Write

Create these written policies (stored in a policy management system):

markdown
Required Policies:
1. Information Security Policy
2. Access Control Policy  
3. Encryption Policy
4. Incident Response Plan
5. Business Continuity / Disaster Recovery Plan
6. Vulnerability Management Policy
7. Change Management Policy
8. Vendor Management Policy
9. Acceptable Use Policy
10. Data Classification Policy

Encryption Policy example snippet:

markdown
## Encryption Policy

**Effective Date:** 2024-01-01
**Owner:** CTO
**Review Cycle:** Annual

### Requirements
- All data at rest classified as Confidential or Restricted MUST be encrypted 
  using AES-256 or equivalent.
- All data in transit MUST use TLS 1.2 or higher.
- Encryption keys MUST be stored separately from encrypted data, in an 
  approved key management system (AWS KMS, GCP KMS, or HashiCorp Vault).
- Keys MUST be rotated annually or upon suspected compromise.

SOC 2 Timeline

PhaseDurationActivities
Readiness assessment4-6 weeksGap analysis, policy writing
Remediation2-4 monthsImplement controls, fix gaps
Evidence collection period (Type II)6-12 monthsRun controls, collect evidence
Auditor fieldwork4-8 weeksAuditor reviews evidence
Report issuance2-4 weeksFinal report, management response

Total Type II timeline: ~12-18 months from start to report.

Compliance Checklist

  • Scope defined (which systems handle customer data)
  • Auditor selected (AICPA-licensed CPA firm)
  • Security policies written and approved
  • MFA enforced for all users
  • Encryption at rest and in transit enabled
  • Vulnerability scanning automated
  • Access review process established
  • Change management process documented
  • Incident response plan written and tested
  • Vendor risk assessments completed
  • Background checks for employees
  • Security awareness training completed
  • Evidence collection tool in place (Vanta/Drata/Secureframe)