Test the report receiver and redaction against attacks
shellcheck / shellcheck (push) Failing after 19s
shellcheck / shellcheck (push) Failing after 19s
server/report-receiver/test_security.py sends the receiver what anyone on the internet could, and the Redaction tests in tests/report.bats feed report logs full of secrets. Each test was checked to fail before its fix. The receiver now refuses a negative Content-Length (read without limit), parts nested thousands deep (a RecursionError dropped the connection) and more than 20 parts (thousands took seconds of CPU to parse). It counts an IPv6 address's /64 for the rate limit, since a home has a whole /64 to send from. Report fields go into the Gitea issue as inline code, and titles keep only the characters of step names and versions, so a report can't @mention the team, link issues, or show a tracking image. It refuses reports while its disk has less than 2 GB free. report now also takes out passwords in URLs, Bearer and Basic tokens, password= and token: values, API keys by their prefixes, Nextcloud app passwords, private keys, IPv6 and MAC addresses, the Cores' domains and the user's name. It reads the Core settings rather than sourcing them, and escapes extended regex characters in names, which it didn't before. The plan for the checks still to do, in the smoketest VM (the agent sandbox, network exposure, what root runs, the install path), is a Claude Code skill: /coredesktop-security-checks. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -208,10 +208,10 @@ class PartsTest(unittest.TestCase):
|
||||
def test_issue_text_cant_break_out_of_its_table_or_code_block(self):
|
||||
details = {"kind": "update", "version": "v | 1", "failed": "a\nb", "kernel": "", "siblings": ""}
|
||||
body = receiver.issue_body("CD-TEST23", details, "````\nlog\n", "now")
|
||||
self.assertIn("| CoreDesktop | v \\| 1 |", body)
|
||||
self.assertIn("| Failed | a<br>b |", body)
|
||||
self.assertIn("| CoreDesktop | `v \\| 1` |", body)
|
||||
self.assertIn("| Failed | `a`<br>`b` |", body)
|
||||
self.assertIn("`````\n````\nlog\n`````", body)
|
||||
self.assertEqual(receiver.issue_title(details), "Update failed in a b (v | 1)")
|
||||
self.assertEqual(receiver.issue_title(details), "Update failed in a b (v _ 1)")
|
||||
|
||||
def test_ids_are_easy_to_read_out(self):
|
||||
for _ in range(100):
|
||||
|
||||
Reference in New Issue
Block a user