Skip to content

stop_share cannot remove a path-mounted share, and share_port accepts unvalidated paths #55

Closed

Description

@TMHSDigital

Why it matters

share_port accepts a path and mounts the share at that path, but stop_share has no way to remove a path mount. stop_share {httpsPort: 443} runs tailscale serve --https=443 off, which targets the default / mount, so the agent can't undo a share it created except by wiping everything (serve reset, see #41). An agent left with a share it can't stop, or one that wipes all shares to stop one, is the opposite of the safety story.

path is also unvalidated: values like api (no leading slash), an empty string, or strings with spaces or ? are passed straight to --set-path=, and the resulting CLI error or surprising mount is reported generically.

Evidence

  • src/providers/cli.ts:276 adds --set-path=${opts.path} on serve.
  • src/providers/cli.ts:312-317 (serveReset) builds serve --https=<port> off with no path. The stop_share schema (src/tools/share.ts:66-74) has only httpsPort.
  • src/tools/share.ts:23-26: path: z.string().optional() with no constraints.
  • To verify against a real CLI (Weekly contract tests against the real tailscale CLI to catch output-format drift #47): whether serve --https=443 off also clears Funnel for that port. If it doesn't, the "stopped" result for a Funnel share is misleading.

Suggested approach

  • stop_share gets an optional path (default /) that maps to --set-path=<path> off.
  • Validate path with zod (for example ^/[A-Za-z0-9._~\-/]*$) and normalize trailing slashes.
  • Return before/after endpoint lists (using the structured status from share_status: return structured endpoints with an explicit public/Funnel flag #43), so the agent can confirm the share is gone and nothing else changed.
  • Tests: a share at /api and its stop round-trip, plus rejecting invalid paths.

Done when

Any share created by share_port (any path, Serve or Funnel) can be removed individually by stop_share, invalid paths are rejected at the schema, and tests cover it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugpriority: P2

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions