Skip to content
This repository was archived by the owner on Sep 27, 2024. It is now read-only.

Putting the documentation link into refactored code base #8

Merged
merged 1 commit into from
May 1, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Putting the documentation link into refactored code base
James Elliott committed May 1, 2024
commit c9ae3078892f6c421b65f33b97d2cfe37dbf10e8
1 change: 1 addition & 0 deletions code/reporter/lambda_function.py
Original file line number Diff line number Diff line change
@@ -129,6 +129,7 @@ def handler(event, context):
report = slack_report.SlackSecurityReport(threshold=str(epss_threshold))
report.header = "BatCAVE SecHub and Nessus Daily Report"
report.context = "Powered by BatCAVE Watchtower and CMS Security Data Lake!"
report.footer = "Documentation and runbook: https://confluenceent.cms.gov/display/BATCAVE/SecHub+and+Nessus+Daily+Report"

epss_cve_by_env = (
epss_vulns[["ACCOUNTID", "CVE"]]
3 changes: 3 additions & 0 deletions code/reporter/slack_report.py
Original file line number Diff line number Diff line change
@@ -31,6 +31,7 @@ def __init__(self, threshold: str):
self.blocks = []
self.header = None
self.context = None
self.footer = None
self.epss_threshold = threshold
self.sechub_issues = []
self.epss_cves = []
@@ -143,6 +144,8 @@ def __form_blocks(self):
)
)
self.blocks.append(epss_vuln_block)
self.blocks.append(DividerBlock())
self.blocks.append(ContextBlock(elements=[Text(self.footer)]))

def get_blocks(self):
self.__form_blocks()
5 changes: 5 additions & 0 deletions code/reporter/test_slack_report.py
Original file line number Diff line number Diff line change
@@ -4,10 +4,12 @@
def test_no_results():
header = "My Security Report"
context = "Brought to you by Coffee"
footer = "This goes at the bottom!"

report = slack_report.SlackSecurityReport(threshold="0.8")
report.header = header
report.context = context
report.footer = footer
blocks = report.get_blocks()

assert len(blocks) == 8
@@ -37,10 +39,13 @@ def test_no_results():
def test_get_payload():
header = "My Security Report"
context = "Brought to you by Coffee"
footer = "This goes at the bottom!"

report = slack_report.SlackSecurityReport(threshold="0.8")
report.header = header
report.context = context
report.footer = footer

payload = report.get_payload()["blocks"]
json.dumps({"blocks": payload})