High-performance browser automation bridge and multi-instance orchestrator with advanced stealth injection and real-time dashboard.
handlers: audit log evaluate endpoint execution
Roopeshed89820ecd84
diff --git a/docs/references/configuration.md b/docs/references/configuration.mdindex 4fdd1fca..17beb3cb 100644--- a/docs/references/configuration.md+++ b/docs/references/configuration.md@@ -38,7 +38,7 @@ Complete reference for all PinchTab environment variables and configuration opti| Variable | Default | Description ||---|---|---|| `BRIDGE_TOKEN` | Disabled | API authentication token (if set, all requests must include `Authorization: Bearer {token}`) |-| `BRIDGE_ALLOW_EVALUATE` | `false` | Enable `POST /evaluate` and `POST /tabs/{id}/evaluate` endpoints (disabled by default) |+| `PINCHTAB_ALLOW_EVALUATE` | `false` | Enable `POST /evaluate` and `POST /tabs/{id}/evaluate` endpoints (disabled by default) |### Debugging & Logging@@ -121,9 +121,9 @@ curl -H "Authorization: Bearer my-secret-token" http://localhost:9867/health### Enable JavaScript Evaluate Endpoint (Opt-in)```bash-BRIDGE_TOKEN=my-secret-token \-BRIDGE_ALLOW_EVALUATE=true \-./pinchtab+PINCHTAB_TOKEN=my-secret-token \+PINCHTAB_ALLOW_EVALUATE=true \+pinchtab```By default, evaluate endpoints are not registered.diff --git a/internal/handlers/evaluate.go b/internal/handlers/evaluate.goindex 9803586a..968f61c0 100644--- a/internal/handlers/evaluate.go+++ b/internal/handlers/evaluate.go@@ -7,6 +7,7 @@ import ("errors""fmt""io"+ "log/slog""net/http""github.com/chromedp/chromedp"@@ -49,6 +50,12 @@ func (h *Handlers) HandleEvaluate(w http.ResponseWriter, r *http.Request) {defer tCancel()go web.CancelOnClientDone(r.Context(), tCancel)+ slog.Warn("evaluate",+ "tabId", req.TabID,+ "expressionLength", len(req.Expression),+ "remoteAddr", r.RemoteAddr,+ )+var result anyif err := chromedp.Run(tCtx, chromedp.Evaluate(req.Expression, &result)); err != nil {web.Error(w, 500, fmt.Errorf("evaluate: %w", err))