High-performance browser automation bridge and multi-instance orchestrator with advanced stealth injection and real-time dashboard.
feat(dashboard): trust proxy headers toggle in settings (#325)
luigiagent42ea23c85efa
diff --git a/dashboard/src/pages/SettingsPage.tsx b/dashboard/src/pages/SettingsPage.tsxindex dfbf2cdc..5b3d94c3 100644--- a/dashboard/src/pages/SettingsPage.tsx+++ b/dashboard/src/pages/SettingsPage.tsx@@ -1302,6 +1302,28 @@ export default function SettingsPage() {className={fieldClass}/></SettingRow>+ <SettingRow+ label="Trust proxy headers"+ description="Trust X-Forwarded-Proto, X-Forwarded-Host, and Forwarded headers for origin checks. Enable only when PinchTab runs behind a trusted reverse proxy (e.g. Caddy, nginx)."+ >+ <label className="flex items-center justify-end gap-3 text-sm text-text-secondary">+ <input+ type="checkbox"+ checked={+ backendConfig.server.trustProxyHeaders ?? false+ }+ onChange={(e) =>+ updateBackendSection("server", {+ trustProxyHeaders: e.target.checked,+ })+ }+ className="accent-primary"+ />+ {backendConfig.server.trustProxyHeaders+ ? "Enabled"+ : "Disabled"}+ </label>+ </SettingRow><SettingRowlabel="Allow attach"description="Permit attaching PinchTab to externally managed Chrome sessions."diff --git a/dashboard/src/types/index.ts b/dashboard/src/types/index.tsindex 09b00ab7..4681ae54 100644--- a/dashboard/src/types/index.ts+++ b/dashboard/src/types/index.ts@@ -58,6 +58,7 @@ export interface BackendServerConfig {bind: string;token: string;stateDir: string;+ trustProxyHeaders: boolean;}export interface BackendBrowserConfig {@@ -158,6 +159,7 @@ export const defaultBackendConfig: BackendConfig = {bind: "127.0.0.1",token: "",stateDir: "",+ trustProxyHeaders: false,},browser: {version: "144.0.7559.133",diff --git a/tests/e2e/scenarios-api/auth-full.sh b/tests/e2e/scenarios-api/auth-full.shindex aa322566..c3779a88 100644--- a/tests/e2e/scenarios-api/auth-full.sh+++ b/tests/e2e/scenarios-api/auth-full.sh@@ -336,3 +336,59 @@ assert_json_exists "$RESULT" ".details.retryAfterSec" "retry-after details returassert_auth_header_contains "Retry-After: " "retry-after header returned"end_test++# ─────────────────────────────────────────────────────────────────+start_test "auth: forwarded proxy headers ignored by default"++# Login with real origin to get a valid session cookie+auth_reset_session+auth_post_json /api/auth/login "{\"token\":\"${E2E_SERVER_TOKEN}\"}" -H "Origin: ${E2E_SERVER}"+assert_http_status 200 "login succeeds with real origin"+assert_session_cookie_present "session cookie set"++# Session works with real origin+auth_get /health -H "Origin: ${E2E_SERVER}"+assert_http_status 200 "health ok with real origin"++# Forwarded headers should NOT override — request still uses real host+auth_get /health -H "Origin: https://proxy.example.com" -H "X-Forwarded-Proto: https" -H "X-Forwarded-Host: proxy.example.com"+assert_http_status 403 "forwarded headers ignored when trustProxyHeaders is off"++end_test++# ─────────────────────────────────────────────────────────────────+start_test "auth: forwarded proxy headers trusted when enabled"++# Enable trustProxyHeaders via bearer token (bypasses origin checks)+RESULT=$(e2e_curl -s -w "\n%{http_code}" -X PUT "${E2E_SERVER}/api/config" \+ -H "Content-Type: application/json" \+ -d '{"server":{"trustProxyHeaders":true}}')+HTTP_STATUS=$(echo "$RESULT" | tail -n 1)+RESULT=$(echo "$RESULT" | head -n -1)+assert_http_status 200 "enable trustProxyHeaders"++# Now login with forwarded origin+auth_reset_session+auth_post_json /api/auth/login "{\"token\":\"${E2E_SERVER_TOKEN}\"}" \+ -H "Origin: https://proxy.example.com" \+ -H "X-Forwarded-Proto: https" \+ -H "X-Forwarded-Host: proxy.example.com"+assert_http_status 200 "login succeeds with forwarded origin"+assert_session_cookie_present "session cookie set via proxy"++# Session requests work with forwarded headers+auth_get /health \+ -H "Origin: https://proxy.example.com" \+ -H "X-Forwarded-Proto: https" \+ -H "X-Forwarded-Host: proxy.example.com"+assert_http_status 200 "health ok with forwarded proxy headers"++# Disable trustProxyHeaders again+RESULT=$(e2e_curl -s -w "\n%{http_code}" -X PUT "${E2E_SERVER}/api/config" \+ -H "Content-Type: application/json" \+ -d '{"server":{"trustProxyHeaders":false}}')+HTTP_STATUS=$(echo "$RESULT" | tail -n 1)+RESULT=$(echo "$RESULT" | head -n -1)+assert_http_status 200 "disable trustProxyHeaders"++end_test