Skip to content

Commit

Permalink
Merge pull request #84 from cisagov/bugfix/update-cybex-recipients
Browse files Browse the repository at this point in the history
Update cybex recipients
  • Loading branch information
jsf9k committed Apr 29, 2021
2 parents bb4ab7a + ce3e90c commit b315623
Show file tree
Hide file tree
Showing 8 changed files with 46 additions and 34 deletions.
24 changes: 12 additions & 12 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.5.0
rev: v3.4.0
hooks:
- id: check-executables-have-shebangs
- id: check-json
Expand All @@ -23,54 +23,54 @@ repos:
- id: requirements-txt-fixer
- id: trailing-whitespace
- repo: https://github.com/igorshubovych/markdownlint-cli
rev: v0.22.0
rev: v0.27.1
hooks:
- id: markdownlint
# The LICENSE.md must match the license text exactly for
# GitHub's autorecognition fu to work, so we should leave it
# alone.
exclude: LICENSE.md
- repo: https://github.com/adrienverge/yamllint
rev: v1.22.1
rev: v1.26.1
hooks:
- id: yamllint
- repo: https://github.com/detailyang/pre-commit-shell
rev: 1.0.5
hooks:
- id: shell-lint
- repo: https://gitlab.com/pycqa/flake8
rev: 3.7.9
rev: 3.9.1
hooks:
- id: flake8
additional_dependencies:
- flake8-docstrings
- repo: https://github.com/asottile/pyupgrade
rev: v2.1.1
rev: v2.13.0
hooks:
- id: pyupgrade
- repo: https://github.com/PyCQA/bandit
rev: 1.6.2
rev: 1.7.0
hooks:
- id: bandit
- repo: https://github.com/ambv/black
rev: 19.10b0
rev: 21.4b1
hooks:
- id: black
- repo: https://github.com/ansible/ansible-lint.git
rev: v4.3.0a0
rev: v5.0.7
hooks:
- id: ansible-lint
# files: molecule/default/playbook.yml
- repo: https://github.com/antonbabenko/pre-commit-terraform.git
rev: v1.29.0
rev: v1.50.0
hooks:
- id: terraform_fmt
- id: terraform_validate
- repo: https://github.com/IamTheFij/docker-pre-commit
rev: v1.0.1
rev: v2.0.0
hooks:
- id: docker-compose-check
- repo: https://github.com/prettier/prettier
rev: 2.0.4
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v2.2.1
hooks:
- id: prettier
9 changes: 6 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
---
dist: xenial
dist: focal
language: python
python: 3.7
python:
- "3.7"
- "3.8"
- "3.9"
# pre-commit hooks can use Docker, so we should go ahead and enable it
services: docker

Expand Down Expand Up @@ -43,4 +46,4 @@ deploy:
script: bash travis_scripts/deploy_to_docker_hub.sh
on:
tags: true
python: '3.7'
python: '3.9'
6 changes: 3 additions & 3 deletions cyhy/mailer/CybexMessage.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ class CybexMessage(ReportMessage):
"""

DefaultTo = [
"vulnerability@cisa.dhs.gov",
"CyberDirectives@hq.dhs.gov",
"CyberLiason@hq.dhs.gov",
"CyHy_Reports@hq.dhs.gov",
"CyberDirectives@cisa.dhs.gov",
"CyberLiaison@cisa.dhs.gov",
]

Subject = "Cyber Exposure Scorecard - {{report_date}} Results"
Expand Down
2 changes: 1 addition & 1 deletion cyhy/mailer/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
"""This package contains the cyhy-mailer code."""

__version__ = "1.3.12"
__version__ = "1.3.13"
2 changes: 1 addition & 1 deletion cyhy/mailer/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ def send_message(ses_client, message, counter=None):
# Check for errors
status_code = response["ResponseMetadata"]["HTTPStatusCode"]
if status_code != 200:
logging.error(f"Unable to send message. " "Response from boto3 is: {response}")
logging.error(f"Unable to send message. Response from boto3 is: {response}")
raise UnableToSendError(response)

if counter is not None:
Expand Down
11 changes: 6 additions & 5 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
---
# The version for the main docker-compose configuration needs to be the lowest
# version that supports the features used by all docker-compose configurations in
# this project. This is to support the use of a 'docker-compose.override.yml' file
# derived from one of the other configurations as documented here:
# The version for the main docker-compose configuration needs to be
# the lowest version that supports the features used by all
# docker-compose configurations in this project. This is to support
# the use of a 'docker-compose.override.yml' file derived from one of
# the other configurations as documented here:
# https://docs.docker.com/compose/extends/#multiple-compose-files
version: '3.2'

Expand All @@ -14,7 +15,7 @@ secrets:

services:
mailer:
image: 'dhsncats/cyhy-mailer:1.3.12'
image: 'dhsncats/cyhy-mailer:1.3.13'
secrets:
- source: database_creds
target: database_creds.yml
Expand Down
2 changes: 1 addition & 1 deletion tests/test_cybexmessage.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def test_six_params(self):
self.assertEqual(message["BCC"], "cyhy_reports@hq.dhs.gov")
self.assertEqual(
message["To"],
"vulnerability@cisa.dhs.gov,CyberDirectives@hq.dhs.gov,CyberLiason@hq.dhs.gov",
"CyHy_Reports@hq.dhs.gov,CyberDirectives@cisa.dhs.gov,CyberLiaison@cisa.dhs.gov",
)

# Grab the bytes that comprise the attachments
Expand Down
24 changes: 16 additions & 8 deletions tests/test_cyhynotificationmessage.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ def test_four_params_single_recipient_fed(self):

self.assertEqual(message["From"], "reports@cyber.dhs.gov")
self.assertEqual(
message["Subject"], "FEDTEST - Cyber Hygiene Alert - December 15, 2001",
message["Subject"],
"FEDTEST - Cyber Hygiene Alert - December 15, 2001",
)
self.assertEqual(message.get("CC"), None)
self.assertEqual(message["BCC"], "cyhy_reports@hq.dhs.gov")
Expand Down Expand Up @@ -106,7 +107,8 @@ def test_four_params_multiple_recipients_fed(self):

self.assertEqual(message["From"], "reports@cyber.dhs.gov")
self.assertEqual(
message["Subject"], "FEDTEST - Cyber Hygiene Alert - December 15, 2001",
message["Subject"],
"FEDTEST - Cyber Hygiene Alert - December 15, 2001",
)
self.assertEqual(message.get("CC"), None)
self.assertEqual(message["BCC"], "cyhy_reports@hq.dhs.gov")
Expand Down Expand Up @@ -200,7 +202,8 @@ def test_six_params_single_cc_fed(self):

self.assertEqual(message["From"], fm)
self.assertEqual(
message["Subject"], "FEDTEST - Cyber Hygiene Alert - December 15, 2001",
message["Subject"],
"FEDTEST - Cyber Hygiene Alert - December 15, 2001",
)
self.assertEqual(message["CC"], "cc@example.com")
self.assertEqual(message["BCC"], "bcc@example.com")
Expand Down Expand Up @@ -294,7 +297,8 @@ def test_six_params_multiple_cc_fed(self):

self.assertEqual(message["From"], fm)
self.assertEqual(
message["Subject"], "FEDTEST - Cyber Hygiene Alert - December 15, 2001",
message["Subject"],
"FEDTEST - Cyber Hygiene Alert - December 15, 2001",
)
self.assertEqual(message["CC"], "cc@example.com,cc2@example.com")
self.assertEqual(message["BCC"], "bcc@example.com,bcc2@example.com")
Expand Down Expand Up @@ -378,7 +382,8 @@ def test_four_params_single_recipient_nonfed(self):

self.assertEqual(message["From"], "reports@cyber.dhs.gov")
self.assertEqual(
message["Subject"], "NONFEDTEST - Cyber Hygiene Alert - December 15, 2001",
message["Subject"],
"NONFEDTEST - Cyber Hygiene Alert - December 15, 2001",
)
self.assertEqual(message.get("CC"), None)
self.assertEqual(message["BCC"], "cyhy_reports@hq.dhs.gov")
Expand Down Expand Up @@ -462,7 +467,8 @@ def test_four_params_multiple_recipients_nonfed(self):

self.assertEqual(message["From"], "reports@cyber.dhs.gov")
self.assertEqual(
message["Subject"], "NONFEDTEST - Cyber Hygiene Alert - December 15, 2001",
message["Subject"],
"NONFEDTEST - Cyber Hygiene Alert - December 15, 2001",
)
self.assertEqual(message.get("CC"), None)
self.assertEqual(message["BCC"], "cyhy_reports@hq.dhs.gov")
Expand Down Expand Up @@ -556,7 +562,8 @@ def test_six_params_single_cc_nonfed(self):

self.assertEqual(message["From"], fm)
self.assertEqual(
message["Subject"], "NONFEDTEST - Cyber Hygiene Alert - December 15, 2001",
message["Subject"],
"NONFEDTEST - Cyber Hygiene Alert - December 15, 2001",
)
self.assertEqual(message["CC"], "cc@example.com")
self.assertEqual(message["BCC"], "bcc@example.com")
Expand Down Expand Up @@ -650,7 +657,8 @@ def test_six_params_multiple_cc_nonfed(self):

self.assertEqual(message["From"], fm)
self.assertEqual(
message["Subject"], "NONFEDTEST - Cyber Hygiene Alert - December 15, 2001",
message["Subject"],
"NONFEDTEST - Cyber Hygiene Alert - December 15, 2001",
)
self.assertEqual(message["CC"], "cc@example.com,cc2@example.com")
self.assertEqual(message["BCC"], "bcc@example.com,bcc2@example.com")
Expand Down

0 comments on commit b315623

Please sign in to comment.