Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(cloudwatch): ignore new lines in filters #2912

Merged

Conversation

MrCloudSec
Copy link
Member

Description

Add flag re.DOTALL to ignore new line characters in CloudWatch metric filters.

License

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@MrCloudSec MrCloudSec requested a review from a team October 9, 2023 07:58
@MrCloudSec MrCloudSec linked an issue Oct 9, 2023 that may be closed by this pull request
Copy link
Member

@jfagoagas jfagoagas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's great!

Could you please include a test for each check setting the filterPattern with \n? Like:

{\n  ($.eventSource = config.amazonaws.com) &&\n  (($.eventName=StopConfigurationRecorder)||\n   ($.eventName=DeleteDeliveryChannel)||\n   ($.eventName=PutDeliveryChannel)||\n   ($.eventName=PutConfigurationRecorder))\n}

@jfagoagas jfagoagas self-requested a review October 9, 2023 08:01
Copy link
Member

@jfagoagas jfagoagas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See above comment.

@jfagoagas jfagoagas added the provider/aws Issues/PRs related with the AWS provider label Oct 9, 2023
@codecov
Copy link

codecov bot commented Oct 9, 2023

Codecov Report

Merging #2912 (49010de) into master (dec0ee1) will not change coverage.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##           master    #2912   +/-   ##
=======================================
  Coverage   86.18%   86.18%           
=======================================
  Files         539      539           
  Lines       17374    17374           
=======================================
  Hits        14974    14974           
  Misses       2400     2400           
Files Coverage Δ
...dwatch_changes_to_network_acls_alarm_configured.py 100.00% <100.00%> (ø)
...ch_changes_to_network_gateways_alarm_configured.py 100.00% <100.00%> (ø)
...hanges_to_network_route_tables_alarm_configured.py 100.00% <100.00%> (ø)
...red/cloudwatch_changes_to_vpcs_alarm_configured.py 100.00% <100.00%> (ø)
...rm_for_aws_config_configuration_changes_enabled.py 100.00% <100.00%> (ø)
...rm_for_cloudtrail_configuration_changes_enabled.py 100.00% <100.00%> (ø)
...watch_log_metric_filter_authentication_failures.py 100.00% <100.00%> (ø)
...tch_log_metric_filter_aws_organizations_changes.py 100.00% <100.00%> (ø)
...filter_disable_or_scheduled_deletion_of_kms_cmk.py 100.00% <100.00%> (ø)
..._log_metric_filter_for_s3_bucket_policy_changes.py 100.00% <100.00%> (ø)
... and 5 more

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@MrCloudSec MrCloudSec requested a review from jfagoagas October 9, 2023 08:41
@MrCloudSec MrCloudSec merged commit 9212478 into master Oct 9, 2023
@MrCloudSec MrCloudSec deleted the 2904-bug-cloudwatch-logs-metric-failures-alert-not-passing branch October 9, 2023 09:06
jfagoagas pushed a commit to jit-contrib/prowler that referenced this pull request Oct 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
provider/aws Issues/PRs related with the AWS provider
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: Cloudwatch Logs Metric Failures Alert Not Passing
2 participants