Compliance Framework

security

Compliance Framework

Definition and Overview

A compliance framework is a structured set of guidelines, regulations, and controls that organizations must implement to meet legal, regulatory, or industry requirements. Frameworks define what security controls are needed, how they should be implemented, and how compliance is assessed. Common frameworks include GDPR (data privacy), NIS2 (network security), ISO 27001 (information security management), SOC 2 (service organization controls), and PCI DSS (payment card industry).

Compliance frameworks serve as the bridge between abstract security goals and concrete, measurable controls. They translate legislative intent ("organizations must protect personal data") into specific technical and organizational requirements ("implement encryption for data at rest and in transit, maintain access logs for 12 months, conduct annual penetration testing"). This translation is critical because it provides a clear, auditable standard against which an organization's security posture can be measured.

The compliance landscape has grown increasingly complex as digital regulation expands globally. Organizations operating across jurisdictions must satisfy multiple overlapping frameworks simultaneously -- GDPR for EU data protection, NIS2 for network security, local regulations like the Czech ZKB, and industry standards like ISO 27001. This multi-framework reality demands automated assessment tools that can map technical findings to multiple regulatory requirements in parallel, which is precisely what Prismatic Perimeter delivers.

Technical Deep Dive

Framework Taxonomy

Compliance frameworks can be categorized by their origin and enforceability:

CategoryExamplesEnforcementPenalties
Regulatory (Mandatory)GDPR, NIS2, ZKB, HIPAALegal requirementFines up to 2-4% of global revenue
Industry StandardPCI DSS, SOC 2Contractual requirementLoss of business relationships
Voluntary StandardISO 27001, NIST CSFSelf-imposedLoss of certification
Internal PolicyCompany security policiesOrganizationalDisciplinary action

Control Categories

Most frameworks organize controls into common categories:

CategoryDescriptionExample Controls
GovernanceOrganizational structure and accountabilitySecurity policy, roles and responsibilities, risk management
Access ControlWho can access what resourcesAuthentication, authorization, privilege management
Data ProtectionSafeguarding data confidentiality and integrityEncryption, backup, data classification
Network SecurityProtecting network infrastructureFirewalls, segmentation, intrusion detection
Incident ResponseHandling security incidentsDetection, containment, notification, recovery
Business ContinuityMaintaining operations during disruptionsDR planning, redundancy, failover
MonitoringObserving and recording system activityLogging, alerting, audit trails
Supply ChainManaging third-party security risksVendor assessment, contractual requirements

Framework Maturity Levels

Organizations progress through maturity levels in their compliance journey:

LevelNameDescription
1InitialAd hoc controls, no formal framework
2DevelopingFramework selected, controls being implemented
3DefinedControls documented and consistently applied
4ManagedControls measured and monitored with metrics
5OptimizingContinuous improvement based on metrics and threat intelligence

NIS2 Directive (EU 2022/2555)

The Network and Information Security Directive 2 (NIS2) is the EU's primary cybersecurity regulation, replacing the original NIS Directive:

AspectDetail
ScopeEssential and important entities across 18 sectors
RequirementsRisk management, incident reporting, supply chain security
ReportingSignificant incidents reported within 24 hours (early warning), 72 hours (full notification)
PenaltiesUp to 10M EUR or 2% of global turnover for essential entities
EffectiveOctober 2024 (member state transposition)
Key ArticlesArt. 21 (risk management measures), Art. 23 (incident reporting)

ZKB 264/2025 Sb. (Czech Cybersecurity Act)

The Czech national transposition of NIS2 with additional local requirements:

AspectDetail
ScopeCritical infrastructure, essential services, important entities
RegistryNUKIB (National Cyber and Information Security Agency)
RequirementsSecurity documentation, risk assessment, incident handling
ReportingAligned with NIS2 timelines plus NUKIB-specific requirements
LanguageCzech language documentation required
AuditRegular audits by NUKIB-certified auditors

Architecture and Implementation

Compliance Assessment Engine

defmodule PrismaticPerimeter.Compliance.Engine do
  @moduledoc """
  Multi-framework compliance assessment engine.
  Evaluates discovered assets against framework requirements
  and maps technical findings to regulatory controls.
  """

  @frameworks [:nis2, :zkb, :iso27001, :gdpr]

  @spec assess(String.t(), [atom()]) :: {:ok, map()} | {:error, term()}
  def assess(target, frameworks \\ [:nis2, :zkb]) do
    with {:ok, assets} <- PrismaticPerimeter.discover(target),
         {:ok, findings} <- analyze_security_posture(assets) do
      assessments = Enum.map(frameworks, fn framework ->
        {framework, assess_framework(framework, findings)}
      end)

      {:ok, %{
        target: target,
        assessed_at: DateTime.utc_now(),
        frameworks: Map.new(assessments),
        overall_status: calculate_overall_status(assessments)
      }}
    end
  end

  defp assess_framework(:nis2, findings) do
    controls = PrismaticPerimeter.Compliance.NIS2.controls()

    Enum.map(controls, fn control ->
      evidence = evaluate_control(control, findings)
      %{
        article: control.article,
        requirement: control.description,
        status: evidence.status,
        evidence: evidence.details,
        remediation: if(evidence.status == :fail, do: control.remediation)
      }
    end)
  end

  defp assess_framework(:zkb, findings) do
    controls = PrismaticPerimeter.Compliance.ZKB.controls()
    Enum.map(controls, fn control ->
      evaluate_control(control, findings)
    end)
  end
end

Control Mapping

defmodule PrismaticPerimeter.Compliance.NIS2 do
  @moduledoc """
  NIS2 Directive control definitions and assessment logic.
  Maps Article 21 requirements to technical checks.
  """

  def controls do
    [
      %{
        article: "Art. 21(2)(a)",
        description: "Policies on risk analysis and information system security",
        checks: [:security_policy, :risk_assessment, :asset_inventory],
        remediation: "Implement documented security policy and risk assessment process"
      },
      %{
        article: "Art. 21(2)(b)",
        description: "Incident handling",
        checks: [:incident_response_plan, :detection_capability, :notification_process],
        remediation: "Establish incident response procedures with 24h notification capability"
      },
      %{
        article: "Art. 21(2)(c)",
        description: "Business continuity and crisis management",
        checks: [:backup_strategy, :dr_plan, :bcp_testing],
        remediation: "Implement and test business continuity and disaster recovery plans"
      },
      %{
        article: "Art. 21(2)(d)",
        description: "Supply chain security",
        checks: [:vendor_assessment, :dependency_scanning, :third_party_monitoring],
        remediation: "Assess and monitor supply chain security including dependencies"
      },
      %{
        article: "Art. 21(2)(e)",
        description: "Security in network and information systems acquisition",
        checks: [:secure_development, :vulnerability_management, :patch_management],
        remediation: "Implement secure development lifecycle and vulnerability management"
      },
      %{
        article: "Art. 21(2)(h)",
        description: "Policies and procedures regarding use of cryptography and encryption",
        checks: [:tls_configuration, :certificate_management, :key_management],
        remediation: "Deploy strong cryptography with proper key and certificate management"
      },
      %{
        article: "Art. 21(2)(j)",
        description: "Use of multi-factor authentication and continuous authentication",
        checks: [:mfa_deployment, :authentication_strength, :session_management],
        remediation: "Deploy MFA for all administrative and critical system access"
      }
    ]
  end
end

Compliance Report Generation

defmodule PrismaticPerimeter.Compliance.Report do
  @moduledoc """
  Generates compliance assessment reports for regulatory submission.
  """

  @spec generate(map(), atom()) :: {:ok, String.t()}
  def generate(assessment, format \\ :markdown) do
    report = """
    # Compliance Assessment Report
    ## Target: #{assessment.target}
    ## Date: #{DateTime.to_iso8601(assessment.assessed_at)}

    ## Executive Summary
    #{executive_summary(assessment)}

    ## Framework Assessments
    #{framework_details(assessment.frameworks)}

    ## Gap Analysis
    #{gap_analysis(assessment)}

    ## Remediation Roadmap
    #{remediation_roadmap(assessment)}

    ## Evidence Inventory
    #{evidence_inventory(assessment)}
    """

    {:ok, report}
  end

  defp executive_summary(assessment) do
    total_controls = count_controls(assessment.frameworks)
    passing = count_passing(assessment.frameworks)
    percentage = Float.round(passing / max(total_controls, 1) * 100, 1)

    """
    Overall compliance score: #{percentage}% (#{passing}/#{total_controls} controls passing)
    Status: #{assessment.overall_status}
    Frameworks assessed: #{Map.keys(assessment.frameworks) |> Enum.join(", ")}
    """
  end
end

Usage in Prismatic Platform

The Prismatic Perimeter implements compliance assessment for NIS2 and ZKB frameworks, with extensibility for additional frameworks.

Compliance Dashboard

The compliance assessment is accessible via Phoenix LiveView at /perimeter/compliance:

defmodule PrismaticPerimeterWeb.ComplianceLive do
  use PrismaticPerimeterWeb, :live_view

  @impl true
  def mount(_params, _session, socket) do
    {:ok, assign(socket,
      frameworks: [:nis2, :zkb],
      assessment: nil,
      loading: false
    )}
  end

  @impl true
  def handle_event("assess", %{"target" => target}, socket) do
    {:ok, assessment} = PrismaticPerimeter.assess_compliance(
      target,
      socket.assigns.frameworks
    )

    {:noreply, assign(socket, assessment: assessment, loading: false)}
  end
end

API Integration

# Assess compliance via REST API
curl -X POST http://localhost:4004/api/v1/perimeter/assess_compliance \
  -H "Content-Type: application/json" \
  -d '{"domain": "example.com", "frameworks": ["nis2", "zkb"]}'

# Response:
# {
#   "target": "example.com",
#   "overall_status": "partial_compliance",
#   "nis2": {"passing": 5, "failing": 2, "total": 7},
#   "zkb": {"passing": 4, "failing": 1, "total": 5}
# }

Security Rating Contextualization

Security ratings (A-F) are contextualized against specific compliance frameworks:

RatingNIS2 ImplicationZKB Implication
A (850-900)Full compliance expectedFull compliance expected
B (700-849)Minor gaps, likely compliantMinor gaps, remediation recommended
C (550-699)Material gaps, partial complianceMaterial gaps, NUKIB review risk
D (400-549)Significant gaps, non-compliantSignificant gaps, enforcement risk
F (300-399)Critical gaps, enforcement likelyCritical gaps, immediate action required

Best Practices

  1. Assess against multiple frameworks simultaneously -- Organizations typically face multiple compliance obligations. Map findings to all applicable frameworks in a single assessment pass.

  2. Automate evidence collection -- Manual evidence gathering is slow, error-prone, and stale by the time auditors review it. Automate technical control verification.

  3. Maintain continuous compliance -- Point-in-time assessments create a false sense of security. Implement continuous monitoring to detect compliance drift between formal assessments.

  4. Map technical findings to business risk -- Compliance gaps should be communicated in terms of regulatory risk (fines, enforcement actions), not just technical deficiencies.

  5. Version control your policies -- Compliance documentation should be version-controlled, reviewed regularly, and updated when regulations change.

  6. Plan for framework evolution -- Regulations change. Design your compliance engine to be extensible so new frameworks and updated control requirements can be added without architectural changes.

Common Pitfalls

  • Checkbox compliance: Implementing controls to pass audits rather than to genuinely protect the organization. This creates a false sense of security and fails under real-world threats.

  • Framework proliferation: Attempting to comply with too many frameworks simultaneously without a unified control mapping. Use a master control framework (like NIST CSF) and map other frameworks to it.

  • Stale assessments: Treating a point-in-time compliance assessment as a permanent state. Infrastructure and threats change continuously; assessments must be recurring.

  • Missing evidence: Having controls in place but no evidence of their operation. Auditors require proof, not assertions.

  • Ignoring scope definition: Failing to clearly define what systems and data are in scope for each framework. Scope creep or underscoping both create compliance risks.

  • GDPR -- EU data protection regulation assessed by the platform
  • NIS2 -- EU network and information security directive
  • ZKB -- Czech cybersecurity regulation
  • Security Rating -- Technical score contextualized against compliance frameworks
  • EASM -- External attack surface management providing compliance data
  • CVE -- Vulnerability identifiers used in compliance assessments

Further Reading


Connect & Contribute

Created by Tomáš Korcak (korczis) | Open Source under GHL