-
Notifications
You must be signed in to change notification settings - Fork 323
Description
Problem
When Lemur sends a rotation notification, the notification plugin receives the certificate data but not the endpoint being rotated. This makes it impossible for notification plugins to include useful operational context like which load balancer or infrastructure component is being updated.
The flow is:
certificate_rotatecelery task callsrequest_rotation()with the endpoint and certificaterequest_rotation()callssend_rotation_notification(certificate)— only the certificate is passedsend_rotation_notification()inmessaging.pycallssend_default_notification("rotation", data, ...)— no endpointsend_default_notification()callsplugin.send(notification_type, data, targets, options, **kwargs)— no endpoint in kwargs
The **kwargs plumbing exists all the way through, but the endpoint is never passed into the chain.
Impact
Notification plugins that want to show which endpoint is being rotated (e.g. "Rotating certificate on load balancer X in project Y") cannot do so through the standard notification interface. For example, a Slack notification plugin could produce much more actionable messages if it knew which endpoint triggered the rotation.
Proposed fix
Pass endpoint through the notification chain. The change is small — in certificates/cli.py, pass the endpoint to send_rotation_notification(), and thread it through messaging.py into the plugin's send() call via **kwargs:
# messaging.py — send_rotation_notification()
def send_rotation_notification(certificate, endpoint=None):
data = certificate_notification_output_schema.dump(certificate).data
data["security_email"] = current_app.config.get("LEMUR_SECURITY_TEAM_EMAIL")
email_tags = {...}
return send_default_notification("rotation", data, [data["owner"]], email_tags=email_tags, endpoint=endpoint)This is backwards compatible — existing plugins that don't accept endpoint already handle **kwargs in their send() signature, and the NotificationPlugin base class accepts **kwargs too.
Happy to submit a PR for this if you're interested.