diff --git a/canarytokens/channel_output_email.py b/canarytokens/channel_output_email.py index 704d62ff2..317be0031 100644 --- a/canarytokens/channel_output_email.py +++ b/canarytokens/channel_output_email.py @@ -508,7 +508,7 @@ def do_send_alert( email_content_html = EmailOutputChannel.format_report_html( details, Path( - f"{self.switchboard_settings.TEMPLATES_PATH}/emails/notification.html" + f"{self.switchboard_settings.TEMPLATES_PATH}/emails/_generated_dont_edit_notification.html" ), ) email_content_text = EmailOutputChannel.format_report_text(details) diff --git a/templates/emails/notification.html b/templates/emails/_generated_dont_edit_notification.html similarity index 83% rename from templates/emails/notification.html rename to templates/emails/_generated_dont_edit_notification.html index a8b0ac2d9..40f0cb551 100644 --- a/templates/emails/notification.html +++ b/templates/emails/_generated_dont_edit_notification.html @@ -1,8 +1,8 @@ - + - Canarytoken triggered! + Canarytoken triggered! @@ -40,22 +40,23 @@ display: block; margin: 13px 0; } + + + + + -
- +
+
@@ -126,7 +130,7 @@ - +
@@ -144,7 +148,7 @@ @@ -160,16 +164,15 @@
- Canarytokens + Canarytokens
- +
- - - + +
@@ -189,7 +192,7 @@ @@ -227,13 +230,13 @@ - +
- Canarytokens + Canarytokens
- +
@@ -282,14 +285,13 @@
- {% if BasicDetails['src_ip'] %} - + {% if BasicDetails['src_ip'] %}
- +
@@ -337,15 +339,14 @@
- {% endif %} - - + {% endif %} +
- +
@@ -398,14 +399,13 @@
- {% if BasicDetails['useragent'] %} - + {% if BasicDetails['useragent'] %}
- +
@@ -455,15 +455,67 @@
- {% endif %} - {% if BasicDetails['location'] %} - + {% endif %}{% if BasicDetails['pwa_location'] %}
+ + +
- + +
+ + + + + + +
+ +
+ + + + + + +
+ + + + + + +
+ + + + + +
+ + +

Location

+

{{BasicDetails.get('pwa_location', None)}}

+
+
+
+
+ +
+
+ +
+
+ {% endif %}{% if BasicDetails['location'] %} +
+ + + +
+
@@ -511,15 +563,13 @@
- {% endif %} - {% if BasicDetails['log4_shell_computer_name'] %} - + {% endif %}{% if BasicDetails['log4_shell_computer_name'] %}
- +
@@ -568,15 +618,13 @@
- {% endif %} - {% if BasicDetails['sql_username'] %} - + {% endif %}{% if BasicDetails['sql_username'] %}
- +
@@ -624,15 +672,13 @@
- {% endif %} - {% if BasicDetails['aws_key_log_data'] and BasicDetails['aws_key_log_data']['service_used'] %} - + {% endif %}{% if BasicDetails['aws_key_log_data'] and BasicDetails['aws_key_log_data']['service_used'] %}
- +
@@ -680,15 +726,13 @@
- {% endif %} - {% if BasicDetails['cmd_process'] or BasicDetails['cmd_computer_name'] or BasicDetails['cmd_user_name']%} - + {% endif %}{% if BasicDetails['cmd_process'] or BasicDetails['cmd_computer_name'] or BasicDetails['cmd_user_name']%}
- +
@@ -737,15 +781,13 @@
- {% endif %} - {% if BasicDetails['merchant'] or BasicDetails['amount']%} - + {% endif %}{% if BasicDetails['merchant'] or BasicDetails['amount']%}
- +
@@ -793,15 +835,13 @@
- {% endif %} - {% if BasicDetails['token_type'] == 'credit_card_v2' %} - + {% endif %}{% if BasicDetails['token_type'] == 'credit_card_v2' %}
- +
@@ -851,15 +891,13 @@
- {% endif %} - {% if BasicDetails['generic_data'] %} - + {% endif %}{% if BasicDetails['generic_data'] %}
- +
@@ -907,15 +945,13 @@
- {% endif %} - {% if BasicDetails['referer'] %} - + {% endif %}{% if BasicDetails['referer'] %}
- +
@@ -963,15 +999,13 @@
- {% endif %} - {% if BasicDetails['referrer'] %} - + {% endif %}{% if BasicDetails['referrer'] %}
- +
@@ -1019,15 +1053,13 @@
- {% endif %} - {% if BasicDetails['request_args'] %} - + {% endif %}{% if BasicDetails['request_args'] %}
- +
@@ -1075,15 +1107,13 @@
- {% endif %} - {% if BasicDetails['token'] %} - + {% endif %}{% if BasicDetails['token'] %}
- +
@@ -1131,15 +1161,14 @@
- {% endif %} - - + {% endif %} +
- +
@@ -1150,13 +1179,15 @@
- @@ -1168,13 +1199,15 @@
+ - - - + + + + +
- Alert History -
+ Alert History +
- @@ -1195,13 +1228,13 @@ - +
+ - - - + + + + +
- Manage Alert -
+ Manage Alert +
- +
@@ -1233,7 +1266,7 @@ - +
@@ -1245,7 +1278,7 @@
- +
@@ -1257,13 +1290,13 @@
- +
- +
@@ -1298,7 +1331,7 @@
- +
@@ -1314,4 +1347,4 @@ - \ No newline at end of file + diff --git a/templates/emails/notification.mjml b/templates/emails/notification.mjml index d6cd64a9b..099e93e8e 100644 --- a/templates/emails/notification.mjml +++ b/templates/emails/notification.mjml @@ -173,6 +173,30 @@ {% endif %} + + {% if BasicDetails['pwa_location'] %} + + + + + + + + + + + + + + + + {% endif %} + {% if BasicDetails['location'] %} diff --git a/tests/units/test_channel_output_email.py b/tests/units/test_channel_output_email.py index ec94c5a07..21c3b3073 100644 --- a/tests/units/test_channel_output_email.py +++ b/tests/units/test_channel_output_email.py @@ -40,7 +40,10 @@ def test_dns_rendered_html(settings: SwitchboardSettings): additional_data={}, ) email_template = EmailOutputChannel.format_report_html( - details, Path(f"{settings.TEMPLATES_PATH}/emails/notification.html") + details, + Path( + f"{settings.TEMPLATES_PATH}/emails/_generated_dont_edit_notification.html" + ), ) assert "https://some.link/manage/here" in email_template assert "https://some.link/history/here" in email_template @@ -61,7 +64,10 @@ def test_slow_redirect_rendered_html(settings: SwitchboardSettings): }, ) email_template = EmailOutputChannel.format_report_html( - details, Path(f"{settings.TEMPLATES_PATH}/emails/notification.html") + details, + Path( + f"{settings.TEMPLATES_PATH}/emails/_generated_dont_edit_notification.html" + ), ) assert "https://some.link/manage/here" in email_template assert "https://some.link/history/here" in email_template @@ -82,7 +88,10 @@ def test_cloned_site_rendered_html(settings: SwitchboardSettings): }, ) email_template = EmailOutputChannel.format_report_html( - details, Path(f"{settings.TEMPLATES_PATH}/emails/notification.html") + details, + Path( + f"{settings.TEMPLATES_PATH}/emails/_generated_dont_edit_notification.html" + ), ) assert "https://some.link/manage/here" in email_template assert "https://some.link/history/here" in email_template @@ -102,7 +111,10 @@ def test_log4shell_rendered_html(settings: SwitchboardSettings): }, ) email_template = EmailOutputChannel.format_report_html( - details, Path(f"{settings.TEMPLATES_PATH}/emails/notification.html") + details, + Path( + f"{settings.TEMPLATES_PATH}/emails/_generated_dont_edit_notification.html" + ), ) assert "https://some.link/manage/here" in email_template assert "https://some.link/history/here" in email_template @@ -122,7 +134,10 @@ def test_aws_keys_safetynet_rendered_html(settings: SwitchboardSettings): }, ) email_template = EmailOutputChannel.format_report_html( - details, Path(f"{settings.TEMPLATES_PATH}/emails/notification.html") + details, + Path( + f"{settings.TEMPLATES_PATH}/emails/_generated_dont_edit_notification.html" + ), ) assert "https://some.link/manage/here" in email_template assert "https://some.link/history/here" in email_template @@ -164,7 +179,10 @@ def test_sendgrid_send( result, message_id = sendgrid_send( api_key=settings.SENDGRID_API_KEY, email_content_html=EmailOutputChannel.format_report_html( - details, Path(f"{settings.TEMPLATES_PATH}/emails/notification.html") + details, + Path( + f"{settings.TEMPLATES_PATH}/emails/_generated_dont_edit_notification.html" + ), ), email_address=EmailStr(email), from_email=settings.ALERT_EMAIL_FROM_ADDRESS, @@ -199,7 +217,10 @@ def test_mailgun_send( details = _get_send_token_details() result, message_id = mailgun_send( email_content_html=EmailOutputChannel.format_report_html( - details, Path(f"{settings.TEMPLATES_PATH}/emails/notification.html") + details, + Path( + f"{settings.TEMPLATES_PATH}/emails/_generated_dont_edit_notification.html" + ), ), email_content_text=EmailOutputChannel.format_report_text(details), email_address=EmailStr(email), @@ -226,7 +247,10 @@ def test_smtp_send( details = _get_send_token_details() result, message_id = smtp_send( email_content_html=EmailOutputChannel.format_report_html( - details, Path(f"{settings.TEMPLATES_PATH}/emails/notification.html") + details, + Path( + f"{settings.TEMPLATES_PATH}/emails/_generated_dont_edit_notification.html" + ), ), email_content_text=EmailOutputChannel.format_report_text(details), email_address=EmailStr("tokens-testing@thinkst.com"),
+ + +

Location

+

{{BasicDetails.get('pwa_location', None)}}

+