Package com.cloudforgeci.api.core.rules
Class CdkNagControlMapper
java.lang.Object
com.cloudforgeci.api.core.rules.CdkNagControlMapper
Maps cdk-nag rule IDs to CloudForge SecurityControl enums for unified compliance reporting.
This mapper enables multi-layer defense-in-depth by correlating violations detected by cdk-nag with CloudForge's ComplianceMatrix framework. It supports:
- AwsSolutionsChecks (general AWS best practices)
- HIPAASecurityChecks (HIPAA-specific rules)
- PCIDSS321Checks (PCI-DSS-specific rules)
Usage Example:
Optional<SecurityControl> control = CdkNagControlMapper.mapRuleToControl("AwsSolutions-S3-2");
// Returns: Optional[ENCRYPTION_AT_REST]
- Since:
- 3.1.0
-
Method Summary
Modifier and TypeMethodDescriptionstatic StringGenerates a human-readable report of the mapping coverage.Gets all supported cdk-nag rule IDs.Gets statistics about the mapping coverage.Gets all cdk-nag rules mapped to a specific SecurityControl.static booleanhasMappingForRule(String ruleId) Checks if a cdk-nag rule has a mapping to a SecurityControl.mapRuleToControl(String ruleId) Maps a cdk-nag rule ID to the corresponding CloudForge SecurityControl.
-
Method Details
-
mapRuleToControl
Maps a cdk-nag rule ID to the corresponding CloudForge SecurityControl.- Parameters:
ruleId- the cdk-nag rule ID (e.g., "AwsSolutions-S3-2")- Returns:
- Optional containing the SecurityControl, or empty if no mapping exists
-
getRulesForControl
Gets all cdk-nag rules mapped to a specific SecurityControl.- Parameters:
control- the SecurityControl to lookup- Returns:
- List of rule IDs that map to this control
-
getAllMappedRules
Gets all supported cdk-nag rule IDs.- Returns:
- Set of all rule IDs with mappings
-
hasMappingForRule
Checks if a cdk-nag rule has a mapping to a SecurityControl.- Parameters:
ruleId- the cdk-nag rule ID- Returns:
- true if mapping exists, false otherwise
-
getMappingStatistics
Gets statistics about the mapping coverage.- Returns:
- Map containing mapping statistics
-
generateMappingReport
Generates a human-readable report of the mapping coverage.- Returns:
- Formatted report string
-