Skip to content

fix: do not send global token to a local URL - #1

Closed
briskt wants to merge 1 commit into
rtcoder:mainfrom
briskt:protect-global-token
Closed

briskt wants to merge 1 commit into
rtcoder:mainfrom
briskt:protect-global-token

Conversation

@briskt

@briskt briskt commented Oct 19, 2026

Copy link
Copy Markdown

I asked Claude Code to run a quick security audit after I cloned ytrack, and this was the only one it labeled as "High".

A repo-local .ytrack/config.json could set a different url while inheriting the global token, so running ytrack inside an untrusted clone sent the user's token to an arbitrary server. The global token is now only used when the effective URL matches the global URL; a different local URL requires a local token.

FYI, here are the other findings:

Medium

  1. No HTTPS enforcement (client.go:245, set-url). An http:// URL is accepted, and the bearer token then goes over plaintext. This includes a typo'd or attacker-supplied local URL (see fix: do not send global token to a local URL #1). Fix: reject non-https URLs, except perhaps localhost, unless the user passes an explicit --insecure.

  2. Tokens passed as command-line arguments (set-token , global set-token , shown in the README and Pages docs). The token lands in shell history and is briefly visible in ps to other local users. init already reads it from stdin; set-token should do the same (prompt with echo off, or accept - for stdin).

  3. Script injection in update-homebrew-tap.yml. inputs.version flows into steps.checksum.outputs.version and is then expanded as ${{ … }} directly inside a run: block. A crafted version string runs shell code in a job that holds HOMEBREW_TAP_TOKEN. The same unvalidated version is written into the Ruby formula heredoc, so it could also inject Ruby into the tap. Only people with write access can trigger it, which limits the risk. Fix: pass values via env: and validate against ^[0-9]+\.[0-9]+\.[0-9]+$.

Low / hardening

  1. Tap token is broader than needed. HOMEBREW_TAP_TOKEN is set at job level in release.yml and workflow level in update-homebrew-tap.yml, so every step can see it, including third-party actions. Scope it to the one step that uses it. It's also embedded in the git clone URL and persists in .git/config on the runner; that runner is temporary, so the exposure is small.
  2. Third-party actions are pinned to tags (@v6), not commit SHAs. A compromised action tag could tamper with release builds or read contents: write / id-token permissions. Pin to SHAs.
  3. http.DefaultClient has no timeout, and io.ReadAll has no size limit (client.go:249, 623). A hostile or broken server can make the CLI hang or use unbounded memory.
  4. Server-provided text is printed as-is to the terminal (issue titles, descriptions, and API error bodies via formatAPIError). Anyone who can edit an issue can embed ANSI/OSC escape sequences that spoof terminal output. Strip control characters before printing.
  5. init writes the token into ./.ytrack/config.json and only prints a hint to gitignore it. Users can easily commit a token by mistake. Consider writing the .gitignore entry automatically, or keeping the token global by default.
  6. YouTrack query injection in buildIssueQuery (client.go:661): filter values are concatenated inside {…}. These are the user's own arguments, so there's no privilege gain, just odd queries.

A repo-local .ytrack/config.json could set a different url while
inheriting the global token, so running ytrack inside an untrusted
clone sent the user's token to an arbitrary server. The global token
is now only used when the effective URL matches the global URL; a
different local URL requires a local token.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@briskt briskt closed this Nov 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant