claude-code-usage-bar
leeguooooo/claude-code-usage-bar
- Type
- Plugin
- Scanned
- Nov 22, 2026
- Version
- e48c2c4925f2
- Files read
- 226
This project adds a live status bar to Claude Code (and an optional macOS floating panel) that displays 5-hour and 7-day rate limits, context window usage, prompt-cache countdowns, git branch details, and current session activity. Its biggest risks are that its background auto-updater downloads and pipes an unpinned install script from GitHub's main branch into bash every 6 hours by default, and opening an untrusted extracted project folder can run repository git hooks or inject terminal control sequences.
What it can reach
- Files
- Reads and writes ~/.claude/settings.json, optional project .claude/settings.json, ~/.claude/claude-statusbar.json, ~/.claude/commands/, ~/.claude/skills/claude-statusbar/, and cache files under ~/.cache/claude-statusbar/; reads Claude session transcripts, ~/.claude.json, ~/.claude/language-progress.json, .git metadata, macOS Claude desktop usage history, and cleans stale _MEI* temp directories on macOS.
- Secrets
- Reads the user's Claude OAuth access token from ~/.claude/.credentials.json or the macOS login Keychain (Claude Code-credentials) by default to check per-model weekly limits, and reads ANTHROPIC_API_KEY and ANTHROPIC_AUTH_TOKEN from environment variables when probing custom relay balances.
- Network
- Connects in the background to api.anthropic.com for per-model OAuth usage, to pypi.org, api.github.com, github.com, and raw.githubusercontent.com every 6 hours to check for and install updates, and to any custom ANTHROPIC_BASE_URL billing endpoint when in relay mode (the exit-IP check to ipify and ipapi.is is hard-disabled in code).
- Shell commands
- Spawns background processes for its render daemon and workers, git status polling, ocs CLI queries, macOS security/lsof/launchctl or Linux systemctl service commands, cs doctor shell checks, optional claude-monitor calls, and self-upgrade commands via uv, pipx, pip, or curl piped to bash.
- System
- When cs hud is run on macOS, creates an always-on-top floating desktop window and queries on-screen window geometry via Quartz CGWindowListCopyWindowInfo to dock next to the Claude desktop app.
Findings
-
MediumBackground auto-updater pipes unpinned main-branch install.sh into bash
src/claude_statusbar/updater.py:26
Auto-upgrade is enabled by default and runs in a detached background process every 6 hours. On standalone binary installs (the primary install method in the README), auto_upgrade() invokes _run_installer(), which fetches install.sh from the mutable main branch on raw.githubusercontent.com and pipes it straight into bash before any checksum or Apple Developer ID signature verification occurs (and on Linux or download failure, install.sh lacks code-signing checks or falls back to piping web-install.sh into bash). If the GitHub repository's main branch is compromised, attackers gain unattended shell execution on installed machines within 6 hours without needing Apple signing keys.
Fix: Do not execute a remote shell script from main during unattended background upgrades; perform asset download, SHA-256 verification, and codesign/spctl checks directly inside the updater binary, or disable unattended binary upgrades by default.
-
MediumBackground git status polling can execute core.fsmonitor in untrusted archives
src/claude_statusbar/_git_refresh.py:94
Because show_project_branch is enabled by default, rendering the status bar automatically spawns a background git status check in the current workspace directory. Unlike git clone, extracting a downloaded zip or tar archive preserves any .git/config inside it under the current user's ownership (bypassing Git's safe.directory check). Because git status is invoked without disabling core.fsmonitor, simply opening Claude Code inside an extracted untrusted archive (or entering it with cs in a shell/tmux prompt) will execute any shell command configured in that archive's core.fsmonitor setting.
Fix: Add '-c', 'core.fsmonitor=false' to the git command arguments in _git_refresh.py so background status checks never run repository-defined fsmonitor hooks.
-
MediumTerminal escape sequence injection via unsanitized git metadata and transcript activity
src/claude_statusbar/identity.py:63
Claude Code passes statusLine output (including OSC escape sequences) to the user's terminal. While ocs.py and scoped_usage.py reject non-printable characters, identity.py reads branch names directly from .git/HEAD as raw text (as well as worktree and directory names), and activity.py reads TodoWrite items and tool arguments from the session transcript without stripping ESC or control characters. Downstream, _display.clip_lines() treats arbitrary CSI and OSC sequences as zero-width and emits them intact every second, allowing a crafted .git/HEAD or folder name in an extracted archive—or a prompt-injected todo item—to overwrite the user's clipboard via OSC 52 or spoof clickable OSC 8 links.
Fix: Strip ASCII control characters (codes below 32 and 127, especially ESC 0x1b) from branch names, worktree names, project/directory names, model names, and transcript activity strings before rendering.
-
MediumRelay balance probe forwards API keys across HTTP redirects
src/claude_statusbar/_balance_refresh.py:49
When ANTHROPIC_BASE_URL is set to a non-Anthropic host and show_balance is enabled (on by default), _balance_refresh.py probes /v1/dashboard/billing/* and /dashboard/billing/* with the user's ANTHROPIC_API_KEY or ANTHROPIC_AUTH_TOKEN in the Authorization header. Unlike scoped_usage.py—which uses a custom NoRedirect handler—_balance_refresh.py calls urllib.request.urlopen() with Python's default redirect handler, which copies the Authorization header verbatim across cross-origin 301/302/307/308 redirects and HTTPS-to-HTTP downgrades. A custom gateway that redirects unknown dashboard URLs to an external website, SSO login provider, or plaintext HTTP page will leak the API key to that redirect target.
Fix: Use a NoRedirect(HTTPRedirectHandler) opener in _balance_refresh.py (matching scoped_usage.py) so Bearer tokens are never sent to redirect targets, and refuse non-loopback plaintext HTTP URLs.
