Skip to content

High-performance browser automation bridge and multi-instance orchestrator with advanced stealth injection and real-time dashboard.

fix: gate cookie read/write and fix metadata

Luigi Agostid6ce61e4ea21
diff --git a/cmd/pinchtab/cmd_security_test.go b/cmd/pinchtab/cmd_security_test.go
index cf555b66..fa0b9385 100644
--- a/cmd/pinchtab/cmd_security_test.go
+++ b/cmd/pinchtab/cmd_security_test.go
@@ -147,6 +147,7 @@ func testRuntimeConfig() *config.RuntimeConfig {
AllowMacro: false,
AllowScreencast: false,
AllowDownload: false,
+ AllowCookies: false,
AllowUpload: false,
AttachEnabled: false,
AttachAllowHosts: []string{"127.0.0.1", "localhost", "::1"},
diff --git a/cmd/pinchtab/cmd_server.go b/cmd/pinchtab/cmd_server.go
index da142a5f..bd94ec81 100644
--- a/cmd/pinchtab/cmd_server.go
+++ b/cmd/pinchtab/cmd_server.go
@@ -68,7 +68,7 @@ func init() {
serverCmd.GroupID = "primary"
serverCmd.Flags().StringArrayP("extension", "e", nil, "Load browser extension (repeatable)")
serverCmd.Flags().BoolP("headed", "H", false, "Start default instance in headed mode")
- serverCmd.Flags().BoolP("yolo", "y", false, "Apply guards down preset (enables evaluate, macro, download)")
+ serverCmd.Flags().BoolP("yolo", "y", false, "Apply guards down preset (enables evaluate, macro, download, cookies)")
serverCmd.Flags().BoolP("verbose", "v", false, "Show full startup banner and logs")
serverCmd.Flags().BoolP("background", "b", false, "Spawn the server detached and return JSON with pid/url/token")
serverCmd.Flags().String("background-child", "", "Internal marker for background server ownership")
diff --git a/cmd/pinchtab/cmd_wizard.go b/cmd/pinchtab/cmd_wizard.go
index 658ef5d9..6b356099 100644
--- a/cmd/pinchtab/cmd_wizard.go
+++ b/cmd/pinchtab/cmd_wizard.go
@@ -158,6 +158,7 @@ func applyGuardUp(cfg *config.FileConfig) {
f := false
cfg.Security.AllowEvaluate = &f
cfg.Security.AllowDownload = &f
+ cfg.Security.AllowCookies = &f
cfg.Security.AllowUpload = &f
cfg.Security.AllowMacro = &f
cfg.Security.AllowScreencast = &f
@@ -173,6 +174,7 @@ func applyGuardDown(cfg *config.FileConfig) {
t := true
cfg.Security.AllowEvaluate = &t
cfg.Security.AllowDownload = &t
+ cfg.Security.AllowCookies = &t
cfg.Security.AllowUpload = &t
cfg.Security.AllowMacro = &t
cfg.Security.AllowScreencast = &t
diff --git a/dashboard/src/pages/SettingsPage.tsx b/dashboard/src/pages/SettingsPage.tsx
index 055d9877..e213d925 100644
--- a/dashboard/src/pages/SettingsPage.tsx
+++ b/dashboard/src/pages/SettingsPage.tsx
@@ -212,6 +212,7 @@ export default function SettingsPage() {
backendConfig.security.allowMacro,
backendConfig.security.allowScreencast,
backendConfig.security.allowDownload,
+ backendConfig.security.allowCookies,
backendConfig.security.allowUpload,
].some(Boolean)
: false;
diff --git a/dashboard/src/pages/settings/settingsShared.ts b/dashboard/src/pages/settings/settingsShared.ts
index 2b6e3a82..84089d2b 100644
--- a/dashboard/src/pages/settings/settingsShared.ts
+++ b/dashboard/src/pages/settings/settingsShared.ts
@@ -102,6 +102,7 @@ export const securityEndpointRows = [
["allowMacro", "Allow macro"],
["allowScreencast", "Allow screencast"],
["allowDownload", "Allow download"],
+ ["allowCookies", "Allow cookies"],
["allowUpload", "Allow upload"],
[
"allowNetworkIntercept",
diff --git a/dashboard/src/types/index.ts b/dashboard/src/types/index.ts
index dfe0aa01..5a0950d2 100644
--- a/dashboard/src/types/index.ts
+++ b/dashboard/src/types/index.ts
@@ -132,6 +132,7 @@ export interface BackendSecurityConfig {
allowMacro: boolean;
allowScreencast: boolean;
allowDownload: boolean;
+ allowCookies: boolean;
allowUpload: boolean;
allowNetworkIntercept: boolean;
allowedDomains: string[];
@@ -261,6 +262,7 @@ export const defaultBackendConfig: BackendConfig = {
allowMacro: false,
allowScreencast: false,
allowDownload: false,
+ allowCookies: false,
allowUpload: false,
allowNetworkIntercept: false,
allowedDomains: ["127.0.0.1", "localhost", "::1"],
diff --git a/dev b/dev
index cd1726bd..b06f44bb 100755
--- a/dev
+++ b/dev
@@ -49,6 +49,7 @@ COMMANDS=(
"doctor:🩺:Setup dev environment"
"install:πŸ“¦:Build & install to ~/.local/bin (override with PINCHTAB_INSTALL_DIR)"
" skills:πŸ“¦:Symlink ./skills/* into ~/.claude/skills (override with CLAUDE_SKILLS_DIR)"
+ "pack plugin:🎁:Build a ClawHub-ready plugin tarball (optionally pass <version>)"
"check go:πŸ§ͺ:Go only"
"check dashboard:πŸ§ͺ:Dashboard only"
"check npm:πŸ§ͺ:npm package only"
@@ -287,6 +288,8 @@ run_command() {
"build") exec bash scripts/build.sh ;;
"install") exec bash scripts/install.sh ;;
"install skills") exec bash scripts/install-skills.sh ;;
+ "pack plugin") exec bash scripts/pack-plugin.sh ;;
+ "pack plugin "*) exec bash scripts/pack-plugin.sh "${target#pack plugin }" ;;
"binary") exec bash scripts/binary.sh ;;
"binary all"|"binaries") exec bash scripts/binary.sh all ;;
"all")
@@ -405,6 +408,19 @@ if [ $# -gt 0 ]; then
run_command "install"
fi
;;
+ pack)
+ if [ "${2:-}" = "plugin" ]; then
+ if [ $# -gt 2 ]; then
+ run_command "pack plugin $3"
+ else
+ run_command "pack plugin"
+ fi
+ else
+ echo " ${ERROR}Unknown pack target: ${2:-}${NC}" >&2
+ echo " Usage: dev pack plugin [<version>]" >&2
+ exit 1
+ fi
+ ;;
test)
if [ $# -gt 1 ]; then
run_command "test $2"
diff --git a/docs/endpoints.md b/docs/endpoints.md
index e4941d00..bfc7cd15 100644
--- a/docs/endpoints.md
+++ b/docs/endpoints.md
@@ -304,6 +304,7 @@ GET /cache/status
Notes:
- download and upload endpoints are gated by `security.allowDownload` and `security.allowUpload`
+- cookie read/write endpoints (`GET/POST /cookies`, plus tab-scoped variants) are gated by `security.allowCookies`; cookie clearing remains available so operators can remove session state
- download automatically decompresses `.gz` files and returns the decompressed content
- `security.downloadAllowedDomains` can whitelist specific domains (bypasses SSRF checks for those domains). Setting `["*"]` matches every host and disables all private-IP protection on the download endpoint.
- clipboard endpoints are gated by `security.allowClipboard`
@@ -610,6 +611,7 @@ These gates are not ordinary feature toggles. Enabling them is a documented, non
- `/evaluate` and `/tabs/{id}/evaluate` -> `security.allowEvaluate`
- `/download` and `/tabs/{id}/download` -> `security.allowDownload`
+- `GET/POST /cookies` and `GET/POST /tabs/{id}/cookies` -> `security.allowCookies`
- `/upload` and `/tabs/{id}/upload` -> `security.allowUpload`
- clipboard routes -> `security.allowClipboard`
- attach routes -> `security.attach`
diff --git a/docs/guides/security.md b/docs/guides/security.md
index 7f10e132..d99a34b3 100644
--- a/docs/guides/security.md
+++ b/docs/guides/security.md
@@ -19,6 +19,7 @@ The default security posture is:
- `security.allowMacro = false`
- `security.allowScreencast = false`
- `security.allowDownload = false`
+- `security.allowCookies = false`
- `security.allowUpload = false`
- `security.attach.enabled = false`
- `security.attach.allowHosts = ["127.0.0.1", "localhost", "::1"]`
@@ -188,6 +189,7 @@ Some endpoint families expose much more power than normal navigation and inspect
- `security.allowMacro`
- `security.allowScreencast`
- `security.allowDownload`
+- `security.allowCookies`
- `security.allowUpload`
Why they are considered dangerous:
@@ -196,6 +198,7 @@ Why they are considered dangerous:
- `macro` can trigger higher-level automation flows
- `screencast` can stream live page contents
- `download` can fetch and persist remote content. When `security.downloadAllowedDomains` is set, listed domains bypass private-IP SSRF checks (intended for internal hosts such as Docker services). `["*"]` matches every host and disables all private-IP protection on the download endpoint.
+- `cookies` can read or write browser session tokens for the current page
- `upload` can push local files into browser flows
These are not the same as authentication.
@@ -320,6 +323,7 @@ For a secure local setup:
"allowMacro": false,
"allowScreencast": false,
"allowDownload": false,
+ "allowCookies": false,
"allowUpload": false,
"allowedDomains": ["127.0.0.1", "localhost", "::1"],
"trustedProxyCIDRs": [],
diff --git a/docs/mcp.md b/docs/mcp.md
index 155c356c..4e7d910e 100644
--- a/docs/mcp.md
+++ b/docs/mcp.md
@@ -130,7 +130,7 @@ PinchTab currently exposes 38 tools:
- `pinchtab_list_tabs`
- `pinchtab_close_tab`
- `pinchtab_health`
-- `pinchtab_cookies`
+- `pinchtab_cookies` (requires `security.allowCookies`)
- `pinchtab_connect_profile`
### Wait Utilities
diff --git a/docs/reference/cli.md b/docs/reference/cli.md
index a126d4cf..218e6bf0 100644
--- a/docs/reference/cli.md
+++ b/docs/reference/cli.md
@@ -107,7 +107,7 @@ pinchtab server [flags]
| Flag | Short | Purpose |
| --- | --- | --- |
-| `--yolo` | `-y` | Apply guards down preset (enables evaluate, macro, download) |
+| `--yolo` | `-y` | Apply guards down preset (enables evaluate, macro, download, cookies) |
| `--headed` | `-H` | Start browser instances in headed (visible) mode |
| `--extension <path>` | `-e` | Load browser extension (repeatable) |
diff --git a/docs/reference/config.md b/docs/reference/config.md
index 08cd660a..3a0b10dc 100644
--- a/docs/reference/config.md
+++ b/docs/reference/config.md
@@ -207,6 +207,7 @@ Current nested file-config shape:
"allowMacro": false,
"allowScreencast": false,
"allowDownload": false,
+ "allowCookies": false,
"allowedDomains": ["127.0.0.1", "localhost", "::1"],
"downloadAllowedDomains": [],
"downloadMaxBytes": 20971520,
diff --git a/docs/reference/mcp-tools.md b/docs/reference/mcp-tools.md
index fb83012c..7dca6e6f 100644
--- a/docs/reference/mcp-tools.md
+++ b/docs/reference/mcp-tools.md
@@ -69,7 +69,7 @@ All element-action tools accept the unified `selector` and the legacy aliases `r
| `pinchtab_list_tabs` | none | Lists open tabs |
| `pinchtab_close_tab` | `tabId` optional | Closes the given tab, or the current/default tab when omitted |
| `pinchtab_health` | none | Checks server health |
-| `pinchtab_cookies` | `tabId` | Reads cookies for a tab |
+| `pinchtab_cookies` | `tabId` | Reads cookies for a tab; requires `security.allowCookies` |
| `pinchtab_connect_profile` | `profile` required | Returns the connect URL and instance status for a profile |
## Wait Utilities
diff --git a/docs/reference/tabs.md b/docs/reference/tabs.md
index fb1cf104..d866943b 100644
--- a/docs/reference/tabs.md
+++ b/docs/reference/tabs.md
@@ -252,7 +252,7 @@ A `pinchtab cookies` CLI command is available; today it exposes a single subcomm
pinchtab cookies clear # clear all cookies via CDP (affects all origins)
```
-Reading and writing cookie payloads is HTTP-only.
+Reading and writing cookie payloads is HTTP-only and requires `security.allowCookies=true`. Clearing cookies remains available through the CLI and HTTP API.
## Metrics
diff --git a/internal/cli/report/config_report.go b/internal/cli/report/config_report.go
index 73a0faac..a8d203bc 100644
--- a/internal/cli/report/config_report.go
+++ b/internal/cli/report/config_report.go
@@ -20,6 +20,7 @@ func HandleConfigShow(cfg *config.RuntimeConfig) {
fmt.Printf(" Macro: %v\n", cfg.AllowMacro)
fmt.Printf(" Screencast: %v\n", cfg.AllowScreencast)
fmt.Printf(" Download: %v\n", cfg.AllowDownload)
+ fmt.Printf(" Cookies: %v\n", cfg.AllowCookies)
fmt.Printf(" Upload: %v\n", cfg.AllowUpload)
fmt.Println()
fmt.Println(styleStdout(headingStyle, "Browser / Instance Defaults"))
diff --git a/internal/config/config_file.go b/internal/config/config_file.go
index 55fe462a..20cbd0d4 100644
--- a/internal/config/config_file.go
+++ b/internal/config/config_file.go
@@ -121,6 +121,7 @@ func DefaultFileConfig() FileConfig {
allowMacro := false
allowScreencast := false
allowDownload := false
+ allowCookies := false
allowNetworkIntercept := false
downloadMaxBytes := DefaultDownloadMaxBytes
allowUpload := false
@@ -182,6 +183,7 @@ func DefaultFileConfig() FileConfig {
AllowMacro: &allowMacro,
AllowScreencast: &allowScreencast,
AllowDownload: &allowDownload,
+ AllowCookies: &allowCookies,
AllowNetworkIntercept: &allowNetworkIntercept,
AllowedDomains: append([]string(nil), defaultLocalAllowedDomains...),
DownloadAllowedDomains: []string{},
diff --git a/internal/config/config_file_json.go b/internal/config/config_file_json.go
index 39965fdc..969e7d82 100644
--- a/internal/config/config_file_json.go
+++ b/internal/config/config_file_json.go
@@ -62,6 +62,7 @@ type securityConfigJSON struct {
AllowMacro *bool `json:"allowMacro"`
AllowScreencast *bool `json:"allowScreencast"`
AllowDownload *bool `json:"allowDownload"`
+ AllowCookies *bool `json:"allowCookies"`
AllowNetworkIntercept *bool `json:"allowNetworkIntercept"`
AllowedDomains []string `json:"allowedDomains"`
DownloadAllowedDomains []string `json:"downloadAllowedDomains"`
diff --git a/internal/config/config_file_legacy.go b/internal/config/config_file_legacy.go
index 5030955c..deed355f 100644
--- a/internal/config/config_file_legacy.go
+++ b/internal/config/config_file_legacy.go
@@ -16,6 +16,7 @@ type legacyFileConfig struct {
AllowMacro *bool `json:"allowMacro,omitempty"`
AllowScreencast *bool `json:"allowScreencast,omitempty"`
AllowDownload *bool `json:"allowDownload,omitempty"`
+ AllowCookies *bool `json:"allowCookies,omitempty"`
AllowUpload *bool `json:"allowUpload,omitempty"`
AllowClipboard *bool `json:"allowClipboard,omitempty"`
StateDir string `json:"stateDir"`
@@ -57,6 +58,7 @@ func convertLegacyConfig(lc *legacyFileConfig) *FileConfig {
fc.Security.AllowMacro = lc.AllowMacro
fc.Security.AllowScreencast = lc.AllowScreencast
fc.Security.AllowDownload = lc.AllowDownload
+ fc.Security.AllowCookies = lc.AllowCookies
fc.Security.AllowUpload = lc.AllowUpload
fc.Security.AllowClipboard = lc.AllowClipboard
diff --git a/internal/config/config_file_marshal.go b/internal/config/config_file_marshal.go
index c79a68af..8c8904cc 100644
--- a/internal/config/config_file_marshal.go
+++ b/internal/config/config_file_marshal.go
@@ -94,6 +94,7 @@ func (fc FileConfig) MarshalJSON() ([]byte, error) {
AllowMacro: fc.Security.AllowMacro,
AllowScreencast: fc.Security.AllowScreencast,
AllowDownload: fc.Security.AllowDownload,
+ AllowCookies: fc.Security.AllowCookies,
AllowNetworkIntercept: fc.Security.AllowNetworkIntercept,
AllowedDomains: effectiveSecurityAllowedDomains(fc.Security),
DownloadAllowedDomains: copyStringSlice(fc.Security.DownloadAllowedDomains),
@@ -251,6 +252,7 @@ func FileConfigFromRuntime(cfg *RuntimeConfig) FileConfig {
allowMacro := cfg.AllowMacro
allowScreencast := cfg.AllowScreencast
allowDownload := cfg.AllowDownload
+ allowCookies := cfg.AllowCookies
allowNetworkIntercept := cfg.AllowNetworkIntercept
downloadAllowedDomains := copyStringSlice(cfg.DownloadAllowedDomains)
downloadMaxBytes := cfg.EffectiveDownloadMaxBytes()
@@ -348,6 +350,7 @@ func FileConfigFromRuntime(cfg *RuntimeConfig) FileConfig {
AllowMacro: &allowMacro,
AllowScreencast: &allowScreencast,
AllowDownload: &allowDownload,
+ AllowCookies: &allowCookies,
AllowNetworkIntercept: &allowNetworkIntercept,
AllowedDomains: append([]string(nil), cfg.AllowedDomains...),
DownloadAllowedDomains: downloadAllowedDomains,
diff --git a/internal/config/config_file_test.go b/internal/config/config_file_test.go
index f1a1f6ed..42195532 100644
--- a/internal/config/config_file_test.go
+++ b/internal/config/config_file_test.go
@@ -49,6 +49,9 @@ func TestDefaultFileConfig(t *testing.T) {
if fc.Security.AllowDownload == nil || *fc.Security.AllowDownload {
t.Errorf("DefaultFileConfig.Security.AllowDownload = %v, want explicit false", formatBoolPtr(fc.Security.AllowDownload))
}
+ if fc.Security.AllowCookies == nil || *fc.Security.AllowCookies {
+ t.Errorf("DefaultFileConfig.Security.AllowCookies = %v, want explicit false", formatBoolPtr(fc.Security.AllowCookies))
+ }
if len(fc.Security.DownloadAllowedDomains) != 0 {
t.Errorf("DefaultFileConfig.Security.DownloadAllowedDomains = %v, want empty list", fc.Security.DownloadAllowedDomains)
}
@@ -347,6 +350,9 @@ func TestDefaultFileConfigJSON(t *testing.T) {
if parsed.Security.AllowDownload == nil || *parsed.Security.AllowDownload {
t.Errorf("round-trip Security.AllowDownload = %v, want explicit false", formatBoolPtr(parsed.Security.AllowDownload))
}
+ if parsed.Security.AllowCookies == nil || *parsed.Security.AllowCookies {
+ t.Errorf("round-trip Security.AllowCookies = %v, want explicit false", formatBoolPtr(parsed.Security.AllowCookies))
+ }
if len(parsed.Security.DownloadAllowedDomains) != 0 {
t.Errorf("round-trip Security.DownloadAllowedDomains = %v, want empty list", parsed.Security.DownloadAllowedDomains)
}
diff --git a/internal/config/config_load.go b/internal/config/config_load.go
index 0fd962b9..5efa8913 100644
--- a/internal/config/config_load.go
+++ b/internal/config/config_load.go
@@ -51,6 +51,7 @@ func Load() *RuntimeConfig {
AllowMacro: false,
AllowScreencast: false,
AllowDownload: false,
+ AllowCookies: false,
AllowNetworkIntercept: false,
AllowedDomains: append([]string(nil), defaultLocalAllowedDomains...),
DownloadAllowedDomains: nil,
@@ -279,6 +280,9 @@ func applyFileConfig(cfg *RuntimeConfig, fc *FileConfig) {
if fc.Security.AllowDownload != nil {
cfg.AllowDownload = *fc.Security.AllowDownload
}
+ if fc.Security.AllowCookies != nil {
+ cfg.AllowCookies = *fc.Security.AllowCookies
+ }
if fc.Security.AllowNetworkIntercept != nil {
cfg.AllowNetworkIntercept = *fc.Security.AllowNetworkIntercept
}
diff --git a/internal/config/config_load_test.go b/internal/config/config_load_test.go
index ad065392..54d9cb74 100644
--- a/internal/config/config_load_test.go
+++ b/internal/config/config_load_test.go
@@ -41,6 +41,9 @@ func TestLoadConfigDefaults(t *testing.T) {
if cfg.AllowEvaluate {
t.Errorf("default AllowEvaluate = %v, want false", cfg.AllowEvaluate)
}
+ if cfg.AllowCookies {
+ t.Errorf("default AllowCookies = %v, want false", cfg.AllowCookies)
+ }
if !cfg.EnableActionGuards {
t.Errorf("default EnableActionGuards = %v, want true", cfg.EnableActionGuards)
}
@@ -364,6 +367,7 @@ func TestApplyFileConfigToRuntimeResetsSecurityFlagsToSafeDefaults(t *testing.T)
AllowMacro: true,
AllowScreencast: true,
AllowDownload: true,
+ AllowCookies: true,
AllowUpload: true,
IDPI: IDPIConfig{
Enabled: false,
@@ -385,6 +389,9 @@ func TestApplyFileConfigToRuntimeResetsSecurityFlagsToSafeDefaults(t *testing.T)
if cfg.AllowDownload {
t.Errorf("ApplyFileConfigToRuntime AllowDownload = %v, want false", cfg.AllowDownload)
}
+ if cfg.AllowCookies {
+ t.Errorf("ApplyFileConfigToRuntime AllowCookies = %v, want false", cfg.AllowCookies)
+ }
if cfg.AllowUpload {
t.Errorf("ApplyFileConfigToRuntime AllowUpload = %v, want false", cfg.AllowUpload)
}
diff --git a/internal/config/config_methods.go b/internal/config/config_methods.go
index 510699ee..9c1f5e51 100644
--- a/internal/config/config_methods.go
+++ b/internal/config/config_methods.go
@@ -7,7 +7,7 @@ func (cfg *RuntimeConfig) EnabledSensitiveEndpoints() []string {
return nil
}
- enabled := make([]string, 0, 6)
+ enabled := make([]string, 0, 7)
if cfg.AllowEvaluate {
enabled = append(enabled, "evaluate")
}
@@ -20,6 +20,9 @@ func (cfg *RuntimeConfig) EnabledSensitiveEndpoints() []string {
if cfg.AllowDownload {
enabled = append(enabled, "download")
}
+ if cfg.AllowCookies {
+ enabled = append(enabled, "cookies")
+ }
if cfg.AllowUpload {
enabled = append(enabled, "upload")
}
diff --git a/internal/config/config_types.go b/internal/config/config_types.go
index de09d323..7864fcca 100644
--- a/internal/config/config_types.go
+++ b/internal/config/config_types.go
@@ -24,6 +24,7 @@ type RuntimeConfig struct {
AllowMacro bool
AllowScreencast bool
AllowDownload bool
+ AllowCookies bool
AllowNetworkIntercept bool
// AllowedDomains is the unified per-instance allowlist sourced from
// security.allowedDomains in the file config.
@@ -324,6 +325,7 @@ type SecurityConfig struct {
AllowMacro *bool `json:"allowMacro,omitempty"`
AllowScreencast *bool `json:"allowScreencast,omitempty"`
AllowDownload *bool `json:"allowDownload,omitempty"`
+ AllowCookies *bool `json:"allowCookies,omitempty"`
AllowNetworkIntercept *bool `json:"allowNetworkIntercept,omitempty"`
AllowedDomains []string `json:"allowedDomains,omitempty"`
DownloadAllowedDomains []string `json:"downloadAllowedDomains,omitempty"`
diff --git a/internal/config/editor_get.go b/internal/config/editor_get.go
index 9e7f3781..1ca2fa2c 100644
--- a/internal/config/editor_get.go
+++ b/internal/config/editor_get.go
@@ -216,6 +216,8 @@ func getSecurityField(s *SecurityConfig, field string) (string, error) {
return formatBoolPtr(s.AllowScreencast), nil
case "allowDownload":
return formatBoolPtr(s.AllowDownload), nil
+ case "allowCookies":
+ return formatBoolPtr(s.AllowCookies), nil
case "allowNetworkIntercept":
return formatBoolPtr(s.AllowNetworkIntercept), nil
case "allowedDomains":
diff --git a/internal/config/editor_get_test.go b/internal/config/editor_get_test.go
index 13614fb9..956d5265 100644
--- a/internal/config/editor_get_test.go
+++ b/internal/config/editor_get_test.go
@@ -37,6 +37,7 @@ func TestGetConfigValue_RoundTrip(t *testing.T) {
{"security.allowMacro", "false", "false"},
{"security.allowScreencast", "on", "true"},
{"security.allowDownload", "off", "false"},
+ {"security.allowCookies", "yes", "true"},
{"security.downloadAllowedDomains", "pinchtab.com,*.pinchtab.com", "pinchtab.com,*.pinchtab.com"},
{"security.downloadMaxBytes", "33554432", "33554432"},
{"security.allowUpload", "yes", "true"},
@@ -101,6 +102,7 @@ func TestGetConfigValue_NilPointerReturnsEmpty(t *testing.T) {
"security.allowMacro",
"security.allowScreencast",
"security.allowDownload",
+ "security.allowCookies",
"security.downloadMaxBytes",
"security.allowUpload",
"security.enableActionGuards",
diff --git a/internal/config/editor_set.go b/internal/config/editor_set.go
index 5832475b..8de3622c 100644
--- a/internal/config/editor_set.go
+++ b/internal/config/editor_set.go
@@ -378,6 +378,8 @@ func setSecurityField(s *SecurityConfig, field, value string) error {
s.AllowScreencast = &b
case "allowDownload":
s.AllowDownload = &b
+ case "allowCookies":
+ s.AllowCookies = &b
case "allowUpload":
s.AllowUpload = &b
case "allowNetworkIntercept":
diff --git a/internal/config/editor_set_test.go b/internal/config/editor_set_test.go
index 82e6a01c..3e5851d6 100644
--- a/internal/config/editor_set_test.go
+++ b/internal/config/editor_set_test.go
@@ -93,6 +93,7 @@ func TestSetConfigValue_SecurityFields(t *testing.T) {
{"security.allowMacro", "1", func(fc *FileConfig) bool { return *fc.Security.AllowMacro == true }, false},
{"security.allowScreencast", "false", func(fc *FileConfig) bool { return *fc.Security.AllowScreencast == false }, false},
{"security.allowDownload", "on", func(fc *FileConfig) bool { return *fc.Security.AllowDownload == true }, false},
+ {"security.allowCookies", "yes", func(fc *FileConfig) bool { return *fc.Security.AllowCookies == true }, false},
{"security.downloadAllowedDomains", "pinchtab.com, *.pinchtab.com", func(fc *FileConfig) bool {
return len(fc.Security.DownloadAllowedDomains) == 2 &&
fc.Security.DownloadAllowedDomains[0] == "pinchtab.com" &&
diff --git a/internal/config/fileio.go b/internal/config/fileio.go
index 091aa44b..26c2ca8c 100644
--- a/internal/config/fileio.go
+++ b/internal/config/fileio.go
@@ -141,6 +141,9 @@ func loadLegacyFileConfig(data []byte) (*FileConfig, error) {
if legacy.Security.AllowDownload != nil {
fc.Security.AllowDownload = legacy.Security.AllowDownload
}
+ if legacy.Security.AllowCookies != nil {
+ fc.Security.AllowCookies = legacy.Security.AllowCookies
+ }
if legacy.Security.AllowUpload != nil {
fc.Security.AllowUpload = legacy.Security.AllowUpload
}
diff --git a/internal/config/workflow/security.go b/internal/config/workflow/security.go
index 9d15f443..4eca2197 100644
--- a/internal/config/workflow/security.go
+++ b/internal/config/workflow/security.go
@@ -48,6 +48,7 @@ func UpdateSensitiveEndpoints(value string) (*config.RuntimeConfig, bool, error)
"macro": "security.allowMacro",
"screencast": "security.allowScreencast",
"download": "security.allowDownload",
+ "cookies": "security.allowCookies",
"upload": "security.allowUpload",
"networkIntercept": "security.allowNetworkIntercept",
} {
@@ -132,6 +133,7 @@ func BuildGuardsDownConfig(fc *config.FileConfig) (bool, error) {
{path: "security.allowMacro", value: "true"},
{path: "security.allowScreencast", value: "true"},
{path: "security.allowDownload", value: "true"},
+ {path: "security.allowCookies", value: "true"},
{path: "security.allowUpload", value: "true"},
{path: "security.allowNetworkIntercept", value: "true"},
{path: "security.attach.enabled", value: "true"},
@@ -208,6 +210,7 @@ type securityConfigValues struct {
AllowMacro bool
AllowScreencast bool
AllowDownload bool
+ AllowCookies bool
AllowNetworkIntercept bool
DownloadMaxBytes int
AllowUpload bool
@@ -243,6 +246,9 @@ func securityDefaultsSnapshot(fc *config.FileConfig) securityDefaultsState {
if fc.Security.AllowDownload != nil {
s.Security.AllowDownload = *fc.Security.AllowDownload
}
+ if fc.Security.AllowCookies != nil {
+ s.Security.AllowCookies = *fc.Security.AllowCookies
+ }
if fc.Security.AllowNetworkIntercept != nil {
s.Security.AllowNetworkIntercept = *fc.Security.AllowNetworkIntercept
}
diff --git a/internal/config/workflow/security_test.go b/internal/config/workflow/security_test.go
index 5070fef5..f691d134 100644
--- a/internal/config/workflow/security_test.go
+++ b/internal/config/workflow/security_test.go
@@ -39,7 +39,7 @@ func TestApplyGuardsDownPreset(t *testing.T) {
if cfg.Token != "guarded-token" {
t.Fatalf("Token = %q, want existing token to remain", cfg.Token)
}
- if !cfg.AllowEvaluate || !cfg.AllowMacro || !cfg.AllowScreencast || !cfg.AllowDownload || !cfg.AllowUpload {
+ if !cfg.AllowEvaluate || !cfg.AllowMacro || !cfg.AllowScreencast || !cfg.AllowDownload || !cfg.AllowCookies || !cfg.AllowUpload {
t.Fatalf("expected sensitive endpoints enabled, got %+v", cfg)
}
if !cfg.AttachEnabled {
diff --git a/internal/dashboard/config_api.go b/internal/dashboard/config_api.go
index 447821f0..90526f2c 100644
--- a/internal/dashboard/config_api.go
+++ b/internal/dashboard/config_api.go
@@ -291,6 +291,7 @@ func isGuardsDownPosture(cfg *config.RuntimeConfig) bool {
cfg.AllowMacro &&
cfg.AllowScreencast &&
cfg.AllowDownload &&
+ cfg.AllowCookies &&
cfg.AllowUpload &&
cfg.AllowNetworkIntercept &&
cfg.AttachEnabled &&
diff --git a/internal/handlers/actions_test.go b/internal/handlers/actions_test.go
index 36830b6d..8391d828 100644
--- a/internal/handlers/actions_test.go
+++ b/internal/handlers/actions_test.go
@@ -260,7 +260,7 @@ func TestHandleTabActions_NoTab(t *testing.T) {
}
func TestHandleGetCookies_NoTab(t *testing.T) {
- h := New(&failMockBridge{}, &config.RuntimeConfig{}, nil, nil, nil)
+ h := New(&failMockBridge{}, &config.RuntimeConfig{AllowCookies: true}, nil, nil, nil)
req := httptest.NewRequest("GET", "/cookies", nil)
w := httptest.NewRecorder()
@@ -273,7 +273,7 @@ func TestHandleGetCookies_NoTab(t *testing.T) {
}
func TestHandleSetCookies_EmptyURL(t *testing.T) {
- h := New(&mockBridge{}, &config.RuntimeConfig{}, nil, nil, nil)
+ h := New(&mockBridge{}, &config.RuntimeConfig{AllowCookies: true}, nil, nil, nil)
body := `{"cookies": [{"name": "test", "value": "123"}]}`
req := httptest.NewRequest("POST", "/cookies", bytes.NewReader([]byte(body)))
@@ -296,7 +296,7 @@ func TestHandleSetCookies_EmptyURL(t *testing.T) {
}
func TestHandleSetCookies_EmptyCookies(t *testing.T) {
- h := New(&mockBridge{}, &config.RuntimeConfig{}, nil, nil, nil)
+ h := New(&mockBridge{}, &config.RuntimeConfig{AllowCookies: true}, nil, nil, nil)
body := `{"url": "https://pinchtab.com", "cookies": []}`
req := httptest.NewRequest("POST", "/cookies", bytes.NewReader([]byte(body)))
diff --git a/internal/handlers/cookies.go b/internal/handlers/cookies.go
index 4dd3030e..56053d8d 100644
--- a/internal/handlers/cookies.go
+++ b/internal/handlers/cookies.go
@@ -18,7 +18,21 @@ import (
"github.com/pinchtab/pinchtab/internal/httpx"
)
+func (h *Handlers) ensureCookiesEnabled(w http.ResponseWriter) bool {
+ if h.cookiesEnabled() {
+ return true
+ }
+ httpx.ErrorCode(w, http.StatusForbidden, "cookies_disabled", httpx.DisabledEndpointMessage("cookies", "security.allowCookies"), false, map[string]any{
+ "setting": "security.allowCookies",
+ })
+ return false
+}
+
func (h *Handlers) HandleGetCookies(w http.ResponseWriter, r *http.Request) {
+ if !h.ensureCookiesEnabled(w) {
+ return
+ }
+
tabID := r.URL.Query().Get("tabId")
url := r.URL.Query().Get("url")
name := r.URL.Query().Get("name")
@@ -171,6 +185,10 @@ func (h *Handlers) HandleTabClearCookies(w http.ResponseWriter, r *http.Request)
}
func (h *Handlers) HandleSetCookies(w http.ResponseWriter, r *http.Request) {
+ if !h.ensureCookiesEnabled(w) {
+ return
+ }
+
var req cookieRequest
if err := json.NewDecoder(http.MaxBytesReader(w, r.Body, maxBodySize)).Decode(&req); err != nil {
httpx.Error(w, 400, fmt.Errorf("decode: %w", err))
diff --git a/internal/handlers/cookies_test.go b/internal/handlers/cookies_test.go
index 815f7b00..eeffbfd0 100644
--- a/internal/handlers/cookies_test.go
+++ b/internal/handlers/cookies_test.go
@@ -12,7 +12,7 @@ import (
)
func TestHandleSetCookies_InvalidJSON(t *testing.T) {
- h := New(&mockBridge{}, &config.RuntimeConfig{}, nil, nil, nil)
+ h := New(&mockBridge{}, &config.RuntimeConfig{AllowCookies: true}, nil, nil, nil)
req := httptest.NewRequest("POST", "/cookies", bytes.NewReader([]byte(`not json`)))
w := httptest.NewRecorder()
@@ -23,8 +23,38 @@ func TestHandleSetCookies_InvalidJSON(t *testing.T) {
}
}
-func TestHandleSetCookies_NoTab(t *testing.T) {
+func TestHandleGetCookies_DisabledByDefault(t *testing.T) {
h := New(&failMockBridge{}, &config.RuntimeConfig{}, nil, nil, nil)
+ req := httptest.NewRequest("GET", "/cookies", nil)
+ w := httptest.NewRecorder()
+
+ h.HandleGetCookies(w, req)
+
+ if w.Code != http.StatusForbidden {
+ t.Fatalf("expected 403, got %d: %s", w.Code, w.Body.String())
+ }
+ if !bytes.Contains(w.Body.Bytes(), []byte("security.allowCookies")) {
+ t.Fatalf("expected allowCookies hint, got %s", w.Body.String())
+ }
+}
+
+func TestHandleSetCookies_DisabledByDefault(t *testing.T) {
+ h := New(&mockBridge{}, &config.RuntimeConfig{}, nil, nil, nil)
+ req := httptest.NewRequest("POST", "/cookies", bytes.NewReader([]byte(`{"url":"https://pinchtab.com","cookies":[{"name":"a","value":"b"}]}`)))
+ w := httptest.NewRecorder()
+
+ h.HandleSetCookies(w, req)
+
+ if w.Code != http.StatusForbidden {
+ t.Fatalf("expected 403, got %d: %s", w.Code, w.Body.String())
+ }
+ if !bytes.Contains(w.Body.Bytes(), []byte("security.allowCookies")) {
+ t.Fatalf("expected allowCookies hint, got %s", w.Body.String())
+ }
+}
+
+func TestHandleSetCookies_NoTab(t *testing.T) {
+ h := New(&failMockBridge{}, &config.RuntimeConfig{AllowCookies: true}, nil, nil, nil)
body := `{"url":"https://pinchtab.com","cookies":[{"name":"a","value":"b"}],"tabId":"nonexistent"}`
req := httptest.NewRequest("POST", "/cookies", bytes.NewReader([]byte(body)))
w := httptest.NewRecorder()
@@ -37,7 +67,7 @@ func TestHandleSetCookies_NoTab(t *testing.T) {
}
func TestHandleGetCookies_NameFilter(t *testing.T) {
- h := New(&failMockBridge{}, &config.RuntimeConfig{}, nil, nil, nil)
+ h := New(&failMockBridge{}, &config.RuntimeConfig{AllowCookies: true}, nil, nil, nil)
req := httptest.NewRequest("GET", "/cookies?name=session_id&tabId=nonexistent", nil)
w := httptest.NewRecorder()
@@ -56,7 +86,7 @@ func TestHandleGetCookies_NameFilter(t *testing.T) {
}
func TestHandleTabGetCookies_MissingTabID(t *testing.T) {
- h := New(&mockBridge{}, &config.RuntimeConfig{}, nil, nil, nil)
+ h := New(&mockBridge{}, &config.RuntimeConfig{AllowCookies: true}, nil, nil, nil)
req := httptest.NewRequest("GET", "/tabs//cookies", nil)
w := httptest.NewRecorder()
h.HandleTabGetCookies(w, req)
@@ -66,7 +96,7 @@ func TestHandleTabGetCookies_MissingTabID(t *testing.T) {
}
func TestHandleTabGetCookies_NoTab(t *testing.T) {
- h := New(&failMockBridge{}, &config.RuntimeConfig{}, nil, nil, nil)
+ h := New(&failMockBridge{}, &config.RuntimeConfig{AllowCookies: true}, nil, nil, nil)
req := httptest.NewRequest("GET", "/tabs/tab_abc/cookies", nil)
req.SetPathValue("id", "tab_abc")
w := httptest.NewRecorder()
@@ -77,7 +107,7 @@ func TestHandleTabGetCookies_NoTab(t *testing.T) {
}
func TestHandleTabSetCookies_TabIDMismatch(t *testing.T) {
- h := New(&mockBridge{}, &config.RuntimeConfig{}, nil, nil, nil)
+ h := New(&mockBridge{}, &config.RuntimeConfig{AllowCookies: true}, nil, nil, nil)
body := `{"tabId":"tab_other","url":"https://pinchtab.com","cookies":[{"name":"a","value":"b"}]}`
req := httptest.NewRequest("POST", "/tabs/tab_abc/cookies", bytes.NewReader([]byte(body)))
req.SetPathValue("id", "tab_abc")
@@ -89,7 +119,7 @@ func TestHandleTabSetCookies_TabIDMismatch(t *testing.T) {
}
func TestHandleTabSetCookies_NoTab(t *testing.T) {
- h := New(&failMockBridge{}, &config.RuntimeConfig{}, nil, nil, nil)
+ h := New(&failMockBridge{}, &config.RuntimeConfig{AllowCookies: true}, nil, nil, nil)
body := `{"url":"https://pinchtab.com","cookies":[{"name":"a","value":"b"}]}`
req := httptest.NewRequest("POST", "/tabs/tab_abc/cookies", bytes.NewReader([]byte(body)))
req.SetPathValue("id", "tab_abc")
diff --git a/internal/handlers/security.go b/internal/handlers/security.go
index 13294564..619e48e0 100644
--- a/internal/handlers/security.go
+++ b/internal/handlers/security.go
@@ -21,6 +21,10 @@ func (h *Handlers) downloadEnabled() bool {
return h != nil && h.Config != nil && h.Config.AllowDownload
}
+func (h *Handlers) cookiesEnabled() bool {
+ return h != nil && h.Config != nil && h.Config.AllowCookies
+}
+
func (h *Handlers) uploadEnabled() bool {
return h != nil && h.Config != nil && h.Config.AllowUpload
}
@@ -55,6 +59,12 @@ func (h *Handlers) endpointSecurityStates() map[string]endpointSecurityState {
Message: httpx.DisabledEndpointMessage("download", "security.allowDownload"),
Paths: []string{"GET /download", "GET /tabs/{id}/download"},
},
+ "cookies": {
+ Enabled: h.cookiesEnabled(),
+ Setting: "security.allowCookies",
+ Message: httpx.DisabledEndpointMessage("cookies", "security.allowCookies"),
+ Paths: []string{"GET /cookies", "POST /cookies", "GET /tabs/{id}/cookies", "POST /tabs/{id}/cookies"},
+ },
"upload": {
Enabled: h.uploadEnabled(),
Setting: "security.allowUpload",
diff --git a/internal/routes/routes.go b/internal/routes/routes.go
index e8225663..6fd7e3ec 100644
--- a/internal/routes/routes.go
+++ b/internal/routes/routes.go
@@ -15,6 +15,7 @@ const (
CapMacro Capability = "macro"
CapScreencast Capability = "screencast"
CapDownload Capability = "download"
+ CapCookies Capability = "cookies"
CapUpload Capability = "upload"
CapStateExport Capability = "stateExport"
CapNetworkIntercept Capability = "networkIntercept"
@@ -90,8 +91,8 @@ var coreEndpoints = []Endpoint{
{"GET", "/handoff", "Get handoff status", CapNone, true},
// Cookies
- {"GET", "/cookies", "Get cookies", CapNone, true},
- {"POST", "/cookies", "Set cookies", CapNone, true},
+ {"GET", "/cookies", "Get cookies", CapCookies, true},
+ {"POST", "/cookies", "Set cookies", CapCookies, true},
{"DELETE", "/cookies", "Clear all cookies", CapNone, true},
// Metrics
diff --git a/plugin/README.md b/plugin/README.md
index 02621e07..69dd40e4 100644
--- a/plugin/README.md
+++ b/plugin/README.md
@@ -228,7 +228,7 @@ pinchtab({ action: "wait", text: "Welcome back", timeout: 120000 })
- **Server lifecycle**: the plugin does not start PinchTab β€” run `pinchtab server` separately. If the server isn't reachable, the plugin returns a clear error pointing at the configured `baseUrl`. Once the server is up, the plugin briefly waits for instance/profile readiness (handles the "still booting" / `503` window).
- **`evaluate`** is blocked by default (`allowEvaluate: false`) β€” enable only for trusted agents
- **`downloads`** and **`uploads`** are blocked by default β€” enable only when the task requires file transfer
-- **Cookie access** exposes session credentials β€” do not log or expose to untrusted contexts
+- **Cookie access** exposes session credentials. Core cookie read/write endpoints are blocked unless `security.allowCookies=true`; do not log or expose cookie values to untrusted contexts
- **Network exports** may contain private URLs and auth tokens β€” omit `--body` for sensitive sessions; delete exports after use
- **Challenge solving** (`/solve`) requires explicit user approval β€” do not call speculatively
- **Session reuse**: when agents reuse human-authenticated sessions, use dedicated low-privilege profiles and confirm before account-changing actions
diff --git a/plugin/index.ts b/plugin/index.ts
index 3368879e..ce8db035 100644
--- a/plugin/index.ts
+++ b/plugin/index.ts
@@ -1,5 +1,5 @@
/**
- * Pinchtab OpenClaw Plugin
+ * PinchTab OpenClaw Plugin
*
* Two tools:
* - `pinchtab`: Full-featured browser control with all actions
@@ -25,8 +25,8 @@ function toRuntimeContext(ctx: PluginToolContext): PluginRuntimeContext {
export default definePluginEntry({
id: "pinchtab",
- name: "Pinchtab",
- description: "Browser control for AI agents via Pinchtab.",
+ name: "PinchTab",
+ description: "Browser control for AI agents via PinchTab.",
register(api) {
const cfg = getConfig(api);
diff --git a/plugin/openclaw-api.test.ts b/plugin/openclaw-api.test.ts
index 76eaf425..32f704e2 100644
--- a/plugin/openclaw-api.test.ts
+++ b/plugin/openclaw-api.test.ts
@@ -99,7 +99,7 @@ describe("OpenClaw plugin API contract", () => {
const registered: Array<{ tool: AnyAgentTool; opts?: RegisteredToolOptions }> = [];
const api = createTestPluginApi({
id: "pinchtab",
- name: "Pinchtab",
+ name: "PinchTab",
pluginConfig: { registerBrowserTool: true },
config: {
plugins: {
@@ -134,7 +134,7 @@ describe("OpenClaw plugin API contract", () => {
const names: string[] = [];
const api = createTestPluginApi({
id: "pinchtab",
- name: "Pinchtab",
+ name: "PinchTab",
pluginConfig: { registerBrowserTool: false },
registerTool(tool) {
const resolved = typeof tool === "function" ? tool(testToolContext) : tool;
diff --git a/plugin/openclaw.plugin.json b/plugin/openclaw.plugin.json
index c6489c32..807842c6 100644
--- a/plugin/openclaw.plugin.json
+++ b/plugin/openclaw.plugin.json
@@ -1,7 +1,7 @@
{
"id": "pinchtab",
- "name": "Pinchtab",
- "description": "Browser control for AI agents via Pinchtab. Single tool, all actions: navigate, snapshot, click/type/press/fill/hover/scroll/select/focus, mouse-move/mouse-down/mouse-up/mouse-wheel, text, screenshot, evaluate, pdf.",
+ "name": "PinchTab",
+ "description": "Browser control for AI agents via PinchTab. Single tool, all actions: navigate, snapshot, click/type/press/fill/hover/scroll/select/focus, mouse-move/mouse-down/mouse-up/mouse-wheel, text, screenshot, evaluate, pdf.",
"version": "0.3.0",
"contracts": {
"tools": ["pinchtab", "browser"]
@@ -16,7 +16,7 @@
"properties": {
"baseUrl": {
"type": "string",
- "description": "Pinchtab instance base URL",
+ "description": "PinchTab instance base URL",
"default": "http://localhost:9867"
},
"token": {
@@ -88,7 +88,7 @@
},
"profiles": {
"type": "object",
- "description": "Profile name to Pinchtab instance/profile mapping",
+ "description": "Profile name to PinchTab instance/profile mapping",
"additionalProperties": {
"type": "object",
"properties": {
diff --git a/plugin/package.json b/plugin/package.json
index 73b9c2a8..988ef6c2 100644
--- a/plugin/package.json
+++ b/plugin/package.json
@@ -35,4 +35,4 @@
"tsx": "^4.20.6",
"typescript": "^5.9.3"
}
-}
+}
\ No newline at end of file
diff --git a/plugin/session.ts b/plugin/session.ts
index 47a5fd92..7689a0c7 100644
--- a/plugin/session.ts
+++ b/plugin/session.ts
@@ -248,5 +248,5 @@ export async function waitForInstanceReady(
await new Promise((resolve) => setTimeout(resolve, instanceReadyRetryDelayMs));
}
- return { ok: false, error: `Timed out waiting for Pinchtab instance readiness: ${lastError}` };
+ return { ok: false, error: `Timed out waiting for PinchTab instance readiness: ${lastError}` };
}
diff --git a/plugin/tools/browser.ts b/plugin/tools/browser.ts
index b82a14ef..487c80e9 100644
--- a/plugin/tools/browser.ts
+++ b/plugin/tools/browser.ts
@@ -30,7 +30,7 @@ export const browserToolSchema = {
required: ["action"],
};
-export const browserToolDescription = `OpenClaw-compatible browser control (backed by Pinchtab).
+export const browserToolDescription = `OpenClaw-compatible browser control (backed by PinchTab).
Actions:
- navigate: go to URL (url, profile?, newTab?)
diff --git a/plugin/tools/pinchtab.ts b/plugin/tools/pinchtab.ts
index 6de67a92..c040a81b 100644
--- a/plugin/tools/pinchtab.ts
+++ b/plugin/tools/pinchtab.ts
@@ -71,7 +71,7 @@ export const pinchtabToolSchema = {
required: ["action"],
};
-export const pinchtabToolDescription = `Browser control via Pinchtab. Actions:
+export const pinchtabToolDescription = `Browser control via PinchTab. Actions:
- navigate: go to URL (url, tabId?, newTab?, blockImages?, timeout?)
- snapshot: accessibility tree (filter?, format?, selector?, maxTokens?, depth?, diff?, tabId?)
- click/type/press/fill/hover/scroll/select/focus: act on element (ref, text?, key?, value?, scrollY?, waitNav?, tabId?)
diff --git a/schema/config.json b/schema/config.json
index bb084970..333851af 100644
--- a/schema/config.json
+++ b/schema/config.json
@@ -350,6 +350,9 @@
"allowDownload": {
"$ref": "#/definitions/nullableBoolean"
},
+ "allowCookies": {
+ "$ref": "#/definitions/nullableBoolean"
+ },
"allowedDomains": {
"$ref": "#/definitions/domainPatternArray"
},
diff --git a/scripts/pack-plugin.sh b/scripts/pack-plugin.sh
new file mode 100755
index 00000000..7618599b
--- /dev/null
+++ b/scripts/pack-plugin.sh
@@ -0,0 +1,65 @@
+#!/usr/bin/env bash
+# Produce a ClawHub-ready tarball of plugin/ for manual upload at
+# https://clawhub.ai/publish-plugin.
+#
+# Usage:
+# scripts/pack-plugin.sh # pack at the version in package.json
+# scripts/pack-plugin.sh 0.11.1 # bump to 0.11.1, pack, restore the
+# # working-tree version (so the bump
+# # is not committed by mistake)
+#
+# Output goes to dist/plugin-pack/<name>-<version>.tgz and the path is echoed
+# at the end so you can drop it straight into the ClawHub upload form.
+set -euo pipefail
+
+cd "$(dirname "$0")/.."
+
+VERSION="${1:-}"
+PLUGIN_DIR="$(pwd)/plugin"
+OUT_DIR="$(pwd)/dist/plugin-pack"
+mkdir -p "$OUT_DIR"
+
+if [[ ! -d "$PLUGIN_DIR" ]]; then
+ echo "no plugin directory at $PLUGIN_DIR" >&2
+ exit 1
+fi
+
+ORIGINAL_PKG=$(cat "$PLUGIN_DIR/package.json")
+ORIGINAL_MANIFEST=$(cat "$PLUGIN_DIR/openclaw.plugin.json")
+
+restore() {
+ printf '%s' "$ORIGINAL_PKG" > "$PLUGIN_DIR/package.json"
+ printf '%s' "$ORIGINAL_MANIFEST" > "$PLUGIN_DIR/openclaw.plugin.json"
+}
+trap restore EXIT
+
+if [[ -n "$VERSION" ]]; then
+ echo "β†’ bumping plugin version to $VERSION (working-tree only, restored on exit)"
+ (cd "$PLUGIN_DIR" && npm version "$VERSION" --no-git-tag-version >/dev/null)
+ node -e "
+ const fs = require('fs');
+ const path = '$PLUGIN_DIR/openclaw.plugin.json';
+ const m = JSON.parse(fs.readFileSync(path, 'utf8'));
+ m.version = '$VERSION';
+ fs.writeFileSync(path, JSON.stringify(m, null, 2) + '\n');
+ "
+fi
+
+echo "β†’ installing plugin deps (needed for tsc in prepack)"
+(cd "$PLUGIN_DIR" && npm install --ignore-scripts --no-package-lock --no-audit --no-fund >/dev/null)
+
+echo "β†’ packing via clawhub (mirrors what reusable-publish-plugin.yml uploads)"
+npx -y -p clawhub clawhub package pack "$PLUGIN_DIR" --pack-destination "$OUT_DIR"
+
+TARBALL=$(ls -t "$OUT_DIR"/*.tgz 2>/dev/null | head -1 || true)
+if [[ -z "$TARBALL" ]]; then
+ echo "no tarball produced β€” check the output above" >&2
+ exit 1
+fi
+
+echo
+echo "ready: $TARBALL"
+echo " $(wc -c <"$TARBALL" | tr -d ' ') bytes"
+echo " sha256 $(shasum -a 256 "$TARBALL" | awk '{print $1}')"
+echo
+echo "upload at https://clawhub.ai/publish-plugin"
diff --git a/skills/pinchtab/SKILL.md b/skills/pinchtab/SKILL.md
index ed11ead3..f742f719 100644
--- a/skills/pinchtab/SKILL.md
+++ b/skills/pinchtab/SKILL.md
@@ -60,7 +60,7 @@ Rules: only `nav <url>` auto-starts the default local server; `snap`, `text`, `h
- Do not upload local files unless the user explicitly names the file and the destination flow requires it.
- Do not save screenshots, PDFs, or downloads to arbitrary paths β€” use a user-specified path or a safe temporary/workspace directory.
- Do not use PinchTab to inspect unrelated local files, browser secrets, stored credentials, or system configuration outside the task.
-- Cookie data (`pinchtab cookies`) contains session credentials β€” do not log, copy, or expose cookie values to untrusted contexts. Use only when the task specifically requires cookie inspection.
+- Cookie read/write is disabled by default; do not inspect or expose cookies without explicit user approval.
- Network exports (`pinchtab network-export`) may contain private URLs, auth tokens, and response bodies. Omit `--body` for sensitive sessions. Delete or redact export files after use.
## Selectors
@@ -217,8 +217,8 @@ These operations are high-impact and gated by security policy. Do not use unless
```bash
pinchtab eval "document.title" # --await-promise for async; requires security.allowEvaluate: true
-pinchtab download <url> -o /tmp/out.bin # requires security.allowDownloads: true
-pinchtab upload /absolute/path -s <css> # requires security.allowUploads: true
+pinchtab download <url> -o /tmp/out.bin # requires security.allowDownload: true
+pinchtab upload /absolute/path -s <css> # requires security.allowUpload: true
```
- `eval`: narrow read-only DOM inspection unless user asks for mutation. Blocked by default (`security.allowEvaluate: false`).
diff --git a/skills/pinchtab/TRUST.md b/skills/pinchtab/TRUST.md
index e43bfe79..700c7da9 100644
--- a/skills/pinchtab/TRUST.md
+++ b/skills/pinchtab/TRUST.md
@@ -1,8 +1,8 @@
-# Pinchtab Security & Trust
+# PinchTab Security & Trust
-**TL;DR**: Pinchtab is a local, sandboxed browser control tool. It does not phone home, steal credentials, or exfiltrate data. Source code is public; binaries are signed and published via GitHub.
+**TL;DR**: PinchTab is a local, sandboxed browser control tool. It does not phone home, steal credentials, or exfiltrate data. Source code is public; binaries are signed and published via GitHub.
-## What Pinchtab Does
+## What PinchTab Does
- Launches a Chrome browser (local, under your control)
- Exposes navigation, clicking, typing, and page inspection via HTTP API
@@ -13,7 +13,7 @@ High-risk operations such as JavaScript evaluation, local-file upload, file down
**All of this stays local.** No telemetry. No external API calls (except to sites you navigate to).
-## What Pinchtab Does NOT Do
+## What PinchTab Does NOT Do
- ❌ Doesn't access your saved passwords/credentials (Chrome sandboxing)
- ❌ Doesn't exfiltrate data to remote servers
@@ -32,8 +32,8 @@ High-impact capabilities are **disabled by default** and require explicit config
| File uploads | **Disabled** | `security.allowUploads` |
| Network interception | **Disabled** | `security.allowNetworkIntercept` |
| Challenge solving / stealth | **Disabled** | Requires explicit `/solve` call with user approval |
-| Navigation domains | **All allowed** | `security.allowedDomains` (restrict with allowlist) |
-| Cookie access | **Available** | Use only when task requires it; do not log or expose session tokens |
+| Navigation domains | **Local-only allowlist** | `security.allowedDomains` (restrict or expand deliberately) |
+| Cookie access | **Disabled** | `security.allowCookies`; use only when task requires it; do not log or expose session tokens |
Agents reusing authenticated browser sessions should use dedicated low-privilege profiles and confirm with the user before performing account-changing actions.
@@ -57,7 +57,7 @@ If you're concerned, audit the sourceβ€”it's ~15MB, zero external dependencies,
## VirusTotal Flag
-Pinchtab may trigger heuristic scanners on VirusTotal because:
+PinchTab may trigger heuristic scanners on VirusTotal because:
- βœ“ It launches Chrome (subprocess execution β€” flagged by AV heuristics)
- βœ“ It runs JavaScript evaluation (eval-like operations)
@@ -71,7 +71,7 @@ For maximum confidence, use the npm package (`npm install -g pinchtab`) or Docke
## Sandboxing
-Pinchtab runs a separate Chrome process with:
+PinchTab runs a separate Chrome process with:
- Isolated profile directory (default: `~/.pinchtab`)
- No access to your user's home files (unless you explicitly navigate to `file://` URLs)
diff --git a/skills/pinchtab/references/api.md b/skills/pinchtab/references/api.md
index 3258e060..91a8b55e 100644
--- a/skills/pinchtab/references/api.md
+++ b/skills/pinchtab/references/api.md
@@ -1,4 +1,4 @@
-# Pinchtab API Reference
+# PinchTab API Reference
Base URL for all examples: `http://localhost:9867`
@@ -303,7 +303,7 @@ curl "/screenshot?raw=true&format=png" -o screenshot.png
## Evaluate JavaScript
Use this sparingly. Prefer `text`, `snapshot`, and normal actions first.
-Default to read-only DOM inspection and avoid reading cookies, localStorage, or unrelated page secrets unless the user explicitly asks for that behavior.
+Default to read-only DOM inspection and avoid reading cookies, localStorage, or unrelated page secrets unless the user explicitly asks for that behavior. Cookie read/write is disabled by default and requires `security.allowCookies: true`.
```bash
# CLI: pinchtab eval "document.title"
@@ -407,11 +407,13 @@ Locked tabs show `owner` and `lockedUntil` in `/tabs`. Returns 409 on conflict.
## Cookies
+Cookie values are session credentials. Read/write endpoints are disabled by default (`security.allowCookies: false`); enable them only for an explicitly approved cookie-inspection or cookie-injection task. Do not log, copy, or send cookie values to untrusted contexts. Use cookie clearing after sensitive work when the user wants session state removed.
+
```bash
-# Get cookies for current page
+# Get cookies for current page (requires security.allowCookies=true)
curl /cookies
-# Set cookies
+# Set cookies (requires security.allowCookies=true)
curl -X POST /cookies -H 'Content-Type: application/json' \
-d '{"url":"https://pinchtab.com","cookies":[{"name":"session","value":"abc123"}]}'
```
diff --git a/skills/pinchtab/references/commands.md b/skills/pinchtab/references/commands.md
index 02e8bc4e..fb44aab0 100644
--- a/skills/pinchtab/references/commands.md
+++ b/skills/pinchtab/references/commands.md
@@ -11,7 +11,7 @@ Start the PinchTab server (default port 9867).
```bash
pinchtab server
-pinchtab server -y # guards down (enables evaluate, macro, download)
+pinchtab server -y # guards down (enables evaluate, macro, download, cookies)
pinchtab server -H # visible browser for debugging
pinchtab server -yH # both combined
pinchtab server -e ./ext # load browser extension
@@ -19,7 +19,7 @@ pinchtab server -e ./ext # load browser extension
| Flag | Short | Description |
|------|-------|-------------|
-| `--yolo` | `-y` | Apply guards down preset (enables evaluate, macro, download) |
+| `--yolo` | `-y` | Apply guards down preset (enables evaluate, macro, download, cookies) |
| `--headed` | `-H` | Start browser in headed (visible) mode |
| `--extension <path>` | `-e` | Load browser extension (repeatable) |
diff --git a/skills/pinchtab/references/mcp.md b/skills/pinchtab/references/mcp.md
index 2589890b..4449898a 100644
--- a/skills/pinchtab/references/mcp.md
+++ b/skills/pinchtab/references/mcp.md
@@ -89,7 +89,7 @@ All tool names are prefixed with `pinchtab_`.
| `pinchtab_list_tabs` | List all open tabs. No params. |
| `pinchtab_close_tab` | Close a tab. Optional: `tabId` (uses current/default tab when omitted). |
| `pinchtab_health` | Check server health. No params. |
-| `pinchtab_cookies` | Get cookies for current page. Optional: `tabId`. |
+| `pinchtab_cookies` | Get cookies for current page. Optional: `tabId`. Requires `security.allowCookies: true`. |
| `pinchtab_connect_profile` | Return connect status for a profile. Required: `profile`. |
### Utility
@@ -169,6 +169,7 @@ MCP tools surface errors as tool errors (not protocol-level errors). Common case
| Connection refused | PinchTab not running | Run `pinchtab mcp` locally, or start with `pinchtab server` / `pinchtab daemon start` |
| `ref not found` | Stale element ref | Re-run `pinchtab_snapshot` |
| `evaluate not allowed` (403) | `security.allowEvaluate` is false | Enable in config or use `find`/`snap` instead |
+| `cookies disabled` (403) | `security.allowCookies` is false | Enable only for an explicitly approved cookie-inspection task |
| `invalid URL` | Missing `http://` or `https://` | Include full scheme in URL |
---