Skip to content

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

fix: give cloak doctor targeted repair hints and drop the implied identity check

Luigi Agosti8a4bfefee4ff
diff --git a/cmd/pinchtab/cmd_doctor_browser.go b/cmd/pinchtab/cmd_doctor_browser.go
index 862509f2..9670cefc 100644
--- a/cmd/pinchtab/cmd_doctor_browser.go
+++ b/cmd/pinchtab/cmd_doctor_browser.go
@@ -122,10 +122,21 @@ func browserOverviewHint(bi doctor.BrowserInfo) string {
if strings.Contains(presence.Detail, "configured browser.binary") {
return "Fix browser.binary (or browser.targets.<name>.binary) so it points to an executable CloakBrowser binary."
}
+ if strings.Contains(presence.Detail, "< required") {
+ return "The configured CloakBrowser binary is too old. Update it to a build with an adequate Chromium version."
+ }
}
- if presence != nil && presence.Status == doctor.StatusPass && hasFailedCheck(bi, "cdp_reachable") {
- if binary := cloakPresentBinary(presence.Detail); binary != "" {
- return fmt.Sprintf("CloakBrowser was found at %s but did not accept CDP. Try updating or reinstalling it.", binary)
+ if presence != nil && presence.Status == doctor.StatusPass {
+ if hasFailedCheck(bi, "cdp_reachable") {
+ if binary := cloakPresentBinary(presence.Detail); binary != "" {
+ return fmt.Sprintf("CloakBrowser was found at %s but did not accept CDP. Try updating or reinstalling it.", binary)
+ }
+ }
+ if hasFailedCheck(bi, "fingerprint_flags_accepted") {
+ return "The configured CloakBrowser binary rejected the fingerprint flags. Update it to a build that supports the configured cloak fingerprint options."
+ }
+ if hasWarnCheck(bi, "linux_fonts_present") {
+ return "CloakBrowser is installed, but the Windows fingerprint fonts are missing on this Linux host. Install msttcorefonts or mount a Windows fonts directory."
}
}
}
@@ -153,6 +164,15 @@ func hasFailedCheck(bi doctor.BrowserInfo, name string) bool {
return false
}
+func hasWarnCheck(bi doctor.BrowserInfo, name string) bool {
+ for _, check := range bi.Checks {
+ if check.Name == name && check.Status == doctor.StatusWarn {
+ return true
+ }
+ }
+ return false
+}
+
func cloakPresentBinary(detail string) string {
binary, _, ok := strings.Cut(detail, " -> ")
if !ok {
diff --git a/cmd/pinchtab/cmd_doctor_test.go b/cmd/pinchtab/cmd_doctor_test.go
index 2fb9938a..7796b52e 100644
--- a/cmd/pinchtab/cmd_doctor_test.go
+++ b/cmd/pinchtab/cmd_doctor_test.go
@@ -97,6 +97,38 @@ func TestBrowserOverviewCloakHintsMatchPresenceState(t *testing.T) {
if hint := browserOverviewHint(cdpFailure); !strings.Contains(hint, "was found at /opt/cloak/chrome") {
t.Fatalf("CDP failure hint = %q, want verified-binary repair guidance", hint)
}
+
+ tooOld := base
+ tooOld.Checks = []doctor.CheckResult{{
+ Name: "cloakbrowser_present",
+ Status: doctor.StatusWarn,
+ Detail: "/opt/cloak/chrome -> 118.0.0 (< required 120.0.0)",
+ }}
+ if hint := browserOverviewHint(tooOld); !strings.Contains(hint, "too old") {
+ t.Fatalf("too-old hint = %q, want update guidance, not a reinstall/install prompt", hint)
+ }
+
+ flagsRejected := base
+ flagsRejected.Checks = []doctor.CheckResult{
+ {Name: "cloakbrowser_present", Status: doctor.StatusPass, Detail: "/opt/cloak/chrome -> 130.0.0 (>= 120.0.0)"},
+ {Name: "fingerprint_flags_accepted", Status: doctor.StatusFail},
+ }
+ if hint := browserOverviewHint(flagsRejected); !strings.Contains(hint, "fingerprint flags") {
+ t.Fatalf("fingerprint-flags hint = %q, want flag-support guidance", hint)
+ }
+
+ fontsMissing := base
+ fontsMissing.Checks = []doctor.CheckResult{
+ {Name: "cloakbrowser_present", Status: doctor.StatusPass, Detail: "/opt/cloak/chrome -> 130.0.0 (>= 120.0.0)"},
+ {Name: "linux_fonts_present", Status: doctor.StatusWarn},
+ }
+ hint := browserOverviewHint(fontsMissing)
+ if !strings.Contains(hint, "fingerprint fonts") {
+ t.Fatalf("fonts hint = %q, want font-install guidance", hint)
+ }
+ if strings.Contains(hint, "custom build") {
+ t.Fatalf("fonts hint = %q, must not tell the user to install an already-present browser", hint)
+ }
}
func TestRunDoctorReturnsUsageErrorWithoutMutatingCheckFlag(t *testing.T) {
diff --git a/internal/browsers/cloak/doctor.go b/internal/browsers/cloak/doctor.go
index 744df29e..ccf5f856 100644
--- a/internal/browsers/cloak/doctor.go
+++ b/internal/browsers/cloak/doctor.go
@@ -133,9 +133,13 @@ func cloakPresenceCheck(ctx context.Context, cfg interface{}) browsers.DoctorChe
Detail: fmt.Sprintf("CloakBrowser found at %s -> %s, but browser.binary is unset", found, token),
}
}
+ // A configured browser.binary is trusted on version alone: CloakBrowser's
+ // forked Chromium reports "Chromium <ver>" from --version, indistinguishable
+ // from vanilla Chromium, so there is no product string to gate identity on.
+ // Say so plainly rather than implying the binary was verified to be CloakBrowser.
return browsers.DoctorCheckResult{
Status: browsers.DoctorPass,
- Detail: fmt.Sprintf("%s -> %s (>= %s)", found, token, cloakMinVersion),
+ Detail: fmt.Sprintf("%s -> %s (>= %s); trusted from browser.binary without CloakBrowser identity check", found, token, cloakMinVersion),
}
}