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.

Keep public installer verification keys out of fixture constants

pulse-triage[bot]b4aa640c4060
diff --git a/.gitleaksignore b/.gitleaksignore
index 90429d7f24..0ccf765fa7 100644
--- a/.gitleaksignore
+++ b/.gitleaksignore
@@ -134,3 +134,10 @@ f46ff1792bd53436891c9a7a8b74180f443f0772:docs/API.md:curl-auth-header:48
f46ff1792bd53436891c9a7a8b74180f443f0772:docs/CONFIGURATION.md:curl-auth-header:394
f46ff1792bd53436891c9a7a8b74180f443f0772:docs/REVERSE_PROXY.md:generic-api-key:260
f46ff1792bd53436891c9a7a8b74180f443f0772:docs/TROUBLESHOOTING.md:curl-auth-header:29
+
+# The signed-installer test copied the public Ed25519 verification key from
+# docs/INSTALL.md into a constant. It is not a credential. The current test
+# substitutes its generated fixture key without duplicating the public value;
+# retain only these exact historical introduction/first-parent merge findings.
+ffdfefbc572215114a7aec92b84fa0b656c95356:scripts/tests/test_signed_installer_docs.py:generic-api-key:18
+ed75bc835ad035c9be74b2851cd24acb403849ff:scripts/tests/test_signed_installer_docs.py:generic-api-key:18
diff --git a/scripts/tests/test_signed_installer_docs.py b/scripts/tests/test_signed_installer_docs.py
index 2aa1a49028..059c6e48b1 100644
--- a/scripts/tests/test_signed_installer_docs.py
+++ b/scripts/tests/test_signed_installer_docs.py
@@ -15,7 +15,6 @@ import unittest
ROOT = Path(__file__).resolve().parents[2]
-INSTALLER_KEY = "AAAAC3NzaC1lZDI1NTE5AAAAIMZd/DaH+BldzOkq1A8KVTcFk73nAyrE8aJOyf7i00jm"
def recipes():
@@ -24,6 +23,14 @@ def recipes():
) if "ssh-keygen -Y verify" in block]
+def with_fixture_signer(block, public_key):
+ """Replace the recipe's one public verification key, not its trust policy."""
+ command, count = re.subn(r"(?<=ssh-ed25519 )\S+", lambda _match: public_key, block)
+ if count != 1:
+ raise ValueError(f"expected one installer verification key, found {count}")
+ return command
+
+
@contextmanager
def download_servers(root, mode):
"""Real local HTTPS and a separate plaintext downgrade witness."""
@@ -103,7 +110,8 @@ def run_local_recipe(root, block, secure_port, plain_port, *, trust=True):
command = block.replace("vX.Y.Z", "v6.4.5-rc.2").replace(
"https://github.com/rcourtman/Pulse/releases/download",
f"https://127.0.0.1:{secure_port}"
- ).replace(INSTALLER_KEY, public_key)
+ )
+ command = with_fixture_signer(command, public_key)
env = {k: v for k, v in os.environ.items()
if not k.lower().endswith("_proxy") and k not in ("CURL_CA_BUNDLE", "SSL_CERT_FILE", "SSL_CERT_DIR")}
env.update(HOME=str(root), CURL_HOME=str(root), XDG_CONFIG_HOME=str(root / ".config"),
@@ -116,6 +124,19 @@ def run_local_recipe(root, block, secure_port, plain_port, *, trust=True):
class SignedInstallerDocsTest(unittest.TestCase):
+ def test_fixture_signer_replacement_preserves_policy_and_requires_one_key(self):
+ for block in recipes():
+ with self.subTest(recipe=block.splitlines()[0]):
+ replaced = with_fixture_signer(block, "fixture-public")
+ self.assertEqual(replaced.count("ssh-ed25519 fixture-public "), 1)
+ self.assertEqual(
+ re.sub(r"(?<=ssh-ed25519 )\S+", "KEY", block),
+ re.sub(r"(?<=ssh-ed25519 )\S+", "KEY", replaced),
+ )
+ for malformed in ("no verification key", block + "\n" + block):
+ with self.assertRaisesRegex(ValueError, "expected one installer verification key"):
+ with_fixture_signer(malformed, "fixture-public")
+
def test_mirror_and_bounded_https_only_transfers(self):
self.assertEqual((ROOT / "docs/INSTALL.md").read_bytes(),
(ROOT / "frontend-modern/public/docs/INSTALL.md").read_bytes())