import type { Severity, WAFPillars } from '../types/analysis.types'; import type { ComplianceFramework } from '../types/rules.types'; /** * Condition types for custom rule evaluation. * These are evaluated against CloudFormation resource properties. */ export type CustomRuleCondition = { type: 'property_exists'; path: string; negate?: boolean; } | { type: 'property_equals'; path: string; value: unknown; negate?: boolean; } | { type: 'property_matches'; path: string; pattern: string; negate?: boolean; } | { type: 'property_gt'; path: string; value: number; } | { type: 'property_lt'; path: string; value: number; } | { type: 'and'; conditions: CustomRuleCondition[]; } | { type: 'or'; conditions: CustomRuleCondition[]; }; /** * A user-defined custom analysis rule. * Loaded from .cdk-insights-rules.json or the customRules section of .cdk-insights.json. */ export interface CustomRuleDefinition { ruleId: string; name: string; description: string; severity: Severity; wafPillar: WAFPillars; resourceTypes: string[]; recommendation: string; complianceFrameworks?: ComplianceFramework[]; condition: CustomRuleCondition; } export interface CustomRulesConfig { rules: CustomRuleDefinition[]; }