Service Organization Control 2 (Service Organization Control Report)
SOC 2 is an audit framework developed by the AICPA (American Institute of Certified Public Accountants) that independently verifies the security controls of service organizations. Based on the five principles of the Trust Services Criteria (security, availability, processing integrity, confidentiality, privacy), it is a key certification for proving customer trust, especially for SaaS/cloud companies.
SOC 2 (Service Organization Control 2) is an audit framework developed by the AICPA (American Institute of Certified Public Accountants). It was originally derived from SOC 1 (controls relevant to financial reporting), and with the spread of cloud services in the 2010s, it became the de facto standard for verifying the security of IT service providers. For B2B SaaS companies to win enterprise customers, a SOC 2 report is almost essential.
SOC 2 is based on the five principles of the Trust Services Criteria (TSC). Security is mandatory and evaluates whether the system is protected from unauthorized access. Availability verifies whether the service operates at the committed level. Processing Integrity verifies whether data processing is complete, accurate, and timely. Confidentiality evaluates whether sensitive information is appropriately protected. Privacy reviews how personal information is collected, used, retained, and disposed of.
SOC 2 reports are divided into Type I and Type II. Type I evaluates whether controls are suitably designed at a specific point in time (design suitability). Type II evaluates whether controls operated effectively over a period of time (typically 6-12 months) (operating effectiveness). Type II is far more credible, and most enterprise customers require Type II. It is common to start with Type I for the first audit and then transition to Type II.
A SOC 2 audit is performed by a licensed CPA firm. During the audit, evidence such as policy/procedure documents, system configurations, access logs, change management records, and incident response records is reviewed. Audit opinions are divided into Unqualified, Qualified, Adverse, and Disclaimer of Opinion. Once an unqualified opinion is received, the report can be shared with customers. The report is usually shared under an NDA and must be renewed every year.
💻 Code Example
# SOC 2 컴플라이언스 자동화: 증거 수집 및 모니터링 - Python
import json
import boto3
from datetime import datetime, timedelta
from typing import Dict, List, Any
from dataclasses import dataclass, field
from enum import Enum
class TrustServicesCriteria(Enum):
"""Trust Services Criteria 5가지 원칙"""
SECURITY = "CC" # Common Criteria (필수)
AVAILABILITY = "A" # 가용성
PROCESSING_INTEGRITY = "PI" # 처리 무결성
CONFIDENTIALITY = "C" # 기밀성
PRIVACY = "P" # 개인정보 보호
@dataclass
class Control:
"""SOC 2 통제 항목"""
id: str
name: str
criteria: TrustServicesCriteria
description: str
evidence_types: List[str]
automated: bool = False
@dataclass
class Evidence:
"""감사 증거"""
control_id: str
collected_at: str
source: str
data: Any
period_start: str
period_end: str
class SOC2EvidenceCollector:
"""SOC 2 감사 증거 자동 수집기"""
def __init__(self, aws_session=None):
self.session = aws_session or boto3.Session()
self.evidences: List[Evidence] = []
def collect_access_logs(self, start_date: datetime, end_date: datetime) -> Evidence:
"""CC6.1 - 논리적 접근 통제 증거 수집
CloudTrail 로그에서 접근 기록 추출
"""
cloudtrail = self.session.client('cloudtrail')
events = []
paginator = cloudtrail.get_paginator('lookup_events')
for page in paginator.paginate(
StartTime=start_date,
EndTime=end_date,
LookupAttributes=[
{'AttributeKey': 'EventSource', 'AttributeValue': 'signin.amazonaws.com'}
]
):
events.extend(page['Events'])
evidence = Evidence(
control_id="CC6.1",
collected_at=datetime.utcnow().isoformat(),
source="AWS CloudTrail",
data={
"total_login_events": len(events),
"failed_logins": sum(1 for e in events
if json.loads(e['CloudTrailEvent']).get('responseElements', {}).get('ConsoleLogin') == 'Failure'),
"unique_users": len(set(e['Username'] for e in events if 'Username' in e)),
"sample_events": events[:10] # 샘플
},
period_start=start_date.isoformat(),
period_end=end_date.isoformat()
)
self.evidences.append(evidence)
return evidence
def collect_change_management(self, start_date: datetime, end_date: datetime) -> Evidence:
"""CC8.1 - 변경 관리 통제 증거 수집
GitHub/GitLab에서 PR 및 배포 기록 추출
"""
# 실제로는 GitHub API 사용
# 여기서는 샘플 데이터
evidence = Evidence(
control_id="CC8.1",
collected_at=datetime.utcnow().isoformat(),
source="GitHub",
data={
"total_pull_requests": 150,
"approved_before_merge": 148,
"approval_rate": "98.7%",
"average_reviewers": 2.3,
"deployments": 45,
"rollbacks": 2,
"sample_prs": [
{"id": "PR-1234", "title": "Add MFA requirement", "reviewers": 2, "approved": True},
{"id": "PR-1235", "title": "Update encryption", "reviewers": 3, "approved": True}
]
},
period_start=start_date.isoformat(),
period_end=end_date.isoformat()
)
self.evidences.append(evidence)
return evidence
def collect_encryption_status(self) -> Evidence:
"""CC6.7 - 데이터 암호화 통제 증거 수집
S3 버킷, RDS, EBS 볼륨의 암호화 상태 확인
"""
s3 = self.session.client('s3')
rds = self.session.client('rds')
ec2 = self.session.client('ec2')
# S3 암호화 상태
buckets = s3.list_buckets()['Buckets']
encrypted_buckets = 0
for bucket in buckets:
try:
encryption = s3.get_bucket_encryption(Bucket=bucket['Name'])
encrypted_buckets += 1
except s3.exceptions.ClientError:
pass
# RDS 암호화 상태
instances = rds.describe_db_instances()['DBInstances']
encrypted_rds = sum(1 for i in instances if i.get('StorageEncrypted', False))
# EBS 볼륨 암호화 상태
volumes = ec2.describe_volumes()['Volumes']
encrypted_ebs = sum(1 for v in volumes if v.get('Encrypted', False))
evidence = Evidence(
control_id="CC6.7",
collected_at=datetime.utcnow().isoformat(),
source="AWS (S3, RDS, EBS)",
data={
"s3_buckets": {
"total": len(buckets),
"encrypted": encrypted_buckets,
"compliance": f"{encrypted_buckets/len(buckets)*100:.1f}%" if buckets else "N/A"
},
"rds_instances": {
"total": len(instances),
"encrypted": encrypted_rds,
"compliance": f"{encrypted_rds/len(instances)*100:.1f}%" if instances else "N/A"
},
"ebs_volumes": {
"total": len(volumes),
"encrypted": encrypted_ebs,
"compliance": f"{encrypted_ebs/len(volumes)*100:.1f}%" if volumes else "N/A"
}
},
period_start=datetime.utcnow().isoformat(),
period_end=datetime.utcnow().isoformat()
)
self.evidences.append(evidence)
return evidence
def collect_incident_response(self, start_date: datetime, end_date: datetime) -> Evidence:
"""CC7.4 - 인시던트 대응 통제 증거 수집
PagerDuty/Opsgenie에서 인시던트 기록 추출
"""
# 실제로는 PagerDuty API 사용
evidence = Evidence(
control_id="CC7.4",
collected_at=datetime.utcnow().isoformat(),
source="PagerDuty",
data={
"total_incidents": 25,
"security_incidents": 3,
"mean_time_to_acknowledge": "5 minutes",
"mean_time_to_resolve": "2.5 hours",
"postmortems_completed": 3,
"sample_incidents": [
{
"id": "INC-001",
"severity": "P2",
"type": "Security",
"acknowledged_in": "3 min",
"resolved_in": "45 min",
"postmortem": True
}
]
},
period_start=start_date.isoformat(),
period_end=end_date.isoformat()
)
self.evidences.append(evidence)
return evidence
def generate_evidence_package(self) -> Dict:
"""감사용 증거 패키지 생성"""
return {
"generated_at": datetime.utcnow().isoformat(),
"report_type": "SOC 2 Type II",
"period": {
"start": min(e.period_start for e in self.evidences),
"end": max(e.period_end for e in self.evidences)
},
"controls_covered": list(set(e.control_id for e in self.evidences)),
"evidence_count": len(self.evidences),
"evidences": [
{
"control_id": e.control_id,
"source": e.source,
"collected_at": e.collected_at,
"data": e.data
}
for e in self.evidences
]
}
# 사용 예시
if __name__ == "__main__":
collector = SOC2EvidenceCollector()
# 감사 기간 설정 (지난 12개월)
end_date = datetime.utcnow()
start_date = end_date - timedelta(days=365)
# 증거 수집
collector.collect_access_logs(start_date, end_date)
collector.collect_change_management(start_date, end_date)
collector.collect_encryption_status()
collector.collect_incident_response(start_date, end_date)
# 증거 패키지 생성
package = collector.generate_evidence_package()
print(json.dumps(package, indent=2, default=str))
# SOC 2 Trust Services Criteria 통제 매핑 - YAML
# Common Criteria (Security) 중심으로 구성
soc2_controls:
report_type: "SOC 2 Type II"
audit_period:
start: "2024-01-01"
end: "2024-12-31"
auditor: "Big 4 CPA Firm"
trust_services_criteria:
# CC (Common Criteria) - Security 필수
security:
category: "CC"
required: true
controls:
# CC1 - Control Environment
- id: "CC1.1"
name: "COSO 원칙 1: 무결성과 윤리적 가치"
description: "조직은 무결성과 윤리적 가치에 대한 commitment를 보여줌"
implementation:
- "Code of Conduct 정책 수립"
- "연간 직원 윤리 교육"
- "내부고발자 프로그램"
evidence:
- "Code of Conduct 문서"
- "교육 이수 기록"
- "윤리 위반 보고 및 처리 기록"
status: "implemented"
owner: "HR"
# CC2 - Communication and Information
- id: "CC2.1"
name: "내부 커뮤니케이션"
description: "정보보안 책임과 역할에 대한 내부 커뮤니케이션"
implementation:
- "보안 정책 포털"
- "월간 보안 뉴스레터"
- "Slack 보안 채널"
evidence:
- "정책 배포 로그"
- "뉴스레터 아카이브"
status: "implemented"
owner: "Security Team"
# CC5 - Control Activities
- id: "CC5.2"
name: "논리적 접근 통제"
description: "시스템에 대한 논리적 접근 통제"
implementation:
- "SSO + MFA 필수"
- "RBAC 기반 권한 관리"
- "분기별 접근 권한 검토"
evidence:
- "Okta 접근 로그"
- "권한 검토 기록"
- "MFA 적용률 리포트"
status: "implemented"
owner: "IT Security"
# CC6 - Logical and Physical Access Controls
- id: "CC6.1"
name: "인증 메커니즘"
description: "사용자 인증 및 접근 통제"
implementation:
- "Okta SSO"
- "Google Authenticator MFA"
- "비밀번호 정책 (12자+, 90일 교체)"
evidence:
- "SSO 설정 스크린샷"
- "MFA 적용률 리포트"
- "비밀번호 정책 문서"
status: "implemented"
owner: "IT"
- id: "CC6.7"
name: "데이터 암호화"
description: "저장 및 전송 중인 데이터 암호화"
implementation:
- "AWS KMS로 저장 데이터 암호화"
- "TLS 1.3 필수"
- "데이터베이스 암호화"
evidence:
- "KMS 키 정책"
- "SSL Labs 스캔 결과"
- "RDS 암호화 설정 스크린샷"
status: "implemented"
owner: "Platform Team"
# CC7 - System Operations
- id: "CC7.2"
name: "시스템 모니터링"
description: "시스템 성능 및 보안 이벤트 모니터링"
implementation:
- "Datadog APM/인프라 모니터링"
- "AWS CloudWatch 알람"
- "SIEM (Splunk)"
evidence:
- "모니터링 대시보드 스크린샷"
- "알림 설정 문서"
- "월간 모니터링 리포트"
status: "implemented"
owner: "SRE"
- id: "CC7.4"
name: "인시던트 대응"
description: "보안 인시던트 탐지 및 대응"
implementation:
- "인시던트 대응 계획"
- "PagerDuty 온콜 로테이션"
- "사후 분석(Postmortem) 프로세스"
evidence:
- "IRP 문서"
- "인시던트 로그"
- "Postmortem 기록"
status: "implemented"
owner: "Security Team"
# CC8 - Change Management
- id: "CC8.1"
name: "변경 관리"
description: "시스템 변경에 대한 통제"
implementation:
- "GitHub PR 필수"
- "코드 리뷰 (2명 이상)"
- "CI/CD 자동화 테스트"
evidence:
- "GitHub 브랜치 보호 설정"
- "PR 승인 기록"
- "배포 로그"
status: "implemented"
owner: "Engineering"
# CC9 - Risk Mitigation
- id: "CC9.2"
name: "공급업체 관리"
description: "서브서비스 조직에 대한 리스크 관리"
implementation:
- "공급업체 보안 평가"
- "연간 공급업체 검토"
- "계약서 보안 조항"
evidence:
- "공급업체 평가 체크리스트"
- "AWS, GCP SOC 2 보고서"
- "계약서 보안 조항"
status: "implemented"
owner: "Legal/Security"
# A - Availability
availability:
category: "A"
required: false
controls:
- id: "A1.1"
name: "시스템 가용성"
description: "서비스 가용성 목표 및 모니터링"
implementation:
- "99.9% SLA 약정"
- "멀티 AZ 배포"
- "자동 스케일링"
evidence:
- "SLA 문서"
- "가용성 대시보드"
- "인프라 아키텍처 다이어그램"
status: "implemented"
owner: "SRE"
- id: "A1.2"
name: "재해 복구"
description: "비즈니스 연속성 및 재해 복구 계획"
implementation:
- "DR 계획 수립"
- "연 2회 DR 테스트"
- "데이터 백업 (일일)"
evidence:
- "DR 계획 문서"
- "DR 테스트 결과"
- "백업 로그"
status: "implemented"
owner: "Infrastructure"
# C - Confidentiality
confidentiality:
category: "C"
required: false
controls:
- id: "C1.1"
name: "기밀 정보 식별"
description: "기밀 정보의 식별 및 분류"
implementation:
- "데이터 분류 정책"
- "민감 데이터 태깅"
evidence:
- "데이터 분류 정책"
- "데이터 인벤토리"
status: "implemented"
owner: "Data Team"
# 예외 및 관찰 사항
exceptions:
- control_id: "CC5.2"
description: "일부 레거시 시스템 MFA 미적용"
compensating_control: "IP 화이트리스트 및 추가 모니터링"
remediation_date: "2025-Q1"
# 감사 준비 상태
readiness:
controls_implemented: 23
controls_total: 25
evidence_collected: true
management_assertion_ready: true
"We have a SOC 2 Type II report. Over the past 12 months, we were audited against three Trust Services Criteria: Security, Availability, and Confidentiality, and received an unqualified opinion. We can share the full report after an NDA is signed. We have also obtained the SOC 2 reports of AWS and GCP as subservice evidence."
💬 In a SOC 2 Audit Preparation Meeting
"This year's Type II audit period runs from January to December. We need to collect evidence for each key control. For CC6.1 access control, we need Okta logs and quarterly access review records; for CC7.2 monitoring, Datadog dashboards and alert settings; and for CC8.1 change management, GitHub PR records. Let's automate evidence collection so we don't scramble right before the audit."
💬 In a Kickoff Meeting with the Auditor
"The audit scope is Security (all CC), Availability (A1), and Confidentiality (C1). Our subservice organizations are AWS, GCP, and Okta, and we apply the Inclusive Method. The system boundary is limited to the production environment, and the development/staging environments are excluded. If you share the evidence request list and schedule, we will assign the responsible personnel."
⚠️ Cautions & Best Practices
❌
Holding only Type I (no Type II)
Type I verifies only the design suitability at a specific point in time. Most enterprise customers require Type II, which verifies operating effectiveness. With Type I alone, you may be rejected in sales. After obtaining Type I in the first year, start preparing for Type II right away.
❌
Collecting evidence right before the audit
SOC 2 Type II requires evidence covering the entire audit period (6-12 months). If you collect it right before the audit, gaps will occur during the period and be recorded as exceptions. Build an automated evidence collection system. Use compliance automation tools such as Vanta, Drata, and Secureframe.
❌
Neglecting subservice organization management
If you do not obtain the SOC 2 reports of subservice organizations such as AWS and GCP, the audit scope will be incomplete. Choose the appropriate approach between the Carve-out (exclusion) and Inclusive (inclusion) methods, and renew the subservice organizations' reports every year.
✅
SOC 2 Best Practices
Implement early preparation (at least 6 months in advance), automated evidence collection (Vanta, Drata, etc.), clear system boundary definition, alignment between policies and actual operations, minimization of exceptions, an internal Readiness Assessment, and securing subservice reports. Mapping controls to ISO 27001 can reduce duplicated work.