Interface FrameworkRules<T>
- Type Parameters:
T- the context type (e.g., SystemContext in cloudforge-api)
- All Known Implementing Classes:
AdvancedMonitoringRules, CdnApiSecurityRules, ComputeSecurityRules, ConfigurationValidationRules, DatabaseSecurityRules, ElbSecurityRules, GdprOrganizationalRules, GdprRules, HipaaOrganizationalRules, HipaaRules, IamSecurityRules, IncidentResponseRules, Iso27001Rules, KeyManagementRules, LambdaSecurityRules, MessagingSecurityRules, PciDssRules, Soc2Rules, ThreatProtectionRules
Implementations of this interface define compliance validation rules for specific frameworks (HIPAA, PCI-DSS, SOC2, etc.) or cross-framework concerns (key management, database security, monitoring).
This interface uses a generic type parameter to avoid coupling the core module to specific implementation details. Concrete implementations in cloudforge-api will use SystemContext as the type parameter.
Implementation Pattern:
@ComplianceFramework(value = "FEDRAMP", priority = 50)
public final class FedRampRules implements FrameworkRules<SystemContext> {
@Override
public void install(SystemContext ctx) {
ctx.getNode().addValidation(() -> {
List<ComplianceRule> rules = new ArrayList<>();
// Add validation rules
rules.add(ComplianceRule.pass("FEDRAMP-AC-2", "Account Management"));
// Return failures
return rules.stream()
.filter(r -> !r.passed())
.map(ComplianceRule::toErrorString)
.flatMap(Optional::stream)
.toList();
});
}
@Override
public Map<String, Object> getRequiredConfiguration() {
return Map.of(
"logRetentionDays", 2190, // 6 years
"guardDutyEnabled", true,
"macieEnabled", true
);
}
}
Discovery:
Framework implementations are automatically discovered via the ComplianceFramework
annotation and loaded by the CloudForge compliance system.
- Since:
- 3.0.0
-
Method Summary
Modifier and TypeMethodDescriptiondefault booleanCheck if this framework should always be loaded.default StringGet the framework description.default StringGet the human-readable display name for this framework.default StringGet the framework identifier from theComplianceFrameworkannotation.Get the minimum required deployment configuration for this compliance framework.voidInstall compliance validation rules into the CDK construct tree.default intpriority()Get the load priority for this framework.
-
Method Details
-
install
Install compliance validation rules into the CDK construct tree.This method is called during CDK synthesis to register validation rules for the compliance framework. Implementations should use
ctx.getNode().addValidation()to add CDK validations.- Parameters:
ctx- the system context containing deployment configuration and CDK stack
-
frameworkId
Get the framework identifier from theComplianceFrameworkannotation.- Returns:
- the framework identifier (e.g., "HIPAA", "PCI-DSS")
-
displayName
Get the human-readable display name for this framework.- Returns:
- the display name, defaulting to
frameworkId()if not specified
-
description
-
priority
default int priority()Get the load priority for this framework.- Returns:
- the priority (lower values load first)
-
alwaysLoad
default boolean alwaysLoad()Check if this framework should always be loaded.- Returns:
- true if this framework loads regardless of configuration
-
getRequiredConfiguration
Get the minimum required deployment configuration for this compliance framework.This method returns the framework's baseline security requirements as DeploymentContext overrides. These values are applied as defaults when the framework is enabled, but can be overridden by explicit user configuration.
Precedence order:
- User-provided explicit configuration (cdk.json)
- Framework-required configuration (this method)
- Security profile defaults
Example implementation:
@Override public Map<String, Object> getRequiredConfiguration() { return Map.of( "logRetentionDays", 2190, // HIPAA: 6 years minimum "guardDutyEnabled", true, // HIPAA: threat detection required "macieEnabled", true, // HIPAA: PHI discovery required "securityHubEnabled", true, // HIPAA: centralized monitoring "inspectorEnabled", true // HIPAA: vulnerability scanning ); }Supported configuration keys:
logRetentionDays- CloudWatch log retention (Integer)guardDutyEnabled- AWS GuardDuty threat detection (Boolean)macieEnabled- Amazon Macie PII/PHI discovery (Boolean)securityHubEnabled- AWS Security Hub (Boolean)inspectorEnabled- Amazon Inspector vulnerability scanning (Boolean)cloudTrailEnabled- AWS CloudTrail audit logging (Boolean)wafEnabled- AWS WAF protection (Boolean)albAccessLogging- ALB access logs to S3 (Boolean)
- Returns:
- map of configuration keys to required values, empty map if no requirements
- Since:
- 3.1.0
-