feat(security): add CloudWatch logging and VPC flow log rules, expand…#10
Merged
feat(security): add CloudWatch logging and VPC flow log rules, expand…#10
Conversation
… ML to 7D - Add check_missing_logging(): flags HIGH when infrastructure resources exist with no aws_cloudtrail or aws_cloudwatch_log_group present - Add check_missing_vpc_flow_logs(): flags MEDIUM when aws_vpc exists without a corresponding aws_flow_log resource - Wire both new checks into SecurityRuleEngine.analyze() with severity override support via settings.severity_overrides Dict[str, str] - Add severity_overrides field to Settings (default empty, no breaking change) - Expand ML feature vector from 5D to 7D (missing_logging, missing_flow_logs) - Update _validate_features bounds, _format_features names, empty-vector default in IntelligentSecurityScanner._extract_features() - Expand ml_model._train_baseline_model() baseline patterns, noise generation, edge cases, and feature_ranges metadata to 7 columns - Delete stale 5D model artifacts and retrain fresh 7D baseline - Update test_files/vulnerable.tf: add aws_vpc without flow logs (fires both rules) - Update test_files/secure.tf: add aws_vpc + aws_flow_log + aws_cloudtrail + aws_cloudwatch_log_group (no new rules fire) - Update test_files/mixed.tf: add aws_vpc + aws_cloudtrail without aws_flow_log (only missing_vpc_flow_logs fires) - New tests/test_security_rules_logging.py: 12 focused unit tests covering check_missing_logging, check_missing_vpc_flow_logs, severity overrides, and boundary/empty cases - Update test_security_scanner.py: fix 4 pre-existing rule engine tests to filter by message keyword (not brittle total count), update feature extraction assertion from 5D to 7D, fix format_features expected dict, update all ml_predictor test inputs to 7D arrays - All 318 tests pass, flake8 clean
TerraSafe Security Scan ResultsThreshold: 70 | Status: ❌ FAILED
Summary: 1/3 files exceed threshold (max score: 81) Details for test_files/mixed.tf (score: 37)
Details for test_files/vulnerable.tf (score: 81)
|
oguarni
added a commit
that referenced
this pull request
Mar 20, 2026
feat(security): add CloudWatch logging and VPC flow log rules, expand…
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
… ML to 7D