Skip to content

armgit / Pulse

Public Imported from GitHub
0

Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.

Bind containment checks to the private reporting section

pulse-triage[bot]bd2cc6f9ac05
diff --git a/scripts/tests/test_public_report_containment_docs.py b/scripts/tests/test_public_report_containment_docs.py
index d8d23ccb76..d4a51b8c2a 100644
--- a/scripts/tests/test_public_report_containment_docs.py
+++ b/scripts/tests/test_public_report_containment_docs.py
@@ -2,6 +2,7 @@
"""Check reporting guidance, not live revocation or GitHub data erasure."""
from pathlib import Path
+import re
import unittest
@@ -15,7 +16,23 @@ def containment(text):
return " ".join(text.split(HEADING, 1)[1].split("\n### ", 1)[0].split())
+def security_reporting(text):
+ """Check the private route where a vulnerability reporter is directed."""
+ heading = re.search(r"^## Reporting a vulnerability[ \t]*\n", text, re.MULTILINE)
+ if heading is None:
+ raise AssertionError("Security guide needs its private reporting section")
+ remainder = text[heading.end():]
+ end = re.search(r"^(?:## |---[ \t]*$)", remainder, re.MULTILINE)
+ return " ".join(remainder[:end.start() if end else len(remainder)].split())
+
+
class PublicReportContainmentDocsTest(unittest.TestCase):
+ def assert_private_disclosure_route(self, guide):
+ section = security_reporting(guide)
+ self.assertIn("<[email protected]>", section)
+ self.assertIn("Do not open a public issue or discussion for these reports.",
+ section)
+
def test_revocation_is_issuer_specific_and_preserves_least_privilege(self):
text = containment((ROOT / "docs/TROUBLESHOOTING.md").read_text())
for statement in (
@@ -54,10 +71,38 @@ class PublicReportContainmentDocsTest(unittest.TestCase):
):
with self.subTest(statement=statement):
self.assertIn(statement, text)
- self.assertIn("**Private disclosures:** <[email protected]>",
- (ROOT / "SECURITY.md").read_text())
+ self.assert_private_disclosure_route((ROOT / "SECURITY.md").read_text())
self.assertIn(ANCHOR, (ROOT / "CONTRIBUTING.md").read_text())
+ def test_reporting_route_accepts_a_reworded_introduction(self):
+ guide = (ROOT / "SECURITY.md").read_text()
+ self.assert_private_disclosure_route(guide.replace("Email <", "Contact <", 1))
+
+ def test_reporting_route_requires_its_section(self):
+ guide = (ROOT / "SECURITY.md").read_text()
+ with self.assertRaisesRegex(AssertionError, "private reporting section"):
+ self.assert_private_disclosure_route(
+ guide.replace("## Reporting a vulnerability", "## Other guidance", 1))
+
+ def test_reporting_route_rejects_wrong_or_out_of_section_contact(self):
+ address = "<[email protected]>"
+ guide = (ROOT / "SECURITY.md").read_text()
+ for replacement in ("", "<[email protected]>"):
+ for boundary in ("## Other guidance", "---"):
+ with self.subTest(replacement=replacement, boundary=boundary):
+ wrong = guide.replace(address, replacement, 1)
+ wrong += f"\n{boundary}\n**Private disclosures:** {address}\n"
+ with self.assertRaises(AssertionError):
+ self.assert_private_disclosure_route(wrong)
+
+ def test_reporting_route_keeps_the_public_posting_warning_with_the_contact(self):
+ warning = "Do not open a public issue or discussion for these reports."
+ guide = (ROOT / "SECURITY.md").read_text()
+ misplaced = guide.replace(warning, "Use another route.", 1)
+ misplaced += f"\n## Other guidance\n{warning}\n"
+ with self.assertRaises(AssertionError):
+ self.assert_private_disclosure_route(misplaced)
+
def test_every_report_form_warns_before_the_first_public_input(self):
for name in ("bug_report.yml", "v6_rc_feedback.yml", "feature_request.yml"):
with self.subTest(form=name):