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

Add ability to subscribe to DDoS detected alarms #386

Merged
merged 52 commits into from
Sep 20, 2024

Conversation

markdboyd
Copy link
Contributor

@markdboyd markdboyd commented Sep 19, 2024

Related to https://github.com/cloud-gov/private/issues/1097

Changes proposed in this pull request:

  • Add new alarm_notification_email that customers must specify for CDN w/dedicated WAF instances to receive notifications from Cloudwatch alarms
  • Add new Cloudwatch alarm when DDoS is detected on the protected CDN
  • Add dedicated SNS topic for sending notifications to the customer
  • Ensure that SNS topic and DDoS alarm are created when migrating CDN to CDN w/dedicated WAF plan
  • Add/update tests

Things to check

  • For any logging statements, is there any chance that they could be logging sensitive data?
  • Are log statements using a logging library with a logging level set? Setting a logging level means that log statements "below" that level will not be written to the output. For example, if the logging level is set to INFO and debugging statements are written with log.debug or similar, then they won't be written to the otput, which can prevent unintentional leaks of sensitive data.

Security considerations

No direct security considerations for the broker, but these changes will facilitate better security monitoring for customers

…ce does not specify alarm notification email
@markdboyd markdboyd marked this pull request as ready for review September 20, 2024 18:22
@markdboyd markdboyd requested a review from a team as a code owner September 20, 2024 18:22
Comment on lines 5 to 8
return service_instance.instance_type in [
ServiceInstanceTypes.CDN.value,
ServiceInstanceTypes.CDN_DEDICATED_WAF.value,
]
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe late to be checking this, but why aren't we just using isinstance(service_intance, CDNServiceInstance)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Absolutely no reason. Is there an inherent benefit to one approach vs the other?

Copy link
Contributor

Choose a reason for hiding this comment

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

isinstance is a builtin, so I think it's a bit more idiomatic, and probably faster (although speed isn't really critical here - nobody would notice if this took seconds to perform, except during testing)

Comment on lines +11 to +14
def is_cdn_dedicated_waf_instance(service_instance) -> bool:
return (
service_instance.instance_type == ServiceInstanceTypes.CDN_DEDICATED_WAF.value
)
Copy link
Contributor

Choose a reason for hiding this comment

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

same question here: why not just isinstance(service_instance, DedicatedCDNServiceInstance)

Comment on lines +18 to +24
operation = db.session.get(Operation, operation_id)
service_instance = operation.service_instance

operation.step_description = "Creating SNS notification topic"
flag_modified(operation, "step_description")
db.session.add(operation)
db.session.commit()
Copy link
Contributor

Choose a reason for hiding this comment

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

(not for this PR)
this pattern is repeated in almost every task, should we refactor it out?

@markdboyd markdboyd merged commit 205f2aa into main Sep 20, 2024
1 check passed
@markdboyd markdboyd deleted the subscribe-shield-alarms branch September 20, 2024 18:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants