fix(setup): check cloudflared binary and validate tunnel token (#424)

* fix(setup): check cloudflared binary and validate tunnel token (#418)

The Cloudflare tunnel setup accepted tokens blindly without checking if
cloudflared was installed or if the token was valid. Now:

- Checks for cloudflared on PATH before accepting a token, with install
  instructions if missing (user can continue anyway)
- Validates token format (base64-decoded JSON with account/tunnel fields)
  with a warning if malformed (user can override)
- Replaces misleading "will start automatically at boot" with honest
  instructions for starting the tunnel and installing as a service
- Reuses binary_exists() from skills::gating (promoted to pub(crate))
  for cross-platform PATH lookup

Closes #418

Co-Authored-By: Claude Opus 4.6 <[email protected]>

* fix: reuse cloudflared_found instead of redundant binary_exists call

Address review feedback: the binary check result was already stored
in cloudflared_found from earlier in the function.

Co-Authored-By: Claude Opus 4.6 <[email protected]>

---------

Co-authored-by: Claude Opus 4.6 <[email protected]>
This commit is contained in:
Zaki Manian
2026-03-01 08:31:43 +00:00
committed by GitHub
co-authored by Claude Opus 4.6
parent e794f39726
commit 914f3cd075
2 changed files with 99 additions and 3 deletions
+1 -1
View File
@@ -75,7 +75,7 @@ pub fn check_requirements_sync(requirements: &GatingRequirements) -> GatingResul
}
/// Check if a binary exists on PATH using `std::process::Command`.
fn binary_exists(name: &str) -> bool {
pub(crate) fn binary_exists(name: &str) -> bool {
#[cfg(unix)]
{
std::process::Command::new("which")