Comprehensive guidance for data classification, handling requirements, and data lifecycle management.
When to Use This Skill
Establishing data classification policies
Defining handling requirements for different data types
Designing data protection controls by classification
Implementing data labeling and tagging
Creating data retention and disposal procedures
Classification Framework
Standard Sensitivity Levels
Level
Description
Examples
Impact of Breach
Public
Intentionally public
Marketing, published docs
None
Internal
General business use
Policies, org charts
Minimal
Confidential
관련 스킬
Business sensitive
Financial reports, contracts
Moderate
Restricted
Highly sensitive
PII, PHI, trade secrets
Severe
Top Secret
Critical/regulated
Encryption keys, M&A data
Catastrophic
Visual Labeling
┌─────────────────────────────────────────┐
│ █ PUBLIC │ Green
├─────────────────────────────────────────┤
│ █ INTERNAL - For Internal Use Only │ Blue
├─────────────────────────────────────────┤
│ █ CONFIDENTIAL - Authorized Only │ Yellow
├─────────────────────────────────────────┤
│ █ RESTRICTED - Need-to-Know Only │ Orange
├─────────────────────────────────────────┤
│ █ TOP SECRET - Strictly Controlled │ Red
└─────────────────────────────────────────┘
// Classification attributes
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Class)]
public class DataClassificationAttribute : Attribute
{
public DataClassification Level { get; }
public string? DataCategory { get; set; }
public string? RetentionPolicy { get; set; }
public string[] RequiredRoles { get; set; } = Array.Empty<string>();
public DataClassificationAttribute(DataClassification level)
{
Level = level;
}
}
public enum DataClassification
{
Public = 0,
Internal = 1,
Confidential = 2,
Restricted = 3,
TopSecret = 4
}
// Usage on domain models
public class Customer
{
public Guid Id { get; set; }
[DataClassification(DataClassification.Internal)]
public string Name { get; set; } = string.Empty;
[DataClassification(DataClassification.Restricted,
DataCategory = "PII",
RequiredRoles = new[] { "CustomerAdmin", "Support" })]
public string Email { get; set; } = string.Empty;
[DataClassification(DataClassification.Restricted,
DataCategory = "PII",
RetentionPolicy = "7years")]
public string SocialSecurityNumber { get; set; } = string.Empty;
[DataClassification(DataClassification.Confidential,
DataCategory = "Financial")]
public decimal CreditLimit { get; set; }
}
Classification-Based Access Control
public class ClassificationAuthorizationHandler
: AuthorizationHandler<DataAccessRequirement, object>
{
protected override Task HandleRequirementAsync(
AuthorizationHandlerContext context,
DataAccessRequirement requirement,
object resource)
{
var classificationAttr = resource.GetType()
.GetCustomAttribute<DataClassificationAttribute>();
if (classificationAttr == null)
{
context.Succeed(requirement);
return Task.CompletedTask;
}
var userClearance = GetUserClearanceLevel(context.User);
// User clearance must meet or exceed data classification
if ((int)userClearance >= (int)classificationAttr.Level)
{
// Check role requirements if specified
if (classificationAttr.RequiredRoles.Length > 0)
{
var hasRequiredRole = classificationAttr.RequiredRoles
.Any(r => context.User.IsInRole(r));
if (hasRequiredRole)
{
context.Succeed(requirement);
}
}
else
{
context.Succeed(requirement);
}
}
return Task.CompletedTask;
}
}
Field-Level Encryption
public class ClassificationBasedEncryption
{
private readonly IEncryptionService _encryptionService;
public async Task<T> ProtectData<T>(T data, CancellationToken ct) where T : class
{
var properties = typeof(T).GetProperties()
.Where(p => p.GetCustomAttribute<DataClassificationAttribute>() != null);
foreach (var prop in properties)
{
var attr = prop.GetCustomAttribute<DataClassificationAttribute>()!;
if (attr.Level >= DataClassification.Confidential)
{
var value = prop.GetValue(data) as string;
if (!string.IsNullOrEmpty(value))
{
var encrypted = await _encryptionService.Encrypt(value, ct);
prop.SetValue(data, encrypted);
}
}
}
return data;
}
}
Data Discovery and Inventory
Automated Classification
public class DataDiscoveryService
{
private readonly IRegexPatternMatcher _patternMatcher;
public ClassificationSuggestion AnalyzeContent(string content)
{
var detections = new List<DataTypeDetection>();
// Check for PII patterns
if (_patternMatcher.ContainsPattern(content, PiiPatterns.SocialSecurityNumber))
detections.Add(new DataTypeDetection("SSN", DataClassification.Restricted));
if (_patternMatcher.ContainsPattern(content, PiiPatterns.CreditCard))
detections.Add(new DataTypeDetection("Credit Card", DataClassification.Restricted));
if (_patternMatcher.ContainsPattern(content, PiiPatterns.Email))
detections.Add(new DataTypeDetection("Email", DataClassification.Confidential));
if (_patternMatcher.ContainsPattern(content, PiiPatterns.PhoneNumber))
detections.Add(new DataTypeDetection("Phone", DataClassification.Confidential));
// Check for financial patterns
if (_patternMatcher.ContainsPattern(content, FinancialPatterns.BankAccount))
detections.Add(new DataTypeDetection("Bank Account", DataClassification.Restricted));
// Determine highest classification
var suggestedLevel = detections.Any()
? detections.Max(d => d.Classification)
: DataClassification.Internal;
return new ClassificationSuggestion
{
SuggestedLevel = suggestedLevel,
Detections = detections,
Confidence = CalculateConfidence(detections)
};
}
}
public static class PiiPatterns
{
public static readonly string SocialSecurityNumber = @"\b\d{3}-\d{2}-\d{4}\b";
public static readonly string CreditCard = @"\b\d{4}[\s-]?\d{4}[\s-]?\d{4}[\s-]?\d{4}\b";
public static readonly string Email = @"\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}\b";
public static readonly string PhoneNumber = @"\b\d{3}[-.]?\d{3}[-.]?\d{4}\b";
}
Data Inventory Template
Data Inventory Entry:
asset_id: DATA-001
name: Customer Database
description: Master customer records
owner: Customer Service Department
custodian: IT Operations
location:
- Azure SQL Database (prod-sql-001)
- Daily backup to Azure Blob Storage
data_categories:
- PII (names, emails, addresses)
- Financial (payment history, credit limits)
- Behavioral (purchase history)
classification: Restricted
volume: ~2M records
sensitivity_reason: Contains PII and financial data
regulatory_requirements:
- GDPR (EU customers)
- CCPA (California customers)
retention:
active: Duration of customer relationship
archived: 7 years after relationship ends
access:
roles:
- CustomerAdmin (full access)
- Support (read-only)
- Analytics (anonymized only)
mfa_required: true
vpn_required: true
encryption:
at_rest: AES-256 (Transparent Data Encryption)
in_transit: TLS 1.3
backup:
frequency: Daily
retention: 30 days
tested: Monthly
last_review: 2025-01-15
next_review: 2025-07-15