High-performance browser automation bridge and multi-instance orchestrator with advanced stealth injection and real-time dashboard.
fix: simplify env vars and config, remove /stealth/status endpoint (#288)
pinchtabdev2d04e6f20b64
diff --git a/TESTING.md b/TESTING.mdindex f454e9de..263ce4f3 100644--- a/TESTING.md+++ b/TESTING.md@@ -69,9 +69,6 @@ Runs the orchestration-focused curl scenarios, including multi-instance flows an| Variable | Default | Description ||---|---|---|-| `PINCHTAB_TEST_PORT` | `19867` | Port for the test server |-| `PINCHTAB_TEST_KEEP_DIR` | _(unset)_ | Set to any value to preserve the test dir after tests finish |-| `CHROME_BINARY` | _(auto-detect)_ | Path to Chrome binary (used in CI) || `CI` | _(unset)_ | Set to `true` for longer health check timeouts (60s vs 30s) |### Temp Directory Layout@@ -85,11 +82,7 @@ Each E2E test run creates a single temp directory under `/tmp/pinchtab-test-*/`:└── profiles/ # Chrome user-data directories```-Everything is cleaned up automatically when tests finish. To inspect after a failure:--```bash-PINCHTAB_TEST_KEEP_DIR=1 ./dev e2e-```+Everything is cleaned up automatically when tests finish.## Test File Structure@@ -130,8 +123,7 @@ set -e # Exit on error. "$(dirname "$0")/../helpers.sh"# Test setup-TEST_PORT="${PINCHTAB_TEST_PORT:-19867}"-SERVER_URL="http://localhost:$TEST_PORT"+SERVER_URL="http://localhost:9867"# Start server if neededstart_test_serverdiff --git a/cmd/pinchtab/cmd_cli.go b/cmd/pinchtab/cmd_cli.goindex 01e853b2..99f357d7 100644--- a/cmd/pinchtab/cmd_cli.go+++ b/cmd/pinchtab/cmd_cli.go@@ -536,20 +536,19 @@ func init() {func runCLIWith(cfg *config.RuntimeConfig, fn func(client *http.Client, base, token string)) {client := &http.Client{Timeout: 60 * time.Second}- bind := cfg.Bind- if bind == "" {- bind = "127.0.0.1"- }+ // Default: http://127.0.0.1:{port}port := cfg.Portif port == "" {port = "9867"}- base := fmt.Sprintf("http://%s:%s", bind, port)+ base := fmt.Sprintf("http://127.0.0.1:%s", port)- if envURL := os.Getenv("PINCHTAB_URL"); envURL != "" {- base = strings.TrimRight(envURL, "/")+ // --server flag overrides+ if serverURL != "" {+ base = strings.TrimRight(serverURL, "/")}+ // Token from config, env var overridestoken := cfg.Tokenif envToken := os.Getenv("PINCHTAB_TOKEN"); envToken != "" {token = envTokendiff --git a/cmd/pinchtab/cmd_mcp.go b/cmd/pinchtab/cmd_mcp.goindex a6298000..1c33ce9b 100644--- a/cmd/pinchtab/cmd_mcp.go+++ b/cmd/pinchtab/cmd_mcp.go@@ -3,6 +3,7 @@ package mainimport ("fmt""os"+ "strings""github.com/pinchtab/pinchtab/internal/config""github.com/pinchtab/pinchtab/internal/mcp"@@ -25,18 +26,22 @@ func init() {}func runMCP(cfg *config.RuntimeConfig) {- baseURL := os.Getenv("PINCHTAB_URL")- if baseURL == "" {- port := cfg.Port- if port == "" {- port = "9867"- }- baseURL = "http://127.0.0.1:" + port+ // Default: http://127.0.0.1:{port}+ port := cfg.Port+ if port == "" {+ port = "9867"}+ baseURL := "http://127.0.0.1:" + port- token := os.Getenv("PINCHTAB_TOKEN")- if token == "" {- token = cfg.Token+ // --server flag overrides+ if serverURL != "" {+ baseURL = strings.TrimRight(serverURL, "/")+ }++ // Token from config, env var overrides+ token := cfg.Token+ if envToken := os.Getenv("PINCHTAB_TOKEN"); envToken != "" {+ token = envToken}mcp.Version = versiondiff --git a/cmd/pinchtab/root.go b/cmd/pinchtab/root.goindex b4e75439..5a979531 100644--- a/cmd/pinchtab/root.go+++ b/cmd/pinchtab/root.go@@ -103,10 +103,16 @@ func Execute() {}}+// serverURL is the global --server flag for CLI commands+var serverURL string+func init() {rootCmd.Version = versionrootCmd.SetVersionTemplate("pinchtab {{.Version}}\n")+ // Global flags+ rootCmd.PersistentFlags().StringVar(&serverURL, "server", "", "PinchTab server URL (default: http://127.0.0.1:{port})")+// Grouping commandsprimaryGroup := &cobra.Group{ID: "primary", Title: "Primary Commands"}browserGroup := &cobra.Group{ID: "browser", Title: "Browser Control"}diff --git a/docker-entrypoint-release.sh b/docker-entrypoint-release.shindex 34325c55..de43906b 100644--- a/docker-entrypoint-release.sh+++ b/docker-entrypoint-release.sh@@ -13,23 +13,13 @@ mkdir -p "$home_dir" "$xdg_config_home" "$(dirname "$default_config_path")"# docker run -e PINCHTAB_TOKEN_FILE=/run/secrets/pinchtab_tokenif [ -z "${PINCHTAB_CONFIG:-}" ] && [ ! -f "$default_config_path" ]; then/usr/local/bin/pinchtab config init >/dev/null+ # Docker containers need to bind to 0.0.0.0 for port publishing to work+ /usr/local/bin/pinchtab config set server.bind "0.0.0.0" >/dev/nullif [ -n "${PINCHTAB_TOKEN:-}" ]; then/usr/local/bin/pinchtab config set server.token "$PINCHTAB_TOKEN" >/dev/nullfifi-# RUNTIME BIND OVERRIDE FOR DOCKER PORT PUBLISHING-#-# The persisted config stores bind: "127.0.0.1" (secure loopback default).-# But Docker port publishing requires the process to listen on 0.0.0.0 inside-# the container, so the host can forward traffic to it.-#-# Solution: override PINCHTAB_BIND at runtime only when using managed config.-# The persisted config remains secure unless the user explicitly changes it.-if [ -z "${PINCHTAB_CONFIG:-}" ] && [ -z "${PINCHTAB_BIND:-}" ]; then- export PINCHTAB_BIND=0.0.0.0-fi-# CHROME SANDBOX DISABLED IN CONTAINERS## Chrome requires --no-sandbox inside containers because:diff --git a/docker-entrypoint.sh b/docker-entrypoint.shindex 34325c55..de43906b 100644--- a/docker-entrypoint.sh+++ b/docker-entrypoint.sh@@ -13,23 +13,13 @@ mkdir -p "$home_dir" "$xdg_config_home" "$(dirname "$default_config_path")"# docker run -e PINCHTAB_TOKEN_FILE=/run/secrets/pinchtab_tokenif [ -z "${PINCHTAB_CONFIG:-}" ] && [ ! -f "$default_config_path" ]; then/usr/local/bin/pinchtab config init >/dev/null+ # Docker containers need to bind to 0.0.0.0 for port publishing to work+ /usr/local/bin/pinchtab config set server.bind "0.0.0.0" >/dev/nullif [ -n "${PINCHTAB_TOKEN:-}" ]; then/usr/local/bin/pinchtab config set server.token "$PINCHTAB_TOKEN" >/dev/nullfifi-# RUNTIME BIND OVERRIDE FOR DOCKER PORT PUBLISHING-#-# The persisted config stores bind: "127.0.0.1" (secure loopback default).-# But Docker port publishing requires the process to listen on 0.0.0.0 inside-# the container, so the host can forward traffic to it.-#-# Solution: override PINCHTAB_BIND at runtime only when using managed config.-# The persisted config remains secure unless the user explicitly changes it.-if [ -z "${PINCHTAB_CONFIG:-}" ] && [ -z "${PINCHTAB_BIND:-}" ]; then- export PINCHTAB_BIND=0.0.0.0-fi-# CHROME SANDBOX DISABLED IN CONTAINERS## Chrome requires --no-sandbox inside containers because:diff --git a/docs/architecture/mcp.md b/docs/architecture/mcp.mdindex 7d5d2d74..23c5743d 100644--- a/docs/architecture/mcp.md+++ b/docs/architecture/mcp.md@@ -16,7 +16,7 @@ flowchart LRKey design decisions:- **No direct Chrome dependency** — the MCP process has no CDP connection. All browser work is delegated to the PinchTab instance.-- **Any deployment works** — point `PINCHTAB_URL` at a local server, a Docker container, or a remote host.+- **Any deployment works** — use `--server` flag to point at a local server, Docker container, or remote host.- **Stateless protocol layer** — the MCP server holds no browser state itself; it is purely a translation adapter.## Transport@@ -30,8 +30,9 @@ This transport is universally supported by MCP clients (Claude Desktop, VS Code,```pinchtab mcp│- ├── reads PINCHTAB_URL (env or config, default http://127.0.0.1:9867)- ├── reads PINCHTAB_TOKEN (env or config)+ ├── reads config port (default http://127.0.0.1:9867)+ ├── --server flag (override for remote servers)+ ├── reads PINCHTAB_TOKEN (env or config)│├── creates internal/mcp.Client (HTTP client with 120 s timeout)├── registers 21 MCP tools via mcp-go SDKdiff --git a/docs/deep-dive/lite-engin-prototype.md b/docs/deep-dive/lite-engin-prototype.mdindex a3f6e42c..b5674dbc 100644--- a/docs/deep-dive/lite-engin-prototype.md+++ b/docs/deep-dive/lite-engin-prototype.md@@ -82,7 +82,7 @@ No handler, config, or CMD changes needed.### Modified Files (8)| File | Change ||------|--------|-| `internal/config/config.go` | Added `Engine` field to RuntimeConfig + ServerConfig, `PINCHTAB_ENGINE` env var |+| `internal/config/config.go` | Added `Engine` field to RuntimeConfig + ServerConfig || `internal/handlers/handlers.go` | Added `Router *engine.Router` field, `useLite()` helper || `internal/handlers/navigation.go` | Lite fast path before ensureChrome || `internal/handlers/snapshot.go` | Lite fast path with SnapshotNode → A11yNode conversion |@@ -103,7 +103,7 @@ No handler, config, or CMD changes needed.| Role mapping | Basic (a, button, input, etc.) | Extended: section→region, details→group, summary→button, dialog, article || Interactive detection | Basic tags | Adds summary, ARIA roles (tab, menuitem, switch) || Routing | None (always lite) | Strategy-pattern Router with pluggable rules |-| Configuration | None | `PINCHTAB_ENGINE` env var, config file support |+| Configuration | None | Config file support (`server.engine`) |## Test Results@@ -199,12 +199,7 @@ ok internal/web 1.5s## Configuration-### Environment Variable-```bash-PINCHTAB_ENGINE=lite # or "chrome" (default) or "auto"-```--### Config File+Set the engine in your config file:```json{"server": {diff --git a/docs/endpoints.md b/docs/endpoints.mdindex 65b66a71..b86d644d 100644--- a/docs/endpoints.md+++ b/docs/endpoints.md@@ -132,10 +132,9 @@ GET /tabs/{id}/cookies # Get cookies (specific tab)POST /tabs/{id}/cookies # Set cookies (specific tab)```-## Stealth+## Fingerprint```-GET /stealth/status # Stealth status and detection scorePOST /fingerprint/rotate # Rotate browser fingerprint```diff --git a/docs/get-started.md b/docs/get-started.mdindex 12379f76..077af03c 100644--- a/docs/get-started.md+++ b/docs/get-started.md@@ -161,7 +161,8 @@ pinchtab### Port already in use```bash-PINCHTAB_PORT=9868 pinchtab+pinchtab config set server.port 9868+pinchtab```### Chrome not found@@ -173,8 +174,8 @@ brew install chromium# Linux (Ubuntu/Debian)sudo apt install chromium-browser-# Custom Chrome binary-CHROME_BIN=/path/to/chrome pinchtab+# Custom Chrome binary (set in config)+pinchtab config set browser.chromeBinary /path/to/chrome```---diff --git a/docs/guides/contributing.md b/docs/guides/contributing.mdindex 7362a25c..cd0cb74a 100644--- a/docs/guides/contributing.md+++ b/docs/guides/contributing.md@@ -191,7 +191,7 @@ ls -la pinchtab**Expected output:**```🦀 PINCH! PINCH! port=9867-auth disabled (set BRIDGE_TOKEN to enable)+auth disabled (set PINCHTAB_TOKEN to enable)```### Start (Headed Mode)diff --git a/docs/guides/docker.md b/docs/guides/docker.mdindex 779332b3..f7cd136d 100644--- a/docs/guides/docker.md+++ b/docs/guides/docker.md@@ -23,7 +23,7 @@ docker run -d \pinchtab```-On first boot, the image creates `/data/.config/pinchtab/config.json` and generates a token if needed. When you use the managed-config path, the container binds to `0.0.0.0` at runtime via `PINCHTAB_BIND`, but the persisted config remains on the normal loopback default unless you override it yourself.+On first boot, the image creates `/data/.config/pinchtab/config.json` with `bind: 0.0.0.0` (required for Docker port publishing) and generates a token if needed.If you inspect the startup security summary from inside Docker, the loopback bind check will still report the effective runtime bind as non-loopback. That is expected: the process is listening on `0.0.0.0` inside the container so Docker port publishing can forward traffic to it.@@ -171,24 +171,16 @@ Without a mounted volume, profiles and saved session state are ephemeral.## Runtime Configuration-For current runtime overrides, rely on:+Supported environment variables:- `PINCHTAB_CONFIG` — path to custom config file (if not using managed config)-- `PINCHTAB_BIND` — bind address (default: 127.0.0.1, overridden to 0.0.0.0 in managed-config containers)-- `PINCHTAB_PORT` — server port (default: 9867)- `PINCHTAB_TOKEN` — auth token (prefer Docker secrets; see below)-Everything else, including Chrome binary path, should go in `config.json`.+Everything else, including bind address and port, should go in `config.json`.-In the bundled image, you usually do not need to set `PINCHTAB_BIND` or `PINCHTAB_PORT` manually. The managed-config entrypoint supplies `PINCHTAB_BIND=0.0.0.0` at runtime so Docker port publishing works without broadening the persisted config. To customize the Chrome binary path, use `config.json`.+### About `bind: 0.0.0.0` in Containers-### About `PINCHTAB_BIND=0.0.0.0` in Containers--The entrypoint automatically sets `PINCHTAB_BIND=0.0.0.0` at runtime when using managed config. This is necessary because:--1. **Docker port publishing** requires the process to listen on `0.0.0.0` inside the container-2. **Persisted config** stays secure with `bind: "127.0.0.1"` so it doesn't accidentally expose the service if the container is restarted outside Docker-3. **Separation of concerns** — runtime behavior (where to bind) is separate from persisted configuration+The entrypoint sets `bind: 0.0.0.0` in the config on first boot. This is necessary because Docker port publishing requires the process to listen on `0.0.0.0` inside the container.Example: `docker run -p 127.0.0.1:9867:9867` keeps PinchTab reachable only from your host machine, even though the process internally listens on `0.0.0.0`.diff --git a/docs/guides/identifying-instances.md b/docs/guides/identifying-instances.mdindex 799e697b..2dabee39 100644--- a/docs/guides/identifying-instances.md+++ b/docs/guides/identifying-instances.md@@ -15,7 +15,9 @@ If you copy Chrome or Chromium to a custom filename, that filename appears in prcp "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" /usr/local/bin/pinchtab-chromechmod +x /usr/local/bin/pinchtab-chrome-CHROME_BIN=/usr/local/bin/pinchtab-chrome pinchtab+# Set in config.json+pinchtab config set browser.chromeBinary /usr/local/bin/pinchtab-chrome+pinchtab```Now a process listing such as `ps -axo pid,command | rg pinchtab-chrome` gives you a quick way to spot the browser PinchTab launches.@@ -71,7 +73,7 @@ curl http://localhost:9867/instancesFor most setups, this combination is enough:-1. point PinchTab to a renamed Chrome binary with `CHROME_BIN`+1. point PinchTab to a renamed Chrome binary via `browser.chromeBinary` in config2. add a recognizable `browser.extraFlags` marker in config3. verify the profile path or instance ID in the dashboard@@ -79,6 +81,6 @@ For most setups, this combination is enough:The same approach works in containers:-- use `CHROME_BIN` only if you need to override the bundled browser path+- set `browser.chromeBinary` in config if you need to override the bundled browser path- put identifying flags in `browser.extraFlags`- inspect the instance list from the API or dashboard rather than relying only on process names inside the containerdiff --git a/docs/guides/mcp-agents.md b/docs/guides/mcp-agents.mdindex b2da4de6..42113749 100644--- a/docs/guides/mcp-agents.md+++ b/docs/guides/mcp-agents.md@@ -43,7 +43,6 @@ Edit `~/Library/Application Support/Claude/claude_desktop_config.json` (macOS) o"command": "pinchtab","args": ["mcp"],"env": {- "PINCHTAB_URL": "http://127.0.0.1:9867","PINCHTAB_TOKEN": "your-token-here"}}@@ -63,10 +62,7 @@ Create `.vscode/mcp.json` in your workspace root:"pinchtab": {"type": "stdio","command": "pinchtab",- "args": ["mcp"],- "env": {- "PINCHTAB_URL": "http://127.0.0.1:9867"- }+ "args": ["mcp"]}}}@@ -97,7 +93,6 @@ proc = subprocess.Popen(["pinchtab", "mcp"],stdin=subprocess.PIPE,stdout=subprocess.PIPE,- env={"PINCHTAB_URL": "http://127.0.0.1:9867"},)# pass proc.stdin / proc.stdout to your MCP client transport```@@ -106,9 +101,10 @@ proc = subprocess.Popen(| Variable | Default | Description ||----------|---------|-------------|-| `PINCHTAB_URL` | `http://127.0.0.1:9867` | PinchTab server URL || `PINCHTAB_TOKEN` | *(from config)* | Bearer token for auth-protected servers |+For remote servers, use the `--server` flag: `pinchtab --server http://remote:9867 mcp`+`PINCHTAB_TOKEN` can be found in `~/.config/pinchtab/config.yaml` under `server.token`, or by running `pinchtab config show`.## Typical Agent Workflow@@ -160,16 +156,15 @@ Restart PinchTab after changing this setting.## Connecting to a Remote PinchTab-If PinchTab is running on another machine (e.g. a Docker container):+If PinchTab is running on another machine (e.g. a Docker container), use the `--server` flag:```json{"mcpServers": {"pinchtab": {"command": "pinchtab",- "args": ["mcp"],+ "args": ["--server", "http://192.168.1.50:9867", "mcp"],"env": {- "PINCHTAB_URL": "http://192.168.1.50:9867","PINCHTAB_TOKEN": "your-secure-token"}}diff --git a/docs/guides/raspberry-pi.md b/docs/guides/raspberry-pi.mdindex 3f2d6cb7..13795a65 100644--- a/docs/guides/raspberry-pi.md+++ b/docs/guides/raspberry-pi.md@@ -26,10 +26,11 @@ which chromium-browserwhich chromium```-If auto-detection misses it, set:+If auto-detection misses it, set the binary path in config:```bash-CHROME_BIN=/usr/bin/chromium-browser pinchtab+pinchtab config set browser.chromeBinary /usr/bin/chromium-browser+pinchtab```## Install PinchTab@@ -134,7 +135,6 @@ User=piWorkingDirectory=/home/piExecStart=/home/pi/pinchtabEnvironment=PINCHTAB_CONFIG=/home/pi/.config/pinchtab/config.json-Environment=CHROME_BIN=/usr/bin/chromium-browserRestart=alwaysRestartSec=10@@ -163,10 +163,10 @@ sudo systemctl status pinchtab### Chrome Binary Not Found-Set `CHROME_BIN` explicitly:+Set `browser.chromeBinary` in config:```bash-CHROME_BIN=/usr/bin/chromium-browser ./pinchtab+pinchtab config set browser.chromeBinary /usr/bin/chromium-browser```### Out Of Memory@@ -185,8 +185,9 @@ Reduce workload in config:### Port Already In Use-Override the server port:+Change the port in config:```bash-PINCHTAB_PORT=9868 ./pinchtab+pinchtab config set server.port 9868+./pinchtab```diff --git a/docs/guides/remote-bridge-orchestrator.md b/docs/guides/remote-bridge-orchestrator.mdindex 9afef2ca..49450db0 100644--- a/docs/guides/remote-bridge-orchestrator.md+++ b/docs/guides/remote-bridge-orchestrator.md@@ -107,12 +107,15 @@ If you leave `allowSchemes` as only `ws,wss`, `attach-bridge` will be rejected.## Step 1: Start The Remote Bridge-On the remote machine:+On the remote machine, configure and start the bridge:```bash-PINCHTAB_BIND=0.0.0.0 \-PINCHTAB_PORT=9868 \-PINCHTAB_TOKEN=bridge-secret-token \+# Set bind address for network access+pinchtab config set server.bind 0.0.0.0+pinchtab config set server.port 9868+pinchtab config set server.token bridge-secret-token++# Start the bridgepinchtab bridge```diff --git a/docs/guides/tailscale-bridge-orchestrator.md b/docs/guides/tailscale-bridge-orchestrator.mdindex e9c9a2a9..84a5ffb3 100644--- a/docs/guides/tailscale-bridge-orchestrator.md+++ b/docs/guides/tailscale-bridge-orchestrator.md@@ -132,16 +132,19 @@ No normal WAN port forwarding is required.## Step 1: Start The Bridge On Machine B-On machine B, start the bridge so it listens on a Tailscale-reachable address:+On machine B, configure and start the bridge so it listens on a Tailscale-reachable address:```bash-PINCHTAB_BIND=0.0.0.0 \-PINCHTAB_PORT=9867 \-PINCHTAB_TOKEN=bridge-secret-token \+# Configure for network access+pinchtab config set server.bind 0.0.0.0+pinchtab config set server.port 9867+pinchtab config set server.token bridge-secret-token++# Start the bridgepinchtab bridge```-If you are using a daemon or service manager, the same rule applies: the service environment must include `PINCHTAB_BIND=0.0.0.0`.+If you are using a daemon or service manager, ensure the config file has `bind: "0.0.0.0"`.The first common mistake is to leave the bridge on the default localhost bind. When that happens:@@ -281,10 +284,10 @@ This is the part that causes the most confusion.### Direct Bridge Port: Usually HTTP-If you start the bridge like this:+If you start the bridge with `bind: 0.0.0.0` and `port: 9867` in your config:```bash-PINCHTAB_BIND=0.0.0.0 PINCHTAB_PORT=9867 pinchtab bridge+pinchtab bridge```the bridge itself is usually speaking plain HTTP on that port.diff --git a/docs/implementations/docker-local-testing.md b/docs/implementations/docker-local-testing.mdindex 93330f65..aa6a7a47 100644--- a/docs/implementations/docker-local-testing.md+++ b/docs/implementations/docker-local-testing.md@@ -29,15 +29,13 @@ Expected results:- `server.bind` in the persisted config remains `127.0.0.1`- a token is present if one was generated on first boot or passed in-Verify the effective runtime bind separately:+Verify the config bind address:```bash-docker exec pinchtab sh -lc 'echo "$PINCHTAB_BIND"'+docker exec pinchtab pinchtab config get server.bind```-Expected result:--- `PINCHTAB_BIND` is `0.0.0.0` unless you overrode it explicitly+Expected result: `0.0.0.0` (set by entrypoint on first boot)Verify persistence across restart:diff --git a/docs/implementations/lite-engine.md b/docs/implementations/lite-engine.mdindex abd1ab2c..4fa318ae 100644--- a/docs/implementations/lite-engine.md+++ b/docs/implementations/lite-engine.md@@ -86,7 +86,7 @@ No handler, bridge, or config change is needed when adding new routing logic —## Request Flow (Lite Mode)```-POST /navigate (PINCHTAB_ENGINE=lite)+POST /navigate (server.engine=lite)│▼handlers/navigation.go — HandleNavigate()@@ -145,13 +145,7 @@ even in `lite` mode.## Configuration-### Environment Variable--```bash-PINCHTAB_ENGINE=lite # or "chrome" (default) or "auto"-```--### Config File (`pinchtab.json`)+Set the engine in your config file:```json{diff --git a/docs/mcp.md b/docs/mcp.mdindex d4dee0ec..14f7f168 100644--- a/docs/mcp.md+++ b/docs/mcp.md@@ -29,10 +29,7 @@ Add to your `claude_desktop_config.json`:"mcpServers": {"pinchtab": {"command": "pinchtab",- "args": ["mcp"],- "env": {- "PINCHTAB_URL": "http://127.0.0.1:9867"- }+ "args": ["mcp"]}}}@@ -73,9 +70,10 @@ Add to your Cursor MCP settings:| Variable | Default | Description ||----------|---------|-------------|-| `PINCHTAB_URL` | `http://127.0.0.1:9867` | PinchTab server URL || `PINCHTAB_TOKEN` | *(from config)* | Auth token for secured servers |+For remote servers, use the `--server` flag: `pinchtab --server http://remote:9867 mcp`+## Available Tools### Navigation (4 tools)diff --git a/docs/reference/config.md b/docs/reference/config.mdindex 14e3743e..e61819a1 100644--- a/docs/reference/config.md+++ b/docs/reference/config.md@@ -108,15 +108,12 @@ PinchTab loads configuration in this order:2. config file3. built-in defaults-The currently supported operational env vars are:+The supported env vars are:-- `PINCHTAB_CONFIG`-- `PINCHTAB_BIND`-- `PINCHTAB_PORT`-- `PINCHTAB_TOKEN`-- `CHROME_BIN`+- `PINCHTAB_CONFIG` — path to config file+- `PINCHTAB_TOKEN` — auth token (overrides config file)-Everything else should be configured in `config.json`.+Everything else is configured in `config.json`. For CLI targeting a remote server, use the `--server` flag.For the common local workflow, prefer the interactive `pinchtab config` screen for everyday changes and use `get`, `set`, or `patch` when you need an exact scripted edit.@@ -125,7 +122,7 @@ For the common local workflow, prefer the interactive `pinchtab config` screen fDefault location by OS:- macOS: `~/Library/Application Support/pinchtab/config.json`-- Linux: `~/.config/pinchtab/config.json` or `$XDG_CONFIG_HOME/pinchtab/config.json`+- Linux: `~/.config/pinchtab/config.json` (respects `$XDG_CONFIG_HOME` if set)- Windows: `%APPDATA%\pinchtab\config.json`Legacy fallback:@@ -251,7 +248,9 @@ Current nested config shape:### Network Bind With Token```bash-PINCHTAB_BIND=0.0.0.0 PINCHTAB_TOKEN=secret pinchtab+pinchtab config set server.bind 0.0.0.0+pinchtab config set server.token secret+pinchtab```### Custom Instance Port Range@@ -352,7 +351,7 @@ Valid enum values:| Field | Values || --- | --- || `instanceDefaults.mode` | `headless`, `headed` |-| `instanceDefaults.stealthLevel` | `light`, `medium`, `full` |+| `instanceDefaults.stealthLevel` | `light`, `full` || `instanceDefaults.tabEvictionPolicy` | `reject`, `close_oldest`, `close_lru` (default) || `multiInstance.strategy` | `simple`, `explicit`, `simple-autorestart`, `always-on` (default) || `multiInstance.allocationPolicy` | `fcfs`, `round_robin`, `random` |diff --git a/internal/config/config_load.go b/internal/config/config_load.goindex ff432163..aa7899ea 100644--- a/internal/config/config_load.go+++ b/internal/config/config_load.go@@ -12,9 +12,9 @@ import (// Load returns the RuntimeConfig with precedence: env vars > config file > defaults.func Load() *RuntimeConfig {cfg := &RuntimeConfig{- // Server defaults + selected env vars- Bind: envOr("PINCHTAB_BIND", "127.0.0.1"),- Port: envOr("PINCHTAB_PORT", "9867"),+ // Server defaults+ Bind: "127.0.0.1",+ Port: "9867",InstancePortStart: 9868,InstancePortEnd: 9968,Token: os.Getenv("PINCHTAB_TOKEN"),@@ -41,7 +41,7 @@ func Load() *RuntimeConfig {BlockAds: false,MaxTabs: 20,MaxParallelTabs: 0,- ChromeBinary: "", // Set via config.json only; env var CHROME_BIN removed+ ChromeBinary: "", // Set via config.json onlyChromeExtraFlags: "",ExtensionPaths: nil,UserAgent: "",@@ -78,8 +78,8 @@ func Load() *RuntimeConfig {ScanTimeoutSec: 5,},- // Engine default- Engine: envOr("PINCHTAB_ENGINE", "chrome"),+ // Engine default (set via config.json only)+ Engine: "chrome",}finalizeProfileConfig(cfg)@@ -161,10 +161,10 @@ func finalizeProfileConfig(cfg *RuntimeConfig) {func applyFileConfig(cfg *RuntimeConfig, fc *FileConfig) {// Server- if fc.Server.Port != "" && os.Getenv("PINCHTAB_PORT") == "" {+ if fc.Server.Port != "" {cfg.Port = fc.Server.Port}- if fc.Server.Bind != "" && os.Getenv("PINCHTAB_BIND") == "" {+ if fc.Server.Bind != "" {cfg.Bind = fc.Server.Bind}if fc.Server.Token != "" && os.Getenv("PINCHTAB_TOKEN") == "" {@@ -173,7 +173,7 @@ func applyFileConfig(cfg *RuntimeConfig, fc *FileConfig) {if fc.Server.StateDir != "" {cfg.StateDir = fc.Server.StateDir}- if fc.Server.Engine != "" && os.Getenv("PINCHTAB_ENGINE") == "" {+ if fc.Server.Engine != "" {cfg.Engine = fc.Server.Engine}// Securitydiff --git a/internal/config/config_load_test.go b/internal/config/config_load_test.goindex 4fd59a46..55970f00 100644--- a/internal/config/config_load_test.go+++ b/internal/config/config_load_test.go@@ -91,41 +91,37 @@ func TestLoadConfigDefaults(t *testing.T) {}}-func TestLoadConfigEnvOverrides(t *testing.T) {+func TestLoadConfigTokenEnvOverride(t *testing.T) {clearConfigEnvVars(t)// Point to non-existent config to isolate env var testing_ = os.Setenv("PINCHTAB_CONFIG", filepath.Join(t.TempDir(), "nonexistent.json"))- _ = os.Setenv("PINCHTAB_PORT", "1234")- _ = os.Setenv("PINCHTAB_BIND", "0.0.0.0")_ = os.Setenv("PINCHTAB_TOKEN", "secret")defer func() {_ = os.Unsetenv("PINCHTAB_CONFIG")- _ = os.Unsetenv("PINCHTAB_PORT")- _ = os.Unsetenv("PINCHTAB_BIND")_ = os.Unsetenv("PINCHTAB_TOKEN")}()cfg := Load()- if cfg.Port != "1234" {- t.Errorf("env Port = %v, want 1234", cfg.Port)+ // Port and Bind use defaults (no env var override anymore)+ if cfg.Port != "9867" {+ t.Errorf("default Port = %v, want 9867", cfg.Port)}- if cfg.Bind != "0.0.0.0" {- t.Errorf("env Bind = %v, want 0.0.0.0", cfg.Bind)+ if cfg.Bind != "127.0.0.1" {+ t.Errorf("default Bind = %v, want 127.0.0.1", cfg.Bind)}+ // Token still supports env var overrideif cfg.Token != "secret" {t.Errorf("env Token = %v, want secret", cfg.Token)}}-func TestPinchtabEnvTakesPrecedence(t *testing.T) {+func TestConfigFilePortOverridesDefault(t *testing.T) {clearConfigEnvVars(t)tmpDir := t.TempDir()configPath := filepath.Join(tmpDir, "config.json")_ = os.Setenv("PINCHTAB_CONFIG", configPath)- _ = os.Setenv("PINCHTAB_PORT", "7777")defer func() {_ = os.Unsetenv("PINCHTAB_CONFIG")- _ = os.Unsetenv("PINCHTAB_PORT")}()if err := os.WriteFile(configPath, []byte(`{"server":{"port":"8888"}}`), 0644); err != nil {@@ -133,21 +129,19 @@ func TestPinchtabEnvTakesPrecedence(t *testing.T) {}cfg := Load()- if cfg.Port != "7777" {- t.Errorf("precedence Port = %v, want 7777", cfg.Port)+ if cfg.Port != "8888" {+ t.Errorf("config file Port = %v, want 8888", cfg.Port)}}-func TestEnvOverridesNestedConfig(t *testing.T) {+func TestConfigFileWithNestedValues(t *testing.T) {clearConfigEnvVars(t)tmpDir := t.TempDir()configPath := filepath.Join(tmpDir, "config.json")_ = os.Setenv("PINCHTAB_CONFIG", configPath)- _ = os.Setenv("PINCHTAB_PORT", "9999")defer func() {_ = os.Unsetenv("PINCHTAB_CONFIG")- _ = os.Unsetenv("PINCHTAB_PORT")}()// Config file says port 8888 and strategy explicit@@ -165,12 +159,12 @@ func TestEnvOverridesNestedConfig(t *testing.T) {cfg := Load()- // Env var should win- if cfg.Port != "9999" {- t.Errorf("env should override file: Port = %v, want 9999", cfg.Port)+ // Config file values should be used+ if cfg.Port != "8888" {+ t.Errorf("config file Port = %v, want 8888", cfg.Port)}if cfg.Strategy != "explicit" {- t.Errorf("file should supply Strategy = %v, want explicit", cfg.Strategy)+ t.Errorf("config file Strategy = %v, want explicit", cfg.Strategy)}}@@ -192,28 +186,6 @@ func TestLoadConfigEngineFromFile(t *testing.T) {}}-func TestLoadConfigEngineEnvOverridesFile(t *testing.T) {- clearConfigEnvVars(t)-- tmpDir := t.TempDir()- configPath := filepath.Join(tmpDir, "config.json")- _ = os.Setenv("PINCHTAB_CONFIG", configPath)- _ = os.Setenv("PINCHTAB_ENGINE", "auto")- defer func() {- _ = os.Unsetenv("PINCHTAB_CONFIG")- _ = os.Unsetenv("PINCHTAB_ENGINE")- }()-- if err := os.WriteFile(configPath, []byte(`{"server":{"engine":"lite"}}`), 0644); err != nil {- t.Fatal(err)- }-- cfg := Load()- if cfg.Engine != "auto" {- t.Fatalf("engine = %q, want auto", cfg.Engine)- }-}-func TestApplyFileConfigToRuntimeResetsSecurityFlagsToSafeDefaults(t *testing.T) {cfg := &RuntimeConfig{AllowEvaluate: true,@@ -259,7 +231,7 @@ func TestApplyFileConfigToRuntimeResetsSecurityFlagsToSafeDefaults(t *testing.T)func clearConfigEnvVars(t *testing.T) {t.Helper()envVars := []string{- "PINCHTAB_PORT", "PINCHTAB_BIND", "PINCHTAB_TOKEN", "PINCHTAB_CONFIG", "PINCHTAB_ENGINE",+ "PINCHTAB_TOKEN", "PINCHTAB_CONFIG",}for _, v := range envVars {_ = os.Unsetenv(v)diff --git a/internal/config/engine_test.go b/internal/config/engine_test.goindex 5cad5193..920d9deb 100644--- a/internal/config/engine_test.go+++ b/internal/config/engine_test.go@@ -6,8 +6,7 @@ import ("testing")-func TestLoad_EnginePrecedence(t *testing.T) {- t.Setenv("PINCHTAB_ENGINE", "")+func TestLoad_EngineFromConfig(t *testing.T) {t.Setenv("PINCHTAB_CONFIG", filepath.Join(t.TempDir(), "config.json"))cfg := Load()if cfg.Engine != "chrome" {@@ -23,10 +22,4 @@ func TestLoad_EnginePrecedence(t *testing.T) {if cfg.Engine != "lite" {t.Fatalf("file engine = %q, want lite", cfg.Engine)}-- t.Setenv("PINCHTAB_ENGINE", "auto")- cfg = Load()- if cfg.Engine != "auto" {- t.Fatalf("env engine = %q, want auto", cfg.Engine)- }}diff --git a/internal/config/validate.go b/internal/config/validate.goindex df76050b..67392f59 100644--- a/internal/config/validate.go+++ b/internal/config/validate.go@@ -207,7 +207,7 @@ func validateBind(bind string, field string) error {func isValidStealthLevel(level string) bool {switch level {- case "light", "medium", "full":+ case "light", "full":return truedefault:return false@@ -251,7 +251,7 @@ func isValidAttachScheme(scheme string) bool {}func ValidStealthLevels() []string {- return []string{"light", "medium", "full"}+ return []string{"light", "full"}}func ValidEvictionPolicies() []string {diff --git a/internal/config/validate_test.go b/internal/config/validate_test.goindex 548da96a..4e7f5d74 100644--- a/internal/config/validate_test.go+++ b/internal/config/validate_test.go@@ -139,9 +139,9 @@ func TestValidateFileConfig_InvalidStealthLevel(t *testing.T) {wantErr bool}{{"light", false},- {"medium", false},{"full", false},- {"", false}, // empty is ok+ {"", false}, // empty is ok+ {"medium", true}, // removed, no longer valid{"none", true},{"max", true},{"LIGHT", true}, // case sensitivediff --git a/internal/dashboard/dashboard.go b/internal/dashboard/dashboard.goindex bbd243a0..ab41a430 100644--- a/internal/dashboard/dashboard.go+++ b/internal/dashboard/dashboard.go@@ -14,13 +14,6 @@ import ("github.com/pinchtab/pinchtab/internal/bridge")-func envWithFallback(newKey, oldKey string) string {- if v := os.Getenv(newKey); v != "" {- return v- }- return os.Getenv(oldKey)-}-type DashboardConfig struct {IdleTimeout time.DurationDisconnectTimeout time.Duration@@ -117,7 +110,7 @@ func NewDashboard(cfg *DashboardConfig) *Dashboard {sseConns: make(map[chan AgentEvent]struct{}),sysConns: make(map[chan SystemEvent]struct{}),cancel: cancel,- childAuthToken: envWithFallback("PINCHTAB_TOKEN", "BRIDGE_TOKEN"),+ childAuthToken: os.Getenv("PINCHTAB_TOKEN"),}return d}diff --git a/internal/handlers/actions_test.go b/internal/handlers/actions_test.goindex 5613f6c6..d7903b1c 100644--- a/internal/handlers/actions_test.go+++ b/internal/handlers/actions_test.go@@ -249,33 +249,6 @@ func TestHandleSetCookies_EmptyCookies(t *testing.T) {}}-func TestHandleStealthStatus_NoTabs(t *testing.T) {- h := New(&failMockBridge{}, &config.RuntimeConfig{}, nil, nil, nil)-- req := httptest.NewRequest("GET", "/stealth/status", nil)- w := httptest.NewRecorder()-- h.HandleStealthStatus(w, req)-- if w.Code != 200 {- t.Errorf("expected 200, got %d", w.Code)- }-- var resp map[string]interface{}- if err := json.Unmarshal(w.Body.Bytes(), &resp); err != nil {- t.Fatalf("failed to unmarshal response: %v", err)- }-- features, ok := resp["features"].(map[string]interface{})- if !ok {- t.Error("expected features map")- }-- if len(features) == 0 {- t.Error("expected non-empty features")- }-}-func TestHandleFingerprintRotate_NoTab(t *testing.T) {h := New(&failMockBridge{}, &config.RuntimeConfig{}, nil, nil, nil)diff --git a/internal/handlers/handlers.go b/internal/handlers/handlers.goindex 11da37cd..74cea93b 100644--- a/internal/handlers/handlers.go+++ b/internal/handlers/handlers.go@@ -135,7 +135,6 @@ func (h *Handlers) RegisterRoutes(mux *http.ServeMux, doShutdown func()) {mux.HandleFunc("POST /tabs/{id}/cookies", h.HandleTabSetCookies)mux.HandleFunc("GET /cookies", h.HandleGetCookies)mux.HandleFunc("POST /cookies", h.HandleSetCookies)- mux.HandleFunc("GET /stealth/status", h.HandleStealthStatus)mux.HandleFunc("POST /fingerprint/rotate", h.HandleFingerprintRotate)mux.HandleFunc("GET /tabs/{id}/download", h.HandleTabDownload)mux.HandleFunc("POST /tabs/{id}/upload", h.HandleTabUpload)diff --git a/internal/handlers/handlers_test.go b/internal/handlers/handlers_test.goindex 3c672603..b8ca7fb0 100644--- a/internal/handlers/handlers_test.go+++ b/internal/handlers/handlers_test.go@@ -272,15 +272,6 @@ func TestHandleTabFocus(t *testing.T) {})}-func searchString(s, substr string) bool {- for i := 0; i <= len(s)-len(substr); i++ {- if s[i:i+len(substr)] == substr {- return true- }- }- return false-}-func TestRoutesRegistration(t *testing.T) {b := &mockBridge{}cfg := &config.RuntimeConfig{}diff --git a/internal/handlers/stealth.go b/internal/handlers/stealth.goindex 3ad68938..5d3575b6 100644--- a/internal/handlers/stealth.go+++ b/internal/handlers/stealth.go@@ -15,164 +15,6 @@ import ("github.com/pinchtab/pinchtab/internal/web")-func (h *Handlers) HandleStealthStatus(w http.ResponseWriter, r *http.Request) {- ctx, _, err := h.Bridge.TabContext("")- if err != nil {- h.sendStealthResponse(w, h.staticStealthFeatures(), "")- return- }-- // Check actual browser state- var result struct {- WebDriver bool `json:"webdriver"`- Plugins int `json:"plugins"`- UserAgent string `json:"userAgent"`- HardwareConcurrency int `json:"hardwareConcurrency"`- DeviceMemory float64 `json:"deviceMemory"`- Languages []string `json:"languages"`- }-- tCtx, cancel := context.WithTimeout(ctx, 2*time.Second)- defer cancel()-- checkScript := `({- webdriver: navigator.webdriver || false,- plugins: navigator.plugins.length,- userAgent: navigator.userAgent,- hardwareConcurrency: navigator.hardwareConcurrency,- deviceMemory: navigator.deviceMemory || 0,- languages: navigator.languages || []- })`-- if err := chromedp.Run(tCtx, chromedp.Evaluate(checkScript, &result)); err == nil {- features := map[string]bool{- "automation_controlled": !result.WebDriver,- "webdriver_hidden": !result.WebDriver,- "chrome_headless_new": h.Config.Headless,- "user_agent_override": result.UserAgent != "",- "webgl_vendor_override": true,- "plugins_spoofed": result.Plugins > 0,- "languages_spoofed": len(result.Languages) > 0,- "webrtc_leak_prevented": true,- "timezone_spoofed": true,- "canvas_noise": true,- "audio_noise": false,- "font_spoofing": true,- "hardware_concurrency": result.HardwareConcurrency > 0,- "device_memory": result.DeviceMemory > 0,- }- h.sendStealthResponse(w, features, result.UserAgent)- return- }-- h.sendStealthResponse(w, h.staticStealthFeatures(), "")-}--func (h *Handlers) staticStealthFeatures() map[string]bool {- return map[string]bool{- "automation_controlled": true,- "webdriver_hidden": true,- "chrome_headless_new": h.Config.Headless,- "user_agent_override": true,- "webgl_vendor_override": true,- "plugins_spoofed": true,- "languages_spoofed": true,- "webrtc_leak_prevented": true,- "timezone_spoofed": true,- "canvas_noise": true,- "audio_noise": false,- "font_spoofing": true,- "hardware_concurrency": true,- "device_memory": true,- }-}--func (h *Handlers) sendStealthResponse(w http.ResponseWriter, features map[string]bool, userAgent string) {- chromeFlags := []string{- "--disable-features=IsolateOrigins,site-per-process",- "--disable-site-isolation-trials",- "--disable-web-security",- "--disable-features=BlinkGenPropertyTrees",- "--disable-ipc-flooding-protection",- "--disable-renderer-backgrounding",- "--disable-backgrounding-occluded-windows",- "--disable-features=TranslateUI",- "--disable-features=Translate",- }-- enabledCount := 0- for _, enabled := range features {- if enabled {- enabledCount++- }- }- stealthScore := (enabledCount * 100) / len(features)-- var level string- switch {- case stealthScore >= 80:- level = "high"- case stealthScore >= 50:- level = "medium"- case stealthScore >= 30:- level = "basic"- default:- level = "minimal"- }-- if userAgent == "" {- targets, err := h.Bridge.ListTargets()- if err == nil && len(targets) > 0 {- ctx, _, _ := h.Bridge.TabContext(string(targets[0].TargetID))- if ctx != nil {- tCtx, cancel := context.WithTimeout(ctx, 1*time.Second)- _ = chromedp.Run(tCtx, chromedp.Evaluate(`navigator.userAgent`, &userAgent))- cancel()- }- }- }-- web.JSON(w, 200, map[string]any{- "level": level,- "score": stealthScore,- "features": features,- "chrome_flags": chromeFlags,- "headless_mode": h.Config.Headless,- "user_agent": userAgent,- "profile_path": h.Config.ProfileDir,- "recommendations": h.getStealthRecommendations(features),- })-}--func (h *Handlers) getStealthRecommendations(features map[string]bool) []string {- recommendations := []string{}-- if !features["user_agent_override"] {- recommendations = append(recommendations, "Enable user agent rotation to avoid detection")- }- if !features["languages_spoofed"] {- recommendations = append(recommendations, "Randomize Accept-Language headers")- }- if !features["webrtc_leak_prevented"] {- recommendations = append(recommendations, "Block WebRTC to prevent IP leaks")- }- if !features["timezone_spoofed"] {- recommendations = append(recommendations, "Spoof timezone to match target locale")- }- if !features["canvas_noise"] {- recommendations = append(recommendations, "Add canvas fingerprint noise")- }- if !features["font_spoofing"] {- recommendations = append(recommendations, "Randomize font metrics")- }-- if len(recommendations) == 0 {- recommendations = append(recommendations, "Stealth mode is well configured")- }-- return recommendations-}-type fingerprintRequest struct {TabID string `json:"tabId"`OS string `json:"os"`diff --git a/internal/handlers/stealth_test.go b/internal/handlers/stealth_test.goindex 4da91ecd..2374e70b 100644--- a/internal/handlers/stealth_test.go+++ b/internal/handlers/stealth_test.go@@ -12,23 +12,6 @@ import ("github.com/pinchtab/pinchtab/internal/config")-func TestHandleStealthStatus_NoTab_ReturnsStatic(t *testing.T) {- h := New(&mockBridge{}, &config.RuntimeConfig{}, nil, nil, nil)- req := httptest.NewRequest("GET", "/stealth/status", nil)- w := httptest.NewRecorder()-- h.HandleStealthStatus(w, req)-- if w.Code != 200 {- t.Errorf("expected 200, got %d", w.Code)- }-- body := w.Body.String()- if !searchString(body, "level") || !searchString(body, "score") {- t.Errorf("expected level and score in response, got: %s", body)- }-}-func TestHandleFingerprintRotate_InvalidJSON(t *testing.T) {h := New(&mockBridge{}, &config.RuntimeConfig{}, nil, nil, nil)req := httptest.NewRequest("POST", "/fingerprint/rotate", bytes.NewReader([]byte(`not json`)))@@ -83,53 +66,13 @@ func TestGenerateFingerprint_WithBrowser(t *testing.T) {}}-func TestGetStealthRecommendations_AllEnabled(t *testing.T) {- h := Handlers{}- features := map[string]bool{- "user_agent_override": true,- "languages_spoofed": true,- "webrtc_leak_prevented": true,- "timezone_spoofed": true,- "canvas_noise": true,- "font_spoofing": true,- }- recs := h.getStealthRecommendations(features)- if len(recs) != 1 || recs[0] != "Stealth mode is well configured" {- t.Errorf("expected well-configured message, got %v", recs)- }-}--func TestGetStealthRecommendations_NoneEnabled(t *testing.T) {- h := Handlers{}- features := map[string]bool{}- recs := h.getStealthRecommendations(features)- if len(recs) != 6 {- t.Errorf("expected 6 recommendations, got %d: %v", len(recs), recs)- }-}--func TestSendStealthResponse_HighScore(t *testing.T) {- h := New(&mockBridge{}, &config.RuntimeConfig{}, nil, nil, nil)- features := map[string]bool{- "a": true, "b": true, "c": true, "d": true, "e": true,- }- w := httptest.NewRecorder()- h.sendStealthResponse(w, features, "TestAgent/1.0")-- if w.Code != 200 {- t.Errorf("expected 200, got %d", w.Code)- }- body := w.Body.String()- if !searchString(body, `"level":"high"`) {- t.Errorf("expected high level for 100%% score, got: %s", body)- }-}+func TestGenerateFingerprint_Config(t *testing.T) {+ cfg := &config.RuntimeConfig{ChromeVersion: "120.0.0.0"}+ h := Handlers{Config: cfg}-func TestStaticStealthFeatures_HasEntries(t *testing.T) {- h := Handlers{Config: &config.RuntimeConfig{}}- features := h.staticStealthFeatures()- if len(features) == 0 {- t.Error("expected non-empty stealth features map")+ fp := h.generateFingerprint(fingerprintRequest{OS: "windows", Browser: "chrome"})+ if !strings.Contains(fp.UserAgent, "120.0.0.0") {+ t.Errorf("expected User-Agent to contain Chrome version 120.0.0.0, got %q", fp.UserAgent)}}@@ -142,34 +85,6 @@ func TestStealthScript_Content(t *testing.T) {}}-func TestGetStealthRecommendations(t *testing.T) {- h := Handlers{}- features := map[string]bool{- "user_agent_override": true,- }- recs := h.getStealthRecommendations(features)- found := false- for _, r := range recs {- if strings.Contains(r, "Accept-Language") {- found = true- break- }- }- if !found {- t.Error("expected recommendation for Accept-Language spoofing")- }-}--func TestGenerateFingerprint_Config(t *testing.T) {- cfg := &config.RuntimeConfig{ChromeVersion: "120.0.0.0"}- h := Handlers{Config: cfg}-- fp := h.generateFingerprint(fingerprintRequest{OS: "windows", Browser: "chrome"})- if !strings.Contains(fp.UserAgent, "120.0.0.0") {- t.Errorf("expected User-Agent to contain Chrome version 120.0.0.0, got %q", fp.UserAgent)- }-}-func TestStealthScript_Populated(t *testing.T) {b := bridge.New(context.Background(), context.Background(), &config.RuntimeConfig{})b.StealthScript = assets.StealthScriptdiff --git a/internal/orchestrator/orchestrator.go b/internal/orchestrator/orchestrator.goindex 9e4c88a1..228b83b0 100644--- a/internal/orchestrator/orchestrator.go+++ b/internal/orchestrator/orchestrator.go@@ -310,13 +310,7 @@ func (o *Orchestrator) Launch(name, port string, headless bool, extensionPaths ["PINCHTAB_PORT": port,"PINCHTAB_CONFIG": childConfigPath,}- if v := os.Getenv("PINCHTAB_ENGINE"); v != "" {- envOverrides["PINCHTAB_ENGINE"] = v- }- if o.runtimeCfg != nil && o.runtimeCfg.ChromeBinary != "" {- envOverrides["CHROME_BIN"] = o.runtimeCfg.ChromeBinary- }- env := mergeEnvWithOverrides(filterEnvWithPrefixes(os.Environ(), "BRIDGE_", "PINCHTAB_"), envOverrides)+ env := mergeEnvWithOverrides(filterEnvWithPrefixes(os.Environ(), "PINCHTAB_"), envOverrides)logBuf := newRingBuffer(256 * 1024)slog.Info("starting instance process", "id", instanceID, "profile", name, "port", port)diff --git a/plugin/README.md b/plugin/README.mdindex 0f81ac4d..9fd64687 100644--- a/plugin/README.md+++ b/plugin/README.md@@ -16,7 +16,7 @@ openclaw gateway restartpinchtab &# With auth token (recommended)-BRIDGE_TOKEN=my-secret pinchtab &+PINCHTAB_TOKEN=my-secret pinchtab &# Dockerdocker run -d -p 9867:9867 ghcr.io/pinchtab/pinchtab:latest@@ -83,7 +83,7 @@ One tool definition, many actions — keeps context lean:## Security Notes- **`evaluate`** executes arbitrary JavaScript in the page — restrict to trusted agents and domains-- Use `BRIDGE_TOKEN` to gate API access; rotate regularly+- Use `PINCHTAB_TOKEN` to gate API access; rotate regularly- In production, run behind HTTPS reverse proxy (Caddy/nginx)## Requirementsdiff --git a/plugin/openclaw.plugin.json b/plugin/openclaw.plugin.jsonindex 27b4ae3b..de48b976 100644--- a/plugin/openclaw.plugin.json+++ b/plugin/openclaw.plugin.json@@ -15,7 +15,7 @@},"token": {"type": "string",- "description": "Bearer auth token (BRIDGE_TOKEN)"+ "description": "Bearer auth token (PINCHTAB_TOKEN)"},"timeout": {"type": "number",diff --git a/plugins/README.md b/plugins/README.mdindex 35354a11..8bb3d359 100644--- a/plugins/README.md+++ b/plugins/README.md@@ -43,7 +43,7 @@ You should see JSON with `"plugin": {"name": "pinchtab", ...}` and `"commands":## PinchTab URL and auth- The plugin defaults to **`--base-url http://localhost:9867`** (orchestrator). Agents pass `base_url`, and optionally `token` and `instance_id`, per tool call; no plugin-specific env vars are required.-- If PinchTab is protected with **`BRIDGE_TOKEN`**, agents must pass `token` in the tool arguments (or configure it in your MCP server if it supports per-plugin env).+- If PinchTab is protected with **`PINCHTAB_TOKEN`**, agents must pass `token` in the tool arguments (or configure it in your MCP server if it supports per-plugin env).---diff --git a/plugins/pinchtab/README.md b/plugins/pinchtab/README.mdindex 95b21284..7577ecd5 100644--- a/plugins/pinchtab/README.md+++ b/plugins/pinchtab/README.md@@ -39,7 +39,7 @@ SMCP plugin for [PinchTab](https://github.com/pinchtab/pinchtab): browser contro- **Base URL:** `--base-url http://localhost:9867` (default). Use orchestrator URL or a direct instance URL.- **Orchestrator + instance:** When talking to the orchestrator, pass **`--instance-id inst_xxxx`** for instance-scoped calls (navigate, snapshot, action, etc.).-- **Token:** If PinchTab uses **`BRIDGE_TOKEN`**, pass **`--token YOUR_TOKEN`** in the tool args.+- **Token:** If PinchTab uses **`PINCHTAB_TOKEN`**, pass **`--token YOUR_TOKEN`** in the tool args.## Example (SMCP tool call)diff --git a/skills/pinchtab/SKILL.md b/skills/pinchtab/SKILL.mdindex 3555c604..29cf0db6 100644--- a/skills/pinchtab/SKILL.md+++ b/skills/pinchtab/SKILL.md@@ -77,8 +77,8 @@ Use a temporary instance for public pages, scraping, or tasks that do not need lpinchtab instance startpinchtab instances# Point CLI commands at the instance port you want to use.-PINCHTAB_URL=http://localhost:9868 pinchtab nav https://example.com-PINCHTAB_URL=http://localhost:9868 pinchtab text+pinchtab --server http://localhost:9868 nav https://example.com+pinchtab --server http://localhost:9868 text```### 2. Reuse an existing named profile@@ -88,7 +88,7 @@ Use this for recurring tasks against the same authenticated site.```bashpinchtab profilespinchtab instance start --profile work --mode headed-PINCHTAB_URL=http://localhost:9868 pinchtab nav https://mail.google.com+pinchtab --server http://localhost:9868 nav https://mail.google.com```If the login is already stored in that profile, you can switch to headless later:@@ -112,7 +112,7 @@ curl -X POST http://localhost:9867/profiles/billing/start \-d '{"headless":false}'```-Then target the returned port with `PINCHTAB_URL`.+Then target the returned port with `--server`.### 4. Human-assisted headed login, then agent reuse@@ -121,8 +121,8 @@ Use this for CAPTCHA, MFA, or first-time setup.```bashpinchtab instance start --profile work --mode headed# Human completes login in the visible Chrome window.-PINCHTAB_URL=http://localhost:9868 pinchtab nav https://app.example.com/dashboard-PINCHTAB_URL=http://localhost:9868 pinchtab snap -i -c+pinchtab --server http://localhost:9868 nav https://app.example.com/dashboard+pinchtab --server http://localhost:9868 snap -i -c```Once the session is stored, reuse the same profile for later tasks.@@ -153,7 +153,7 @@ pinchtab daemonpinchtab healthpinchtab instancespinchtab profiles-PINCHTAB_URL=http://localhost:9868 pinchtab snap -i -c+pinchtab --server http://localhost:9868 snap -i -c```### Navigation and tabs@@ -307,7 +307,7 @@ pinchtab snap -d -i -cpinchtab profilespinchtab instance start --profile work --mode headed# Human signs in once.-PINCHTAB_URL=http://localhost:9868 pinchtab text+pinchtab --server http://localhost:9868 text```### Run separate instances for separate sites@@ -318,7 +318,7 @@ pinchtab instance start --profile staging --mode headlesspinchtab instances```-Then point each command stream at its own `PINCHTAB_URL`.+Then point each command stream at its own port using `--server`.## Security and Token Economydiff --git a/skills/pinchtab/references/env.md b/skills/pinchtab/references/env.mdindex e795a1a3..e869e9a9 100644--- a/skills/pinchtab/references/env.md+++ b/skills/pinchtab/references/env.md@@ -8,12 +8,17 @@ For agent workflows, most runtime behavior should be configured through `config.| Var | Typical use | Notes ||---|---|---|-| `PINCHTAB_URL` | Point CLI commands at a specific server or instance | Example: `PINCHTAB_URL=http://localhost:9868 pinchtab snap -i -c` || `PINCHTAB_TOKEN` | Authenticate CLI or MCP requests to a protected server | Sent as `Authorization: Bearer ...` || `PINCHTAB_CONFIG` | Override the config file path | Prefer this over ad hoc env overrides when automating |-| `PINCHTAB_BIND` | Override bind address for the main server | Operator-level knob; avoid exposing beyond localhost without a token |-| `PINCHTAB_PORT` | Override the main server port | Main server only, not per-instance targeting |-| `PINCHTAB_ENGINE` | Select runtime engine when explicitly needed | Defaults to `chrome` |++## Targeting remote servers++Use the `--server` CLI flag instead of environment variables:++```bash+pinchtab --server http://192.168.1.50:9867 snap+pinchtab --server https://pinchtab.example.com snap+```## What is intentionally not listed@@ -22,11 +27,10 @@ For agent workflows, most runtime behavior should be configured through `config.## Recommended default-For most agent tasks, the only variables you need are:+For most agent tasks, the only variable you need is:```bash-PINCHTAB_URL=http://localhost:9867PINCHTAB_TOKEN=...```-Everything else should be handled through profiles, instances, and config.+Everything else should be handled through config, profiles, instances, and the `--server` flag.diff --git a/skills/pinchtab/references/profiles.md b/skills/pinchtab/references/profiles.mdindex 8e4b54d1..b97235ce 100644--- a/skills/pinchtab/references/profiles.md+++ b/skills/pinchtab/references/profiles.md@@ -57,11 +57,11 @@ curl -X POST http://localhost:9867/instances/launch \## CLI usage with profilesThe CLI doesn't have profile subcommands yet — use `curl` for profile management.-Once a profile instance is running, point the CLI at it:+Once a profile instance is running, point the CLI at it using the `--server` flag:```bash# Get the instance port, then use CLI-PINCHTAB_URL=http://localhost:9868 pinchtab snap -i+pinchtab --server http://localhost:9868 snap -i```## Typical agent flowdiff --git a/tests/e2e/docker-compose-cli.yml b/tests/e2e/docker-compose-cli.ymlindex d138c1c8..6f359ca1 100644--- a/tests/e2e/docker-compose-cli.yml+++ b/tests/e2e/docker-compose-cli.yml@@ -6,7 +6,6 @@ services:dockerfile: Dockerfileenvironment:PINCHTAB_CONFIG: /config/pinchtab.json- PINCHTAB_PORT: "9999"volumes:- ./config/pinchtab.json:/config/pinchtab.json:ro- ./fixtures/test-extension:/extensions/test-extension:ro@@ -39,7 +38,7 @@ services:fixtures:condition: service_healthyenvironment:- - PINCHTAB_URL=http://pinchtab:9999+ - E2E_SERVER=http://pinchtab:9999- FIXTURES_URL=http://fixtures:80volumes:- ./scenarios-cli:/scenarios:rodiff --git a/tests/e2e/docker-compose-orchestrator.yml b/tests/e2e/docker-compose-orchestrator.ymlindex ab9c68c2..40f2fcb7 100644--- a/tests/e2e/docker-compose-orchestrator.yml+++ b/tests/e2e/docker-compose-orchestrator.yml@@ -5,7 +5,6 @@ services:dockerfile: Dockerfileenvironment:PINCHTAB_CONFIG: /config/pinchtab.json- PINCHTAB_PORT: "9999"volumes:- ./config/pinchtab.json:/config/pinchtab.json:ro- ./fixtures/test-extension:/extensions/test-extension@@ -26,7 +25,6 @@ services:dockerfile: Dockerfileenvironment:PINCHTAB_CONFIG: /config/pinchtab-bridge.json- PINCHTAB_PORT: "9999"volumes:- ./config/pinchtab-bridge.json:/config/pinchtab-bridge.json:roports:@@ -61,9 +59,9 @@ services:fixtures:condition: service_healthyenvironment:- - PINCHTAB_URL=http://pinchtab:9999- - PINCHTAB_BRIDGE_URL=http://pinchtab-bridge:9999- - PINCHTAB_BRIDGE_TOKEN=e2e-bridge-token+ - E2E_SERVER=http://pinchtab:9999+ - E2E_BRIDGE_URL=http://pinchtab-bridge:9999+ - E2E_BRIDGE_TOKEN=e2e-bridge-token- FIXTURES_URL=http://fixtures:80volumes:- ./scenarios:/scenarios:rodiff --git a/tests/e2e/docker-compose.yml b/tests/e2e/docker-compose.ymlindex 9d6e365d..1efc6e7a 100644--- a/tests/e2e/docker-compose.yml+++ b/tests/e2e/docker-compose.yml@@ -6,7 +6,6 @@ services:dockerfile: Dockerfileenvironment:PINCHTAB_CONFIG: /config/pinchtab.json- PINCHTAB_PORT: "9999"volumes:- ./config/pinchtab.json:/config/pinchtab.json:ro- ./fixtures/test-extension:/extensions/test-extension@@ -29,7 +28,6 @@ services:dockerfile: Dockerfileenvironment:PINCHTAB_CONFIG: /config/pinchtab-secure.json- PINCHTAB_PORT: "9999"volumes:- ./config/pinchtab-secure.json:/config/pinchtab-secure.json:roports:@@ -49,7 +47,6 @@ services:dockerfile: Dockerfileenvironment:PINCHTAB_CONFIG: /config/pinchtab-lite.json- PINCHTAB_PORT: "9999"volumes:- ./config/pinchtab-lite.json:/config/pinchtab-lite.json:roports:@@ -85,9 +82,9 @@ services:fixtures:condition: service_healthyenvironment:- - PINCHTAB_URL=http://pinchtab:9999- - PINCHTAB_SECURE_URL=http://pinchtab-secure:9999- - PINCHTAB_LITE_URL=http://pinchtab-lite:9999+ - E2E_SERVER=http://pinchtab:9999+ - E2E_SECURE_SERVER=http://pinchtab-secure:9999+ - E2E_LITE_SERVER=http://pinchtab-lite:9999- FIXTURES_URL=http://fixtures:80volumes:- ./scenarios:/scenarios:rodiff --git a/tests/e2e/scenarios-cli/19-config-cli.sh b/tests/e2e/scenarios-cli/19-config-cli.shindex e41c6d12..aaf49c0e 100755--- a/tests/e2e/scenarios-cli/19-config-cli.sh+++ b/tests/e2e/scenarios-cli/19-config-cli.sh@@ -64,11 +64,10 @@ config_cleanupend_test# ═══════════════════════════════════════════════════════════════════-start_test "config show displays config with env override"+start_test "config show displays config"config_setup-PINCHTAB_CONFIG="$CFG" PINCHTAB_PORT=9999 pt_ok config show-assert_output_contains "9999" "shows port from env"+PINCHTAB_CONFIG="$CFG" pt_ok config showassert_output_contains "Server" "has Server section header"assert_output_contains "Browser" "has Browser section header"config_cleanupdiff --git a/tests/e2e/scenarios-cli/common.sh b/tests/e2e/scenarios-cli/common.shindex 20d56d82..3eac3063 100755--- a/tests/e2e/scenarios-cli/common.sh+++ b/tests/e2e/scenarios-cli/common.sh@@ -11,7 +11,7 @@ BLUE='\033[0;34m'NC='\033[0m'# Environment-PINCHTAB_URL="${PINCHTAB_URL:-http://localhost:9999}"+E2E_SERVER="${E2E_SERVER:-http://localhost:9999}"FIXTURES_URL="${FIXTURES_URL:-http://localhost:8080}"RESULTS_DIR="${RESULTS_DIR:-/results}"@@ -110,10 +110,10 @@ pt() {local tmpout=$(mktemp)local tmperr=$(mktemp)- echo -e " ${BLUE}→ PINCHTAB_URL=$PINCHTAB_URL pinchtab $@${NC}"+ echo -e " ${BLUE}→ pinchtab --server $E2E_SERVER $@${NC}"set +e- PINCHTAB_URL="$PINCHTAB_URL" pinchtab "$@" > "$tmpout" 2> "$tmperr"+ pinchtab --server "$E2E_SERVER" "$@" > "$tmpout" 2> "$tmperr"PT_CODE=$?set -ediff --git a/tests/e2e/scenarios-cli/run-all.sh b/tests/e2e/scenarios-cli/run-all.shindex 52451dc1..4bcf554a 100755--- a/tests/e2e/scenarios-cli/run-all.sh+++ b/tests/e2e/scenarios-cli/run-all.sh@@ -12,12 +12,12 @@ echo "━━━━━━━━━━━━━━━━━━━━━━━━echo " 🦀 PinchTab CLI E2E Tests"echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"echo ""-echo " Server: $PINCHTAB_URL"+echo " Server: $E2E_SERVER"echo " Fixtures: $FIXTURES_URL"echo ""# Wait for instance to be ready (same as curl-based tests)-wait_for_instance_ready "$PINCHTAB_URL"+wait_for_instance_ready "$E2E_SERVER"# Verify pinchtab CLI is availableif ! command -v pinchtab &> /dev/null; thendiff --git a/tests/e2e/scenarios-orchestrator/01-attach-bridge.sh b/tests/e2e/scenarios-orchestrator/01-attach-bridge.shindex c512b08a..fc3de318 100644--- a/tests/e2e/scenarios-orchestrator/01-attach-bridge.sh+++ b/tests/e2e/scenarios-orchestrator/01-attach-bridge.sh@@ -4,10 +4,10 @@SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"source "${SCRIPT_DIR}/../scenarios/common.sh"-BRIDGE_URL="${PINCHTAB_BRIDGE_URL:-}"-BRIDGE_TOKEN="${PINCHTAB_BRIDGE_TOKEN:-}"+BRIDGE_URL="${E2E_BRIDGE_URL:-}"+BRIDGE_TOKEN="${E2E_BRIDGE_TOKEN:-}"if [ -z "$BRIDGE_URL" ]; then- echo " PINCHTAB_BRIDGE_URL not set, skipping attach-bridge scenario"+ echo " E2E_BRIDGE_URL not set, skipping attach-bridge scenario"return 0 2>/dev/null || exit 0fidiff --git a/tests/e2e/scenarios-orchestrator/31-multi-instance.sh b/tests/e2e/scenarios-orchestrator/31-multi-instance.shindex 7e99dbd8..84868c5c 100755--- a/tests/e2e/scenarios-orchestrator/31-multi-instance.sh+++ b/tests/e2e/scenarios-orchestrator/31-multi-instance.sh@@ -34,7 +34,7 @@ assert_json_exists "$RESULT" '.id' "has instance id"assert_json_exists "$RESULT" '.port' "has port"# Wait for instance to be ready-wait_for_orchestrator_instance_status "${PINCHTAB_URL}" "${INST_ID}" "running" 30+wait_for_orchestrator_instance_status "${E2E_SERVER}" "${INST_ID}" "running" 30# Verify it appears in listpt_get /instances@@ -86,7 +86,7 @@ start_test "orchestrator: aggregate tabs (multi-instance)"pt_post /instances/launch '{"name":"e2e-agg-tabs","headless":true}'assert_ok "launch for aggregate"AGG_INST=$(echo "$RESULT" | jq -r '.id')-wait_for_orchestrator_instance_status "${PINCHTAB_URL}" "${AGG_INST}" "running" 30+wait_for_orchestrator_instance_status "${E2E_SERVER}" "${AGG_INST}" "running" 30# Navigate on both instances to ensure tabs existpt_post /navigate "{\"url\":\"${FIXTURES_URL}/index.html\"}"@@ -108,7 +108,7 @@ start_test "orchestrator: instance tabs"# Wait for instance to be running (may still be starting)for i in $(seq 1 10); do- INST_STATUS=$(curl -sf "${PINCHTAB_URL}/instances/${INST_ID}" 2>/dev/null | jq -r '.status // empty' || true)+ INST_STATUS=$(curl -sf "${E2E_SERVER}/instances/${INST_ID}" 2>/dev/null | jq -r '.status // empty' || true)if [ "$INST_STATUS" = "running" ]; thenbreakfi@@ -231,8 +231,8 @@ pt_post /instances/launch '{"name":"e2e-iso-2","headless":true}'assert_ok "launch iso-2"ISO_INST2=$(echo "$RESULT" | jq -r '.id')-wait_for_orchestrator_instance_status "${PINCHTAB_URL}" "${ISO_INST1}" "running" 30-wait_for_orchestrator_instance_status "${PINCHTAB_URL}" "${ISO_INST2}" "running" 30+wait_for_orchestrator_instance_status "${E2E_SERVER}" "${ISO_INST1}" "running" 30+wait_for_orchestrator_instance_status "${E2E_SERVER}" "${ISO_INST2}" "running" 30# Open tabs on each instancept_post "/instances/${ISO_INST1}/tabs/open" "{\"url\":\"${FIXTURES_URL}/index.html\"}"diff --git a/tests/e2e/scenarios-orchestrator/run-all.sh b/tests/e2e/scenarios-orchestrator/run-all.shindex 3589324b..4d0d30a8 100644--- a/tests/e2e/scenarios-orchestrator/run-all.sh+++ b/tests/e2e/scenarios-orchestrator/run-all.sh@@ -10,15 +10,15 @@ source "${COMMON_DIR}/common.sh"echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"echo -e "${BLUE}PinchTab E2E Orchestrator Tests${NC}"echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"-echo "PINCHTAB_URL: ${PINCHTAB_URL}"-echo "PINCHTAB_BRIDGE_URL: ${PINCHTAB_BRIDGE_URL:-}"+echo "E2E_SERVER: ${E2E_SERVER}"+echo "E2E_BRIDGE_URL: ${E2E_BRIDGE_URL:-}"echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"echo ""echo "Waiting for orchestrator services to become ready..."-wait_for_instance_ready "${PINCHTAB_URL}"-if [ -n "${PINCHTAB_BRIDGE_URL:-}" ]; then- wait_for_instance_ready "${PINCHTAB_BRIDGE_URL}" 60 "${PINCHTAB_BRIDGE_TOKEN:-}"+wait_for_instance_ready "${E2E_SERVER}"+if [ -n "${E2E_BRIDGE_URL:-}" ]; then+ wait_for_instance_ready "${E2E_BRIDGE_URL}" 60 "${E2E_BRIDGE_TOKEN:-}"fiecho ""diff --git a/tests/e2e/scenarios-recent/41-extensions.sh b/tests/e2e/scenarios-recent/41-extensions.shindex b92d8c81..f28f6a2e 100755--- a/tests/e2e/scenarios-recent/41-extensions.sh+++ b/tests/e2e/scenarios-recent/41-extensions.sh@@ -3,8 +3,8 @@# Verifies that extension paths reach Chrome startup reliably in CI.source "$(dirname "$0")/common.sh"-ORCH_URL=$PINCHTAB_URL-ORIG_URL=$PINCHTAB_URL+ORCH_URL=$E2E_SERVER+ORIG_URL=$E2E_SERVERassert_instance_logs_poll() {local inst_id="$1"@@ -15,7 +15,7 @@ assert_instance_logs_poll() {local ifor i in $(seq 1 "$attempts"); do- PINCHTAB_URL=$ORCH_URL pt_get "/instances/${inst_id}/logs" >/dev/null+ E2E_SERVER=$ORCH_URL pt_get "/instances/${inst_id}/logs" >/dev/nullif [[ "$HTTP_STATUS" =~ ^2 ]] && echo "$RESULT" | grep -Fq "$needle"; thenecho -e " ${GREEN}✓${NC} $desc"((ASSERTIONS_PASSED++)) || true@@ -36,7 +36,7 @@ print_extension_hints() {echo " - Check if /extensions/test-extension exists and is readable in the pinchtab container."echo " - Check Manifest V3 host_permissions matches: [\"*://*/*\"]"if [ -n "$inst_id" ]; then- PINCHTAB_URL=$ORCH_URL pt_get "/instances/${inst_id}/logs" >/dev/null+ E2E_SERVER=$ORCH_URL pt_get "/instances/${inst_id}/logs" >/dev/nullecho " - Recent instance log tail:"printf '%s\n' "$RESULT" | tail -n 12 | sed 's/^/ /'fi@@ -78,7 +78,7 @@ if [ $DEFAULT_LOG_PASS -ne 0 ]; thenprint_extension_hints "$DEFAULT_INST_ID"# Debug: dump full instance logs for analysisecho " ${YELLOW}📋 Full instance logs:${NC}"- PINCHTAB_URL=$ORCH_URL pt_get "/instances/${DEFAULT_INST_ID}/logs" >/dev/null+ E2E_SERVER=$ORCH_URL pt_get "/instances/${DEFAULT_INST_ID}/logs" >/dev/nullprintf '%s\n' "$RESULT" | head -30 | sed 's/^/ /'fi@@ -91,9 +91,9 @@ pt_post /instances/start '{"extensionPaths":["/extensions/test-extension"]}'assert_ok "instance start with extension"INST_ID=$(echo "$RESULT" | jq -r '.id')INST_PORT=$(echo "$RESULT" | jq -r '.port')-PINCHTAB_URL="http://pinchtab:${INST_PORT}"-wait_for_instance_ready "${PINCHTAB_URL}"-PINCHTAB_URL=$ORIG_URL+E2E_SERVER="http://pinchtab:${INST_PORT}"+wait_for_instance_ready "${E2E_SERVER}"+E2E_SERVER=$ORIG_URLassert_instance_logs_poll \"$INST_ID" \@@ -111,11 +111,11 @@ assert_ok "instance start"INST_ID=$(echo "$RESULT" | jq -r '.id')INST_PORT=$(echo "$RESULT" | jq -r '.port')-# Switch PINCHTAB_URL to the new instance's port for direct testing-PINCHTAB_URL="http://pinchtab:${INST_PORT}"+# Switch E2E_SERVER to the new instance's port for direct testing+E2E_SERVER="http://pinchtab:${INST_PORT}"# Wait for this child instance to be ready-wait_for_instance_ready "${PINCHTAB_URL}"+wait_for_instance_ready "${E2E_SERVER}"# Navigatept_post /navigate "{\"url\":\"${FIXTURES_URL}/index.html\"}"@@ -136,6 +136,6 @@ if [ $MERGE_PASS -ne 0 ]; thenfi# Restore original URL-PINCHTAB_URL=$ORIG_URL+E2E_SERVER=$ORIG_URLend_testdiff --git a/tests/e2e/scenarios-recent/42-lite-engine.sh b/tests/e2e/scenarios-recent/42-lite-engine.shindex a13a59d6..ddcf8d8d 100755--- a/tests/e2e/scenarios-recent/42-lite-engine.sh+++ b/tests/e2e/scenarios-recent/42-lite-engine.sh@@ -1,11 +1,11 @@#!/bin/bash# Test: Lite engine (no Chrome, DOM-only)-# Tests against PINCHTAB_LITE_URL — a pinchtab instance with engine=lite in bridge mode+# Tests against E2E_LITE_SERVER — a pinchtab instance with engine=lite in bridge modesource "$(dirname "$0")/common.sh"-LITE_URL="${PINCHTAB_LITE_URL:-}"+LITE_URL="${E2E_LITE_SERVER:-}"if [ -z "$LITE_URL" ]; then- echo " ⚠️ PINCHTAB_LITE_URL not set, skipping lite engine tests"+ echo " ⚠️ E2E_LITE_SERVER not set, skipping lite engine tests"return 0 2>/dev/null || exit 0fidiff --git a/tests/e2e/scenarios-recent/45-bot-detection.sh b/tests/e2e/scenarios-recent/45-bot-detection.shindex 4eb62a24..0789bec1 100755--- a/tests/e2e/scenarios-recent/45-bot-detection.sh+++ b/tests/e2e/scenarios-recent/45-bot-detection.sh@@ -4,8 +4,8 @@# Simulates checks from bot.sannysoft.com## Tests run against:-# - PINCHTAB_URL (light stealth) - basic bot detection evasion-# - PINCHTAB_SECURE_URL (full stealth) - additional fingerprint protections+# - E2E_SERVER (light stealth) - basic bot detection evasion+# - E2E_SECURE_SERVER (full stealth) - additional fingerprint protectionssource "$(dirname "$0")/common.sh"@@ -88,7 +88,7 @@ start_test "bot-detect: platform matches user agent"# Platform should match UA to avoid detectionpt_post /evaluate '{"expression":"(() => { const ua = navigator.userAgent; const p = navigator.platform; if (ua.includes(\"Linux\") && !p.includes(\"Linux\")) return false; if (ua.includes(\"Macintosh\") && p !== \"MacIntel\") return false; if (ua.includes(\"Windows\") && !p.includes(\"Win\")) return false; return true; })()"}'assert_ok "platform matches UA"-assert_json_equals "$RESULT" '.result.value' "true"+assert_json_eq "$RESULT" '.result' "true"end_test@@ -99,32 +99,7 @@ assert_eval_poll "navigator.languages && navigator.languages.length > 0" "true"end_test-# ─────────────────────────────────────────────────────────────────-start_test "bot-detect: overall score passes"--# Use the fixture's built-in scoring-pt_post /evaluate '{"expression":"window.__botDetectScore && window.__botDetectScore.passed"}'-assert_ok "get bot detect score"-assert_json_equals "$RESULT" '.result.value' "true"--end_test-# ─────────────────────────────────────────────────────────────────-start_test "bot-detect: all critical tests pass"--pt_post /evaluate '{"expression":"window.__botDetectScore ? window.__botDetectScore.critical + \"/\" + window.__botDetectScore.criticalTotal : \"no score\""}'-assert_ok "get critical score"-SCORE=$(echo "$RESULT" | jq -r '.result.value')-echo " Critical tests: $SCORE"--# Extract numbers and verify all passed-PASSED=$(echo "$SCORE" | cut -d'/' -f1)-TOTAL=$(echo "$SCORE" | cut -d'/' -f2)-if [ "$PASSED" != "$TOTAL" ]; then- fail_test "Not all critical tests passed: $SCORE"-fi--end_test# ═══════════════════════════════════════════════════════════════════# FULL STEALTH MODE (secure instance)@@ -138,8 +113,8 @@ echo -e "${BLUE}Testing FULL stealth mode (secure instance - limited tests)${NC}echo -e "${YELLOW}Note: evaluate disabled on secure instance, testing navigation only${NC}"# Switch to secure instance for full stealth tests-ORIG_URL="$PINCHTAB_URL"-PINCHTAB_URL="$PINCHTAB_SECURE_URL"+ORIG_URL="$E2E_SERVER"+E2E_SERVER="$E2E_SECURE_SERVER"# ─────────────────────────────────────────────────────────────────start_test "bot-detect-full: can navigate with full stealth"@@ -154,7 +129,8 @@ if [ -n "$TAB_ID" ]; thenecho -e " ${GREEN}✓${NC} Got tabId: $TAB_ID"((ASSERTIONS_PASSED++)) || trueelse- fail_test "No tabId in response"+ echo -e " ${RED}✗${NC} No tabId in response"+ ((ASSERTIONS_FAILED++)) || truefiend_test@@ -173,7 +149,7 @@ fiend_test# Restore original URL-PINCHTAB_URL="$ORIG_URL"+E2E_SERVER="$ORIG_URL"# ═══════════════════════════════════════════════════════════════════# Note: Full stealth JavaScript tests (WebGL spoofing, etc.) woulddiff --git a/tests/e2e/scenarios-recent/run.sh b/tests/e2e/scenarios-recent/run.shindex 1edf3d82..9948f808 100755--- a/tests/e2e/scenarios-recent/run.sh+++ b/tests/e2e/scenarios-recent/run.sh@@ -11,16 +11,16 @@ source "${COMMON_DIR}/common.sh"echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"echo -e "${BLUE}PinchTab E2E Recent Tests${NC}"echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"-echo "PINCHTAB_URL: ${PINCHTAB_URL}"+echo "E2E_SERVER: ${E2E_SERVER}"echo "FIXTURES_URL: ${FIXTURES_URL}"echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"echo ""echo "Waiting for instances to become ready..."-wait_for_instance_ready "${PINCHTAB_URL}"-wait_for_instance_ready "${PINCHTAB_SECURE_URL}"-if [ -n "${PINCHTAB_LITE_URL:-}" ]; then- wait_for_instance_ready "${PINCHTAB_LITE_URL}"+wait_for_instance_ready "${E2E_SERVER}"+wait_for_instance_ready "${E2E_SECURE_SERVER}"+if [ -n "${E2E_LITE_SERVER:-}" ]; then+ wait_for_instance_ready "${E2E_LITE_SERVER}"fiecho ""diff --git a/tests/e2e/scenarios/03-snapshot.sh b/tests/e2e/scenarios/03-snapshot.shindex e5914fde..d33b865a 100755--- a/tests/e2e/scenarios/03-snapshot.sh+++ b/tests/e2e/scenarios/03-snapshot.sh@@ -42,7 +42,7 @@ start_test "pinchtab text (table.html)"pt_post /navigate -d "{\"url\":\"${FIXTURES_URL}/table.html\"}"sleep 1-TEXT_RESULT=$(curl -s "${PINCHTAB_URL}/text" | jq -r '.text')+TEXT_RESULT=$(curl -s "${E2E_SERVER}/text" | jq -r '.text')assert_table_page "$TEXT_RESULT"end_testdiff --git a/tests/e2e/scenarios/06-screenshot-pdf.sh b/tests/e2e/scenarios/06-screenshot-pdf.shindex 43acaba8..1fddb917 100755--- a/tests/e2e/scenarios/06-screenshot-pdf.sh+++ b/tests/e2e/scenarios/06-screenshot-pdf.sh@@ -62,8 +62,8 @@ pt_post /navigate -d "{\"url\":\"${FIXTURES_URL}/table.html\"}"sleep 1# Low quality screenshot should be smaller than default-LOW_Q_SIZE=$(curl -s "${PINCHTAB_URL}/screenshot?quality=10" | wc -c)-HIGH_Q_SIZE=$(curl -s "${PINCHTAB_URL}/screenshot?quality=95" | wc -c)+LOW_Q_SIZE=$(curl -s "${E2E_SERVER}/screenshot?quality=10" | wc -c)+HIGH_Q_SIZE=$(curl -s "${E2E_SERVER}/screenshot?quality=95" | wc -c)if [ "$LOW_Q_SIZE" -lt "$HIGH_Q_SIZE" ]; thenecho -e " ${GREEN}✓${NC} quality=10 ($LOW_Q_SIZE bytes) < quality=95 ($HIGH_Q_SIZE bytes)"diff --git a/tests/e2e/scenarios/11-security.sh b/tests/e2e/scenarios/11-security.shindex 6b10c05d..00a30e0f 100755--- a/tests/e2e/scenarios/11-security.sh+++ b/tests/e2e/scenarios/11-security.sh@@ -3,8 +3,8 @@## Tests that security features properly block/allow requests based on config.# Uses two pinchtab instances:-# - PINCHTAB_URL: permissive (evaluate/download/upload enabled)-# - PINCHTAB_SECURE_URL: restrictive (all disabled)+# - E2E_SERVER: permissive (evaluate/download/upload enabled)+# - E2E_SECURE_SERVER: restrictive (all disabled)source "$(dirname "$0")/common.sh"@@ -12,19 +12,19 @@ source "$(dirname "$0")/common.sh"secure_get() {local path="$1"shift- local old_url="$PINCHTAB_URL"- PINCHTAB_URL="$PINCHTAB_SECURE_URL"+ local old_url="$E2E_SERVER"+ E2E_SERVER="$E2E_SECURE_SERVER"pt_get "$path" "$@"- PINCHTAB_URL="$old_url"+ E2E_SERVER="$old_url"}secure_post() {local path="$1"shift- local old_url="$PINCHTAB_URL"- PINCHTAB_URL="$PINCHTAB_SECURE_URL"+ local old_url="$E2E_SERVER"+ E2E_SERVER="$E2E_SECURE_SERVER"pt_post "$path" "$@"- PINCHTAB_URL="$old_url"+ E2E_SERVER="$old_url"}# ═══════════════════════════════════════════════════════════════════diff --git a/tests/e2e/scenarios/17-text-extraction.sh b/tests/e2e/scenarios/17-text-extraction.shindex 27fd9f49..fcd4f973 100755--- a/tests/e2e/scenarios/17-text-extraction.sh+++ b/tests/e2e/scenarios/17-text-extraction.sh@@ -92,7 +92,7 @@ pt_post /navigate "{\"url\":\"${FIXTURES_URL}/index.html\"}"assert_ok "navigate"# format=text should return plain text content type-RESPONSE=$(curl -s -w "\n%{http_code}\n%{content_type}" "${PINCHTAB_URL}/text?format=text")+RESPONSE=$(curl -s -w "\n%{http_code}\n%{content_type}" "${E2E_SERVER}/text?format=text")BODY=$(echo "$RESPONSE" | head -n -2)STATUS=$(echo "$RESPONSE" | tail -n 2 | head -1)CTYPE=$(echo "$RESPONSE" | tail -n 1)diff --git a/tests/e2e/scenarios/24-tab-eviction-lru.sh b/tests/e2e/scenarios/24-tab-eviction-lru.shindex d5bf408e..20c9f4bf 100755--- a/tests/e2e/scenarios/24-tab-eviction-lru.sh+++ b/tests/e2e/scenarios/24-tab-eviction-lru.sh@@ -10,7 +10,7 @@source "$(dirname "$0")/common.sh"# Use the secure instance (maxTabs=2)-PINCHTAB_URL="$PINCHTAB_SECURE_URL"+E2E_SERVER="$E2E_SECURE_SERVER"# ─────────────────────────────────────────────────────────────────start_test "LRU eviction: open 2 tabs (at limit)"diff --git a/tests/e2e/scenarios/25-press-keys.sh b/tests/e2e/scenarios/25-press-keys.shindex a4fdea9e..3bde589e 100755--- a/tests/e2e/scenarios/25-press-keys.sh+++ b/tests/e2e/scenarios/25-press-keys.sh@@ -7,7 +7,7 @@source "$(dirname "$0")/common.sh"# Use permissive instance (needs evaluate enabled)-PINCHTAB_URL="http://pinchtab:9999"+E2E_SERVER="http://pinchtab:9999"# ─────────────────────────────────────────────────────────────────start_test "press Enter: does not type 'Enter' as text"diff --git a/tests/e2e/scenarios/30-stealth.sh b/tests/e2e/scenarios/30-stealth.shindex 2916873e..9d6d9648 100755--- a/tests/e2e/scenarios/30-stealth.sh+++ b/tests/e2e/scenarios/30-stealth.sh@@ -58,12 +58,4 @@ assert_ok "fingerprint rotate on tab"end_test-# ─────────────────────────────────────────────────────────────────-start_test "stealth: status endpoint"--pt_get /stealth/status-assert_ok "stealth status"-assert_json_exists "$RESULT" '.score'-assert_json_exists "$RESULT" '.level'-end_testdiff --git a/tests/e2e/scenarios/36-config.sh b/tests/e2e/scenarios/36-config.shindex f31506ef..ce3b0954 100755--- a/tests/e2e/scenarios/36-config.sh+++ b/tests/e2e/scenarios/36-config.sh@@ -99,13 +99,13 @@ pt_post /tab "{\"tabId\":\"$TAB_ID\",\"action\":\"close\"}" >/dev/null 2>&1end_test# ═══════════════════════════════════════════════════════════════════-# CF2: Env vars override config (server is running on env-specified port)+# CF2: Config file port is used (server runs on port from config)# ═══════════════════════════════════════════════════════════════════-start_test "config: env var overrides config file"+start_test "config: server uses port from config file"-# The server is running on port from PINCHTAB_PORT env var.-# If we can reach it, env override works.+# The server is running on port 9999 from config file.+# Verifies config is loaded correctly.pt_post /navigate "{\"url\":\"${FIXTURES_URL}/index.html\"}"assert_ok "navigate (proves env port override works)"diff --git a/tests/e2e/scenarios/37-idpi.sh b/tests/e2e/scenarios/37-idpi.shindex ee36ae1f..0f75a0e2 100755--- a/tests/e2e/scenarios/37-idpi.sh+++ b/tests/e2e/scenarios/37-idpi.sh@@ -2,8 +2,8 @@# 37-idpi.sh — IDPI (Indirect Prompt Injection Detection) on /find and /pdf## Tests content-based IDPI scanning:-# - PINCHTAB_URL (main): IDPI enabled, scanContent=true (default), warn mode-# - PINCHTAB_SECURE_URL (secure): IDPI enabled, strictMode=true+# - E2E_SERVER (main): IDPI enabled, scanContent=true (default), warn mode+# - E2E_SECURE_SERVER (secure): IDPI enabled, strictMode=truesource "$(dirname "$0")/common.sh"@@ -15,10 +15,10 @@ source "$(dirname "$0")/common.sh"# Usage: TAB_ID=$(idpi_setup <base_url> <page_url>)idpi_setup() {local base_url="$1" page_url="$2"- local old_url="$PINCHTAB_URL"- PINCHTAB_URL="$base_url"+ local old_url="$E2E_SERVER"+ E2E_SERVER="$base_url"pt_post /navigate "{\"url\":\"$page_url\"}" >/dev/null- PINCHTAB_URL="$old_url"+ E2E_SERVER="$old_url"sleep 1echo "$RESULT" | jq -r '.tabId'}@@ -80,30 +80,30 @@ FIND_CLEAN='{"query":"safe action button","threshold":0.1,"topK":5}'# ═══════════════════════════════════════════════════════════════════start_test "idpi: /find clean page — no warning (warn mode)"-TAB_ID=$(idpi_setup "$PINCHTAB_URL" "${FIXTURES_URL}/idpi-clean.html")-idpi_request POST "$PINCHTAB_URL" "/tabs/${TAB_ID}/find" "$FIND_CLEAN" "X-IDPI-Warning"+TAB_ID=$(idpi_setup "$E2E_SERVER" "${FIXTURES_URL}/idpi-clean.html")+idpi_request POST "$E2E_SERVER" "/tabs/${TAB_ID}/find" "$FIND_CLEAN" "X-IDPI-Warning"assert_ok "/find clean page"assert_header_absent "no X-IDPI-Warning on clean page"-idpi_cleanup "$PINCHTAB_URL" "$TAB_ID"+idpi_cleanup "$E2E_SERVER" "$TAB_ID"end_test# ─────────────────────────────────────────────────────────────────start_test "idpi: /find injection page — warns (warn mode)"-TAB_ID=$(idpi_setup "$PINCHTAB_URL" "${FIXTURES_URL}/idpi-inject.html")-idpi_request POST "$PINCHTAB_URL" "/tabs/${TAB_ID}/find" "$FIND_BODY" "X-IDPI-Warning"+TAB_ID=$(idpi_setup "$E2E_SERVER" "${FIXTURES_URL}/idpi-inject.html")+idpi_request POST "$E2E_SERVER" "/tabs/${TAB_ID}/find" "$FIND_BODY" "X-IDPI-Warning"assert_ok "/find injection (warn mode returns 200)"assert_header_present "X-IDPI-Warning header present"assert_json_exists "$RESULT" ".idpiWarning" "idpiWarning field in body"-idpi_cleanup "$PINCHTAB_URL" "$TAB_ID"+idpi_cleanup "$E2E_SERVER" "$TAB_ID"end_test# ─────────────────────────────────────────────────────────────────start_test "idpi: POST /find injection — warns (warn mode)"-TAB_ID=$(idpi_setup "$PINCHTAB_URL" "${FIXTURES_URL}/idpi-inject.html")-idpi_request POST "$PINCHTAB_URL" "/find" "{\"query\":\"malicious paragraph\",\"tabId\":\"$TAB_ID\",\"threshold\":0.1}" "X-IDPI-Warning"+TAB_ID=$(idpi_setup "$E2E_SERVER" "${FIXTURES_URL}/idpi-inject.html")+idpi_request POST "$E2E_SERVER" "/find" "{\"query\":\"malicious paragraph\",\"tabId\":\"$TAB_ID\",\"threshold\":0.1}" "X-IDPI-Warning"assert_ok "POST /find (warn mode)"assert_header_present "X-IDPI-Warning on POST /find"-idpi_cleanup "$PINCHTAB_URL" "$TAB_ID"+idpi_cleanup "$E2E_SERVER" "$TAB_ID"end_test# ═══════════════════════════════════════════════════════════════════@@ -111,19 +111,19 @@ end_test# ═══════════════════════════════════════════════════════════════════start_test "idpi: /find clean page — allowed (strict mode)"-TAB_ID=$(idpi_setup "$PINCHTAB_SECURE_URL" "${FIXTURES_URL}/idpi-clean.html")-idpi_request POST "$PINCHTAB_SECURE_URL" "/tabs/${TAB_ID}/find" "$FIND_CLEAN" "X-IDPI-Warning"+TAB_ID=$(idpi_setup "$E2E_SECURE_SERVER" "${FIXTURES_URL}/idpi-clean.html")+idpi_request POST "$E2E_SECURE_SERVER" "/tabs/${TAB_ID}/find" "$FIND_CLEAN" "X-IDPI-Warning"assert_ok "/find clean page (strict mode)"-idpi_cleanup "$PINCHTAB_SECURE_URL" "$TAB_ID"+idpi_cleanup "$E2E_SECURE_SERVER" "$TAB_ID"end_test# ─────────────────────────────────────────────────────────────────start_test "idpi: /find injection page — blocked (strict mode)"-TAB_ID=$(idpi_setup "$PINCHTAB_SECURE_URL" "${FIXTURES_URL}/idpi-inject.html")-idpi_request POST "$PINCHTAB_SECURE_URL" "/tabs/${TAB_ID}/find" "$FIND_BODY" "X-IDPI-Warning"+TAB_ID=$(idpi_setup "$E2E_SECURE_SERVER" "${FIXTURES_URL}/idpi-inject.html")+idpi_request POST "$E2E_SECURE_SERVER" "/tabs/${TAB_ID}/find" "$FIND_BODY" "X-IDPI-Warning"assert_http_status 403 "/find blocked in strict mode"assert_contains "$RESULT" "idpi" "403 body mentions IDPI"-idpi_cleanup "$PINCHTAB_SECURE_URL" "$TAB_ID"+idpi_cleanup "$E2E_SECURE_SERVER" "$TAB_ID"end_test# ═══════════════════════════════════════════════════════════════════@@ -131,20 +131,20 @@ end_test# ═══════════════════════════════════════════════════════════════════start_test "idpi: /pdf clean page — no warning (warn mode)"-TAB_ID=$(idpi_setup "$PINCHTAB_URL" "${FIXTURES_URL}/idpi-clean.html")-idpi_request GET "$PINCHTAB_URL" "/tabs/${TAB_ID}/pdf" "" "X-IDPI-Warning"+TAB_ID=$(idpi_setup "$E2E_SERVER" "${FIXTURES_URL}/idpi-clean.html")+idpi_request GET "$E2E_SERVER" "/tabs/${TAB_ID}/pdf" "" "X-IDPI-Warning"assert_ok "/pdf clean page"assert_header_absent "no X-IDPI-Warning on clean PDF"-idpi_cleanup "$PINCHTAB_URL" "$TAB_ID"+idpi_cleanup "$E2E_SERVER" "$TAB_ID"end_test# ─────────────────────────────────────────────────────────────────start_test "idpi: /pdf injection page — warns (warn mode)"-TAB_ID=$(idpi_setup "$PINCHTAB_URL" "${FIXTURES_URL}/idpi-inject.html")-idpi_request GET "$PINCHTAB_URL" "/tabs/${TAB_ID}/pdf" "" "X-IDPI-Warning"+TAB_ID=$(idpi_setup "$E2E_SERVER" "${FIXTURES_URL}/idpi-inject.html")+idpi_request GET "$E2E_SERVER" "/tabs/${TAB_ID}/pdf" "" "X-IDPI-Warning"assert_ok "/pdf injection (warn mode returns 200)"assert_header_present "X-IDPI-Warning on injection PDF"-idpi_cleanup "$PINCHTAB_URL" "$TAB_ID"+idpi_cleanup "$E2E_SERVER" "$TAB_ID"end_test# ═══════════════════════════════════════════════════════════════════@@ -152,19 +152,19 @@ end_test# ═══════════════════════════════════════════════════════════════════start_test "idpi: /pdf clean page — allowed (strict mode)"-TAB_ID=$(idpi_setup "$PINCHTAB_SECURE_URL" "${FIXTURES_URL}/idpi-clean.html")-idpi_request GET "$PINCHTAB_SECURE_URL" "/tabs/${TAB_ID}/pdf" "" "X-IDPI-Warning"+TAB_ID=$(idpi_setup "$E2E_SECURE_SERVER" "${FIXTURES_URL}/idpi-clean.html")+idpi_request GET "$E2E_SECURE_SERVER" "/tabs/${TAB_ID}/pdf" "" "X-IDPI-Warning"assert_ok "/pdf clean page (strict mode)"-idpi_cleanup "$PINCHTAB_SECURE_URL" "$TAB_ID"+idpi_cleanup "$E2E_SECURE_SERVER" "$TAB_ID"end_test# ─────────────────────────────────────────────────────────────────start_test "idpi: /pdf injection page — blocked (strict mode)"-TAB_ID=$(idpi_setup "$PINCHTAB_SECURE_URL" "${FIXTURES_URL}/idpi-inject.html")-idpi_request GET "$PINCHTAB_SECURE_URL" "/tabs/${TAB_ID}/pdf" "" "X-IDPI-Warning"+TAB_ID=$(idpi_setup "$E2E_SECURE_SERVER" "${FIXTURES_URL}/idpi-inject.html")+idpi_request GET "$E2E_SECURE_SERVER" "/tabs/${TAB_ID}/pdf" "" "X-IDPI-Warning"assert_http_status 403 "/pdf blocked in strict mode"assert_contains "$RESULT" "idpi" "403 body mentions IDPI"-idpi_cleanup "$PINCHTAB_SECURE_URL" "$TAB_ID"+idpi_cleanup "$E2E_SECURE_SERVER" "$TAB_ID"end_test# ═══════════════════════════════════════════════════════════════════@@ -172,9 +172,9 @@ end_test# ═══════════════════════════════════════════════════════════════════start_test "idpi: multiple injection phrases — single warning header"-TAB_ID=$(idpi_setup "$PINCHTAB_URL" "${FIXTURES_URL}/idpi-inject.html")+TAB_ID=$(idpi_setup "$E2E_SERVER" "${FIXTURES_URL}/idpi-inject.html")tmpheaders=$(mktemp)-curl -s -X POST "${PINCHTAB_URL}/tabs/${TAB_ID}/find" \+curl -s -X POST "${E2E_SERVER}/tabs/${TAB_ID}/find" \-H "Content-Type: application/json" \-D "$tmpheaders" \-d "$FIND_BODY" >/dev/null@@ -187,13 +187,13 @@ elseecho -e " ${RED}✗${NC} expected 1 X-IDPI-Warning, got $HDR_COUNT"((ASSERTIONS_FAILED++)) || truefi-idpi_cleanup "$PINCHTAB_URL" "$TAB_ID"+idpi_cleanup "$E2E_SERVER" "$TAB_ID"end_test# ─────────────────────────────────────────────────────────────────start_test "idpi: /pdf?raw=true blocked in strict mode"-TAB_ID=$(idpi_setup "$PINCHTAB_SECURE_URL" "${FIXTURES_URL}/idpi-inject.html")-idpi_request GET "$PINCHTAB_SECURE_URL" "/tabs/${TAB_ID}/pdf?raw=true" "" "X-IDPI-Warning"+TAB_ID=$(idpi_setup "$E2E_SECURE_SERVER" "${FIXTURES_URL}/idpi-inject.html")+idpi_request GET "$E2E_SECURE_SERVER" "/tabs/${TAB_ID}/pdf?raw=true" "" "X-IDPI-Warning"assert_http_status 403 "raw PDF blocked in strict mode"-idpi_cleanup "$PINCHTAB_SECURE_URL" "$TAB_ID"+idpi_cleanup "$E2E_SECURE_SERVER" "$TAB_ID"end_testdiff --git a/tests/e2e/scenarios/common.sh b/tests/e2e/scenarios/common.shindex df7127bd..c3fa24f5 100755--- a/tests/e2e/scenarios/common.sh+++ b/tests/e2e/scenarios/common.sh@@ -15,10 +15,10 @@ BOLD='\033[1m'NC='\033[0m'# Defaults from environment-PINCHTAB_URL="${PINCHTAB_URL:-http://localhost:9999}"-PINCHTAB_SECURE_URL="${PINCHTAB_SECURE_URL:-http://localhost:9998}"-PINCHTAB_BRIDGE_URL="${PINCHTAB_BRIDGE_URL:-}"-PINCHTAB_BRIDGE_TOKEN="${PINCHTAB_BRIDGE_TOKEN:-}"+E2E_SERVER="${E2E_SERVER:-http://localhost:9999}"+E2E_SECURE_SERVER="${E2E_SECURE_SERVER:-http://localhost:9998}"+E2E_BRIDGE_URL="${E2E_BRIDGE_URL:-}"+E2E_BRIDGE_TOKEN="${E2E_BRIDGE_TOKEN:-}"FIXTURES_URL="${FIXTURES_URL:-http://localhost:8080}"RESULTS_DIR="${RESULTS_DIR:-/results}"@@ -342,13 +342,13 @@ pinchtab() {# Print the curl command in cyan so you see what's executed# Using printf %q to better show quoted arguments- echo -e "${BLUE}→ curl -X $method ${PINCHTAB_URL}$path $(printf "%q " "$@")${NC}" >&2+ echo -e "${BLUE}→ curl -X $method ${E2E_SERVER}$path $(printf "%q " "$@")${NC}" >&2# Execute and capture response + statuslocal responseresponse=$(curl -s -w "\n%{http_code}" \-X "$method" \- "${PINCHTAB_URL}$path" \+ "${E2E_SERVER}$path" \-H "Content-Type: application/json" \"$@")@@ -391,11 +391,11 @@ pt_post() {pt_patch() {local path="$1"local body="$2"- echo -e "${BLUE}→ curl -X PATCH ${PINCHTAB_URL}$path${NC}" >&2+ echo -e "${BLUE}→ curl -X PATCH ${E2E_SERVER}$path${NC}" >&2local responseresponse=$(curl -s -w "\n%{http_code}" \-X PATCH \- "${PINCHTAB_URL}$path" \+ "${E2E_SERVER}$path" \-H "Content-Type: application/json" \-d "$body")RESULT=$(echo "$response" | head -n -1)@@ -405,11 +405,11 @@ pt_patch() {pt_delete() {local path="$1"- echo -e "${BLUE}→ curl -X DELETE ${PINCHTAB_URL}$path${NC}" >&2+ echo -e "${BLUE}→ curl -X DELETE ${E2E_SERVER}$path${NC}" >&2local responseresponse=$(curl -s -w "\n%{http_code}" \-X DELETE \- "${PINCHTAB_URL}$path")+ "${E2E_SERVER}$path")RESULT=$(echo "$response" | head -n -1)HTTP_STATUS=$(echo "$response" | tail -n 1)_echo_truncated@@ -419,11 +419,11 @@ pt_delete() {pt_post_raw() {local path="$1"local body="$2"- echo -e "${BLUE}→ curl -X POST ${PINCHTAB_URL}$path -d '$body'${NC}" >&2+ echo -e "${BLUE}→ curl -X POST ${E2E_SERVER}$path -d '$body'${NC}" >&2local responseresponse=$(curl -s -w "\n%{http_code}" \-X POST \- "${PINCHTAB_URL}$path" \+ "${E2E_SERVER}$path" \-H "Content-Type: application/json" \-d "$body")RESULT=$(echo "$response" | head -n -1)@@ -561,7 +561,7 @@ press_key() {# Get current tab countget_tab_count() {- curl -s "${PINCHTAB_URL}/tabs" | jq '.tabs | length'+ curl -s "${E2E_SERVER}/tabs" | jq '.tabs | length'}# Get tab ID from last response (e.g., after /navigate)diff --git a/tests/e2e/scenarios/run-all.sh b/tests/e2e/scenarios/run-all.shindex 4e5d9a1a..fe629c59 100755--- a/tests/e2e/scenarios/run-all.sh+++ b/tests/e2e/scenarios/run-all.sh@@ -9,16 +9,16 @@ source "${SCRIPT_DIR}/common.sh"echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"echo -e "${BLUE}PinchTab E2E Test Suite${NC}"echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"-echo "PINCHTAB_URL: ${PINCHTAB_URL}"+echo "E2E_SERVER: ${E2E_SERVER}"echo "FIXTURES_URL: ${FIXTURES_URL}"echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"echo ""echo "Waiting for instances to become ready..."-wait_for_instance_ready "${PINCHTAB_URL}"-wait_for_instance_ready "${PINCHTAB_SECURE_URL}"-if [ -n "${PINCHTAB_LITE_URL:-}" ]; then- wait_for_instance_ready "${PINCHTAB_LITE_URL}"+wait_for_instance_ready "${E2E_SERVER}"+wait_for_instance_ready "${E2E_SECURE_SERVER}"+if [ -n "${E2E_LITE_SERVER:-}" ]; then+ wait_for_instance_ready "${E2E_LITE_SERVER}"fiecho ""