Pular para o conteúdo

Comp AI

Comp AI is an open-source compliance automation platform designed to help organizations achieve and maintain SOC 2, ISO 27001, HIPAA, and GDPR compliance. It automates evidence collection, manages policies, maps controls across frameworks, and streamlines audit preparation, reducing manual compliance work and improving security posture.

  • Docker and Docker Compose (recommended for self-hosted)
  • Node.js 18+ (for local development)
  • PostgreSQL 14+ (for data persistence)
  • Git for cloning the repository
# Clone the Comp AI repository
git clone https://github.com/complianceai/compai.git
cd compai

# Copy environment configuration
cp .env.example .env

# Edit .env with your settings
nano .env

# Start services with Docker Compose
docker-compose up -d

# Run database migrations
docker-compose exec api npm run migrate

# Access the dashboard at http://localhost:3000
# Install dependencies
npm install

# Initialize database
npm run db:init

# Start development server
npm run dev

# Start in watch mode with hot reload
npm run dev:watch
FilePurpose
.envEnvironment variables (database, API keys, SMTP)
config/frameworks.yamlFramework definitions and control mappings
config/policies.yamlOrganization policy templates
config/integrations.yamlCloud provider and tool credentials
# Initialize SOC 2 framework
comp-ai framework init --type soc2 --scope service-organization

# Configure trust service criteria
comp-ai framework configure soc2 \
  --cc (security|availability|processing-integrity|confidentiality|privacy)

# Specify audit period
comp-ai framework set-period soc2 \
  --start-date 2024-01-01 \
  --end-date 2024-12-31
# Initialize ISO 27001 framework
comp-ai framework init --type iso27001

# Define asset inventory
comp-ai assets add --name "Database Servers" \
  --type infrastructure \
  --criticality high

# Map organizational scope
comp-ai scope define --departments IT,Security,HR \
  --locations "US-East,EU-West"
# Initialize HIPAA framework
comp-ai framework init --type hipaa \
  --organization-type covered-entity

# Configure security rules
comp-ai hipaa configure \
  --require-encryption true \
  --audit-log-retention 90 \
  --access-control strict

# Define PHI data locations
comp-ai data-inventory add --classification PHI \
  --location "Cloud Database" \
  --access-restricted true
# Initialize GDPR framework
comp-ai framework init --type gdpr \
  --region EU

# Configure data processing agreements
comp-ai gdpr set-dpa \
  --processor "Cloud Provider Name" \
  --scc-version sccc2021

# Define data subjects and purposes
comp-ai gdpr add-purpose \
  --name "Marketing Communications" \
  --legal-basis legitimate-interest
SourceFrameworkCollection Interval
AWS CloudTrailSOC 2, ISO 27001Real-time
GCP Audit LogsSOC 2, ISO 27001Real-time
Azure Activity LogSOC 2, ISO 27001Real-time
Git CommitsISO 27001Hourly
VPN Access LogsHIPAA, ISO 27001Continuous
Backup ReportsAllDaily
Vulnerability ScansAllWeekly
Patch ManagementAllReal-time
# Enable AWS evidence collection
comp-ai evidence enable aws \
  --access-key-id ${AWS_ACCESS_KEY} \
  --secret-access-key ${AWS_SECRET_KEY} \
  --regions us-east-1,eu-west-1

# Enable GCP evidence collection
comp-ai evidence enable gcp \
  --project-id my-gcp-project \
  --service-account-key /path/to/key.json

# Enable Azure evidence collection
comp-ai evidence enable azure \
  --tenant-id ${AZURE_TENANT_ID} \
  --subscription-id ${AZURE_SUBSCRIPTION_ID}
# Map evidence to controls
comp-ai evidence map \
  --evidence-id "aws-cloudtrail-123" \
  --control-id "CC6.1" \
  --framework soc2

# Bulk map evidence by pattern
comp-ai evidence map-bulk \
  --pattern "vpc-*" \
  --control-id "CC9.2" \
  --framework iso27001
# Validate evidence for completeness
comp-ai evidence validate --framework soc2

# Generate evidence gap report
comp-ai evidence gaps --framework iso27001 --export pdf
# Create new policy from template
comp-ai policy create --template "access-control" \
  --name "Access Control Policy v2.0" \
  --framework iso27001

# List all policies
comp-ai policy list --framework all

# Update policy version
comp-ai policy update --policy-id "POL-001" \
  --version "2.1" \
  --change-log "Updated MFA requirements"

# Assign policy to departments
comp-ai policy assign --policy-id "POL-001" \
  --departments IT,Security
TemplateFrameworkPurpose
access-controlAllUser and system access management
incident-responseAllSecurity incident procedures
asset-managementISO 27001, SOC 2Asset inventory and lifecycle
encryptionAllData encryption standards
vulnerability-managementAllVulnerability assessment and remediation
change-managementSOC 2, ISO 27001Change approval and tracking
business-continuityISO 27001, SOC 2Disaster recovery planning
dpiaGDPRData Protection Impact Assessment
consent-managementGDPRConsent collection and proof
data-retentionGDPR, HIPAAData lifecycle and deletion
# Link policy to control
comp-ai policy link --policy-id "POL-001" \
  --control-id "A.9.2.1" \
  --framework iso27001

# Track policy acknowledgments
comp-ai policy ack list --policy-id "POL-001"

# Generate policy effectiveness report
comp-ai policy report --policy-id "POL-001" \
  --include-violations true
# Show control crosswalk
comp-ai controls crosswalk \
  --source-framework soc2 \
  --target-framework iso27001

# Map specific control
comp-ai controls map --control-id "CC6.1" \
  --from soc2 --to iso27001

# Export crosswalk matrix
comp-ai controls export-matrix \
  --frameworks soc2,iso27001,hipaa \
  --output csv
SOC 2 CCISO 27001 A.HIPAA §GDPR Article
CC1.1A.15.2.1164.308(a)(1)5(1)(a)
CC2.1A.5.1.1164.308(a)(2)5(1)(b)
CC6.1A.9.2.1164.312(a)(2)32(1)(b)
CC6.2A.9.4.1164.312(d)32(1)(c)
CC9.2A.12.6.1164.312(b)32(1)(d)
# Check control implementation status
comp-ai controls status --framework soc2

# Mark control as implemented
comp-ai controls implement --control-id "CC6.1" \
  --evidence-id "POL-001,PROC-002" \
  --implementation-date 2024-03-15

# Track control maturity
comp-ai controls maturity --framework iso27001
# Connect AWS account
comp-ai integrate aws \
  --access-key-id ${AWS_KEY} \
  --secret-access-key ${AWS_SECRET} \
  --external-id compliance-audit

# Enable specific AWS services
comp-ai integrate aws-enable \
  --services s3,ec2,rds,iam,cloudtrail \
  --auto-remediate false

# Sync AWS Config findings
comp-ai integrate aws-sync \
  --service config \
  --frequency hourly
# Connect GCP project
comp-ai integrate gcp \
  --project-id my-project \
  --service-account-key /path/to/key.json

# Enable GCP logging
comp-ai integrate gcp-enable \
  --services logging,cloudaudit,compute,iam \
  --sink-dataset compliance_logs
# Connect Azure subscription
comp-ai integrate azure \
  --tenant-id ${TENANT_ID} \
  --subscription-id ${SUB_ID} \
  --client-id ${CLIENT_ID} \
  --client-secret ${CLIENT_SECRET}

# Configure Azure Policy
comp-ai integrate azure-policies \
  --initiative "SOC2 Compliance" \
  --auto-remediate true
# Connect Okta for access logs
comp-ai integrate okta \
  --org-url https://org.okta.com \
  --api-token ${OKTA_TOKEN}

# Connect GitHub for code evidence
comp-ai integrate github \
  --org myorganization \
  --token ${GITHUB_TOKEN}

# Connect Slack for incident notifications
comp-ai integrate slack \
  --webhook-url ${SLACK_WEBHOOK}
# Generate SOC 2 audit report
comp-ai audit report --framework soc2 \
  --period "2024-01-01:2024-12-31" \
  --format pdf \
  --output soc2-report.pdf

# Generate ISO 27001 audit readiness
comp-ai audit readiness --framework iso27001 \
  --include-gaps true \
  --format html

# Create executive summary
comp-ai audit summary --framework hipaa \
  --audience executive
# Prepare evidence package for auditor
comp-ai audit evidence-package \
  --framework soc2 \
  --auditor-email auditor@firmname.com \
  --access-duration 30 \
  --output audit-package.zip

# Grant auditor portal access
comp-ai audit grant-access \
  --auditor "John Auditor" \
  --email auditor@firm.com \
  --frameworks soc2,iso27001 \
  --expires 2025-01-31

# Track auditor activity
comp-ai audit auditor-activity --auditor-id AUD-001
# Generate compliance score
comp-ai dashboard compliance-score \
  --frameworks soc2,iso27001,hipaa,gdpr

# Export dashboard data
comp-ai dashboard export \
  --metrics all \
  --format json \
  --output dashboard-data.json
# Enable real-time monitoring
comp-ai monitor enable \
  --frameworks soc2,iso27001 \
  --alert-threshold critical

# Set up alert rules
comp-ai alerts create \
  --name "Unauthorized Access Attempt" \
  --condition "failed_login_count > 5 in 15m" \
  --severity critical \
  --action slack

# Configure SLA monitoring
comp-ai monitor sla \
  --metric "control-effectiveness" \
  --target 95 \
  --measurement-period monthly
Alert TypeTriggerDefault Action
Unimplemented ControlsControl has no evidenceEmail security team
Stale EvidenceEvidence older than 30 daysSlack notification
Policy ViolationsNon-compliance detectedEscalate to manager
Access AnomaliesUnusual access patternsBlock + alert
Certification Expiry< 90 days to expirationEmail team lead
# View compliance metrics dashboard
comp-ai metrics dashboard --frameworks all

# Export metrics for analytics
comp-ai metrics export \
  --start-date 2024-01-01 \
  --end-date 2024-12-31 \
  --output metrics.csv

# Generate trend analysis
comp-ai metrics trends \
  --metric "control-coverage" \
  --period quarterly
CommandPurpose
comp-ai framework init --type [soc2|iso27001|hipaa|gdpr]Initialize a compliance framework
comp-ai framework statusShow framework status and completeness
comp-ai framework exportExport framework configuration
comp-ai framework import --file config.yamlImport framework configuration
CommandPurpose
comp-ai evidence listList all collected evidence
comp-ai evidence enable [provider]Enable evidence source
comp-ai evidence validateValidate evidence completeness
comp-ai evidence gapsShow evidence gaps by control
CommandPurpose
comp-ai policy create --template [name]Create policy from template
comp-ai policy listList all policies
comp-ai policy assignAssign policy to teams
comp-ai policy acknowledgeTrack policy acceptance
CommandPurpose
comp-ai controls listList all controls
comp-ai controls mapMap controls across frameworks
comp-ai controls implementMark control as implemented
comp-ai controls evidenceLink control to evidence
CommandPurpose
comp-ai audit reportGenerate audit report
comp-ai audit readinessCheck audit readiness
comp-ai audit evidence-packagePrepare auditor package
comp-ai audit grant-accessGrant auditor portal access
# Get API token
comp-ai api get-token --expires-in 3600

# Use token in requests
curl -H "Authorization: Bearer ${API_TOKEN}" \
  https://api.compai.local/v1/frameworks
EndpointMethodPurpose
/v1/frameworksGETList frameworks
/v1/controlsGETList all controls
/v1/evidenceGET, POSTManage evidence
/v1/policiesGET, POST, PUTManage policies
/v1/audit/reportPOSTGenerate report
/v1/integrationsGET, POSTManage integrations
# Get control details
curl -H "Authorization: Bearer ${TOKEN}" \
  https://api.compai.local/v1/controls/CC6.1

# Submit evidence
curl -X POST -H "Authorization: Bearer ${TOKEN}" \
  -H "Content-Type: application/json" \
  -d '{"control_id":"CC6.1","evidence_type":"screenshot","value":"..."}' \
  https://api.compai.local/v1/evidence

# Get compliance status
curl -H "Authorization: Bearer ${TOKEN}" \
  https://api.compai.local/v1/compliance/status?framework=soc2
# Show all controls across all frameworks
comp-ai crosswalk view --mode unified

# Compare framework requirements
comp-ai crosswalk compare \
  --framework1 soc2 \
  --framework2 iso27001 \
  --output comparison.html

# Identify overlapping controls
comp-ai crosswalk overlap --frameworks soc2,iso27001,hipaa
# Generate control equivalency matrix
comp-ai crosswalk matrix \
  --frameworks soc2,iso27001,hipaa,gdpr \
  --format xlsx \
  --output control-matrix.xlsx

# Map custom controls
comp-ai crosswalk map-custom \
  --control-id "CUSTOM-001" \
  --maps-to "CC6.1,A.9.2.1,164.312(a)(2)"
  • Start with risk assessment: Identify high-impact controls first
  • Integrate early: Connect cloud providers before evidence collection
  • Automate evidence: Minimize manual evidence gathering
  • Regular review: Run compliance checks monthly, not quarterly
  • Documentation: Maintain clear audit trails for all changes
  • Team training: Ensure staff understand their policy responsibilities
# Update framework definitions
comp-ai framework update --type soc2 --version latest

# Refresh all evidence sources
comp-ai evidence refresh --all

# Run compliance health check
comp-ai health check --frameworks all
  • Use OAuth2 for all integrations
  • Enable audit logging for all platform activities
  • Rotate API tokens quarterly
  • Encrypt evidence at rest and in transit
  • Restrict auditor access by framework and duration
  • Use network policies to limit database access