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 direct proxy-auth probes off environment proxies

pulse-triage[bot]42b49532e3f1
diff --git a/docs/PROXY_AUTH.md b/docs/PROXY_AUTH.md
index 3d4117e103..062cde7325 100644
--- a/docs/PROXY_AUTH.md
+++ b/docs/PROXY_AUTH.md
@@ -154,6 +154,7 @@ prints only the HTTP status, not settings, cookies or credential-bearing logs:
touch "$header_file"
vi "$header_file"
if status=$(curl --disable --silent --show-error --output /dev/null \
+ --proto '=http' --noproxy 127.0.0.1 \
--connect-timeout 5 --max-time 10 \
--write-out '%{http_code}' --header "@$header_file" \
http://127.0.0.1:7655/api/system/settings); then
@@ -173,10 +174,18 @@ The temporary header file is removed on exit, including an editor or curl
failure. Cleanup does not revoke the shared secret.
The loopback address applies only on the Pulse host with a loopback listener.
-Otherwise use its existing private backend address over HTTPS with certificate
-verification enabled. Do not send forged test identities through a public proxy
-that should replace them. Keep `--disable` first to ignore local curl defaults;
-do not enable verbose/trace output, `--insecure` or redirect following.
+`--noproxy 127.0.0.1` explicitly bypasses proxy environment settings for this
+direct request. `--disable` ignores curl's configuration file, **not** those
+environment settings: without the bypass, a proxy could receive the shared
+secret and its response could be mistaken for Pulse's role result.
+
+Otherwise use the existing private backend address over HTTPS with certificate
+verification enabled. Replace `--proto '=http'` with `--proto '=https'` and the
+`--noproxy` value with that exact backend hostname or IP; do not send the shared
+secret through an environment proxy. Keep backend isolation intact. Do not send
+forged test identities through a public proxy that should replace them. Keep
+`--disable` first to ignore local curl defaults; do not enable verbose/trace
+output, `--insecure` or redirect following.
With role gating configured on Pulse 6.2.2 or later, expect **403** for a valid
non-admin identity. Repeat the same read-only probe with the role line omitted,
diff --git a/frontend-modern/browser-tests/proxy-auth-help.cjs b/frontend-modern/browser-tests/proxy-auth-help.cjs
new file mode 100644
index 0000000000..facdbcb7e9
--- /dev/null
+++ b/frontend-modern/browser-tests/proxy-auth-help.cjs
@@ -0,0 +1,90 @@
+// Exercise the shipped guide through the production Docs page and router.
+// This checks readable/copyable help, not an IdP or a real proxy deployment.
+const assert = require('node:assert/strict');
+const fs = require('node:fs');
+const path = require('node:path');
+const { createHash } = require('node:crypto');
+const { chromium, webkit } = require('playwright');
+
+(async () => {
+ const root = path.resolve('frontend-modern');
+ const artifacts = path.join(root, 'node_modules', 'proxy-auth-browser');
+ fs.mkdirSync(artifacts, { recursive: true });
+ const guide = fs.readFileSync(path.join(root, 'public/docs/PROXY_AUTH.md'), 'utf8');
+ const recipe = guide.match(/```bash\n([\s\S]*?)```/)[1].trim();
+ const port = 5259;
+ process.chdir(root);
+ const { createServer } = await import(path.join(root, 'node_modules/vite/dist/node/index.js'));
+ const server = await createServer({
+ root, configFile: path.join(root, 'vite.config.ts'),
+ cacheDir: path.join(root, 'node_modules', '.vite-proxy-auth'),
+ server: { host: '127.0.0.1', port, strictPort: true },
+ optimizeDeps: { noDiscovery: true, include: [] },
+ });
+ const results = [];
+ let browser;
+ try {
+ await server.listen();
+ for (const [engine, width, tone] of [['chromium', 1280, 'light'], ['webkit', 390, 'dark']]) {
+ browser = await { chromium, webkit }[engine].launch(engine === 'chromium'
+ ? { headless: true, channel: 'chromium', args: ['--no-sandbox'] }
+ : { headless: true });
+ const page = await browser.newPage({ viewport: { width, height: 1000 },
+ ...(engine === 'webkit' ? { isMobile: true, hasTouch: true } : {}) });
+ const errors = [];
+ page.on('pageerror', error => errors.push(error.message));
+ page.on('console', message => { if (message.type() === 'error') errors.push(message.text()); });
+ await page.route(new RegExp(`^http://127\\.0\\.0\\.1:${port}/api/`), route =>
+ route.fulfill({ status: 200, contentType: 'application/json', body: '{}' }));
+ await page.goto(`http://127.0.0.1:${port}/browser-tests/docs-fragment-navigation.html`,
+ { waitUntil: 'domcontentloaded', timeout: 60_000 });
+ await page.getByRole('link', { name: '← All documentation' }).click();
+ const entry = page.locator('a[data-doc-link][href="/docs/PROXY_AUTH"]').first();
+ await entry.focus();
+ await page.keyboard.press('Enter');
+ await page.getByRole('heading', { name: 'Verify Headers', exact: true }).waitFor();
+ if (tone === 'dark') await page.evaluate(() => document.documentElement.classList.add('dark'));
+ const code = page.locator('pre').filter({ hasText: 'probe_dir=$(mktemp -d)' });
+ await code.scrollIntoViewIfNeeded();
+ assert.equal((await code.locator('code').textContent()).trim(), recipe);
+ assert.ok((await code.textContent()).includes("--proto '=http' --noproxy 127.0.0.1"));
+ assert.ok(await page.evaluate(() => document.documentElement.scrollWidth <= innerWidth + 1));
+ const captures = [`${engine}-probe.png`, `${engine}-boundary.png`];
+ await page.screenshot({ path: path.join(artifacts, captures[0]) });
+ const warning = page.locator('p').filter({ hasText: 'explicitly bypasses proxy environment settings' });
+ await warning.scrollIntoViewIfNeeded();
+ const text = await page.locator('article').innerText();
+ for (const phrase of ["not those environment settings", "mistaken for Pulse's role result",
+ "exact backend hostname or IP", "Keep backend isolation intact",
+ "not a successful denial test", "not your proxy's header replacement"]) {
+ assert.ok(text.includes(phrase), phrase);
+ }
+ assert.ok(await page.evaluate(() => document.documentElement.scrollWidth <= innerWidth + 1));
+ await page.screenshot({ path: path.join(artifacts, captures[1]) });
+ // Fragment interaction and reload must retain the real guide and exact
+ // shell text, not a separately rendered copy of the example.
+ await page.evaluate(() => { window.location.hash = '#verify-headers'; });
+ await page.waitForFunction(() => document.activeElement?.id === 'verify-headers');
+ await page.reload({ waitUntil: 'domcontentloaded' });
+ await page.waitForFunction(() => document.activeElement?.id === 'verify-headers');
+ assert.equal((await page.locator('pre').filter({ hasText: 'probe_dir=$(mktemp -d)' })
+ .locator('code').textContent()).trim(), recipe);
+ assert.deepEqual(errors, []);
+ results.push({ engine, browserVersion: browser.version(), width, height: 1000, tone,
+ keyboardEntry: true, exactCopiedShell: true, proxyAndTransportLimits: true,
+ fragmentFocusAndReload: true, noPageOverflow: true, captures, errors });
+ await browser.close();
+ browser = undefined;
+ }
+ const result = { result: 'passed', verifiedAt: new Date().toISOString(),
+ playwrightVersion: require('playwright/package.json').version,
+ scope: 'Production Docs/router and copied help; not installed IdP/proxy acceptance',
+ docs: { 'frontend-modern/public/docs/PROXY_AUTH.md':
+ createHash('sha256').update(guide).digest('hex') }, results };
+ fs.writeFileSync(path.join(artifacts, 'result.json'), JSON.stringify(result, null, 2) + '\n');
+ console.log(JSON.stringify(result));
+ } finally {
+ if (browser) await browser.close();
+ await server.close();
+ }
+})().catch(error => { console.error(error); process.exitCode = 1; });
diff --git a/frontend-modern/public/docs/PROXY_AUTH.md b/frontend-modern/public/docs/PROXY_AUTH.md
index 3d4117e103..062cde7325 100644
--- a/frontend-modern/public/docs/PROXY_AUTH.md
+++ b/frontend-modern/public/docs/PROXY_AUTH.md
@@ -154,6 +154,7 @@ prints only the HTTP status, not settings, cookies or credential-bearing logs:
touch "$header_file"
vi "$header_file"
if status=$(curl --disable --silent --show-error --output /dev/null \
+ --proto '=http' --noproxy 127.0.0.1 \
--connect-timeout 5 --max-time 10 \
--write-out '%{http_code}' --header "@$header_file" \
http://127.0.0.1:7655/api/system/settings); then
@@ -173,10 +174,18 @@ The temporary header file is removed on exit, including an editor or curl
failure. Cleanup does not revoke the shared secret.
The loopback address applies only on the Pulse host with a loopback listener.
-Otherwise use its existing private backend address over HTTPS with certificate
-verification enabled. Do not send forged test identities through a public proxy
-that should replace them. Keep `--disable` first to ignore local curl defaults;
-do not enable verbose/trace output, `--insecure` or redirect following.
+`--noproxy 127.0.0.1` explicitly bypasses proxy environment settings for this
+direct request. `--disable` ignores curl's configuration file, **not** those
+environment settings: without the bypass, a proxy could receive the shared
+secret and its response could be mistaken for Pulse's role result.
+
+Otherwise use the existing private backend address over HTTPS with certificate
+verification enabled. Replace `--proto '=http'` with `--proto '=https'` and the
+`--noproxy` value with that exact backend hostname or IP; do not send the shared
+secret through an environment proxy. Keep backend isolation intact. Do not send
+forged test identities through a public proxy that should replace them. Keep
+`--disable` first to ignore local curl defaults; do not enable verbose/trace
+output, `--insecure` or redirect following.
With role gating configured on Pulse 6.2.2 or later, expect **403** for a valid
non-admin identity. Repeat the same read-only probe with the role line omitted,
diff --git a/scripts/tests/test_authentication_diagnostic_docs.py b/scripts/tests/test_authentication_diagnostic_docs.py
index b17786b5e4..9163716259 100644
--- a/scripts/tests/test_authentication_diagnostic_docs.py
+++ b/scripts/tests/test_authentication_diagnostic_docs.py
@@ -193,7 +193,7 @@ class AuthenticationDiagnosticDocsTest(unittest.TestCase):
self.assertEqual(json.loads(requests[-1][3]) if body is not None else requests[-1][3],
body if body is not None else b"")
- def exercise_proxy(self, home, port, role, *, editor_exit=0, curl_exit=0):
+ def exercise_proxy(self, home, port, role, *, editor_exit=0, curl_exit=0, proxy_env=None):
recipes = blocks("PROXY_AUTH")
self.assertEqual(len(recipes), 1)
recipe = recipes[0].replace("http://127.0.0.1:7655", f"http://127.0.0.1:{port}")
@@ -231,6 +231,7 @@ class AuthenticationDiagnosticDocsTest(unittest.TestCase):
for key in list(env):
if key.lower().endswith("_proxy"):
del env[key]
+ env.update(proxy_env or {})
result = subprocess.run(["bash", "-c", recipe], env=env, capture_output=True, timeout=15)
edited = json.loads((home / "editor.json").read_text())
self.assertEqual((edited["directory_mode"], edited["file_mode"]), (0o700, 0o600))
@@ -276,6 +277,37 @@ class AuthenticationDiagnosticDocsTest(unittest.TestCase):
for unexpected in ("X-API-Token", "Authorization", "Cookie", "X-Curlrc-Injected"):
self.assertNotIn(unexpected, headers)
+ def test_proxy_probe_bypasses_environment_proxies(self):
+ # --disable ignores .curlrc, not proxy environment variables. A direct
+ # role probe must send its administrator-capable secret only to Pulse.
+ for variable in ("http_proxy", "all_proxy", "ALL_PROXY"):
+ with self.subTest(variable=variable), proxy_server(403) as (port, requests), \
+ proxy_server(200) as (proxy_port, proxy_requests), \
+ tempfile.TemporaryDirectory() as temporary:
+ result = self.exercise_proxy(Path(temporary), port, "X-Proxy-Roles: none\n",
+ proxy_env={variable: f"http://127.0.0.1:{proxy_port}",
+ "no_proxy": "", "NO_PROXY": ""})
+ self.assertEqual(result.returncode, 0, result.stderr.decode())
+ self.assertEqual(proxy_requests, [], "the proxy must receive neither a request nor the secret")
+ self.assertEqual(result.stdout, b"HTTP 403\n")
+ self.assertEqual(len(requests), 1)
+ self.assertEqual(requests[0][:2], ("GET", "/api/system/settings"))
+ self.assertEqual(requests[0][2]["X-Proxy-Secret"], TEST_TOKEN)
+
+ def test_proxy_denial_cannot_be_mistaken_for_pulse_role_gating(self):
+ # An environment proxy's 403 could otherwise conceal Pulse granting
+ # administrator access. The result must come from the intended host.
+ with proxy_server(200) as (port, requests), proxy_server(403) as (proxy_port, proxy_requests), \
+ tempfile.TemporaryDirectory() as temporary:
+ result = self.exercise_proxy(Path(temporary), port, "X-Proxy-Roles: none\n",
+ proxy_env={"http_proxy": f"http://127.0.0.1:{proxy_port}",
+ "no_proxy": "", "NO_PROXY": ""})
+ self.assertEqual(result.returncode, 0, result.stderr.decode())
+ self.assertEqual(proxy_requests, [], "a proxy denial is not a Pulse permission result")
+ self.assertEqual(result.stdout, b"HTTP 200\n")
+ self.assertEqual(len(requests), 1)
+ self.assertEqual(requests[0][:2], ("GET", "/api/system/settings"))
+
def test_proxy_setup_cannot_omit_role_choice_and_authenticated_boundary(self):
source = DOCUMENTS["PROXY_AUTH"].read_text()
proxy = " ".join(source.split())