Security fixes, bug fixes, and native macOS fallback toolkit#2
Open
Ginkgo-AI wants to merge 1 commit intodisler:mainfrom
Open
Security fixes, bug fixes, and native macOS fallback toolkit#2Ginkgo-AI wants to merge 1 commit intodisler:mainfrom
Ginkgo-AI wants to merge 1 commit intodisler:mainfrom
Conversation
Security:
- Add X-API-Key auth to all listen server endpoints (LISTEN_API_KEY env var)
- Bind server to 127.0.0.1 by default instead of 0.0.0.0
- Validate job_id with strict ^[0-9a-f]{8}$ regex + path traversal check
- Inject ANTHROPIC_API_KEY via tmux setenv instead of embedding in command string
- Use tempfile.mkstemp (O_EXCL, 0o600) for secure temp file creation
- Fix AppleScript injection in tmux.py and worker.py via temp shell script approach
- Pass prompt via YAML instead of argv (prevents ps aux exposure)
Bug fixes:
- Fix NameError: anthropic_key referenced before assignment in worker.py
- Add 1-hour job timeout to _wait_for_sentinel (was infinite loop)
- Use shutil.which("tmux") instead of hardcoded /opt/homebrew/bin/tmux
- Add fcntl file locking to all job YAML reads/writes
- Fix force-cast crash: axVal uses as? instead of as! in AccessibilityTree.swift
- Fix incomplete JSON escaping in Clipboard.swift, Type.swift, Hotkey.swift
- Add X-API-Key header to direct/client.py requests
Agent improvements:
- Document native macOS fallback toolkit in steer SKILL.md (osascript,
screencapture, pbpaste/pbcopy, curl) for when steer binary is unavailable
- Make cleanup workflow mandatory with pre-task app snapshot and confirmation update
- Add LISTEN_API_KEY to .env.sample
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR addresses several security vulnerabilities and bugs found during a code review, and adds documentation for a native macOS fallback toolkit when the
steerbinary is unavailable.Security fixes
X-API-Keyheader matchingLISTEN_API_KEYin the environment. Without this, any host on the local network could submit jobs that execute arbitrary shell commands with--dangerously-skip-permissions.127.0.0.1by default instead of0.0.0.0. SetLISTEN_HOST=0.0.0.0to override intentionally.job_idis now validated against^[0-9a-f]{8}$with an additionalis_relative_to(JOBS_DIR)check on every endpoint.ANTHROPIC_API_KEYis injected viatmux setenvinstead of embedded in the command string, so it doesn't appear incapture-paneoutput.tempfile.mkstemp()with0o600permissions replaces predictable/tmp/steer-<id>.txtpaths (eliminates TOCTOU window and world-readable files).worker.pyandtmux.pynow write commands to a temp shell script instead of embedding them in AppleScript strings, preventing injection via special characters incwdor session names.ps aux.Bug fixes
NameErrorcrash on every job —anthropic_keywas referenced beforeload_dotenvassigned it inworker.py, crashing every worker immediately._wait_for_sentinelhad no timeout; addedJOB_TIMEOUT_SECONDS = 3600./opt/homebrew/bin/tmuxwithshutil.which("tmux")(consistent withdrive).fcntl.flockfor exclusive/shared locking.axValusedas! AXValuewhich crashes on unexpected attribute types; changed toas? AXValue.Clipboard.swift,Type.swift,Hotkey.swiftonly escaped"and\n; now useJSONSerializationwhich handles all control characters per spec.direct/client.pynow sendsX-API-Keyon all requests.Agent improvements
osascript,screencapture,pbpaste/pbcopy,curl, andopenas first-class alternatives insteer/SKILL.mdfor environments where thesteerbinary is unavailable.LISTEN_API_KEYin.env.sample— documents the new required env var.Test plan
just listen) — verify it starts on127.0.0.1:7600just send "..."withoutLISTEN_API_KEYset — should get 500just send "..."with wrong key — should get 401just send "..."with correct key — job should start and completeANTHROPIC_API_KEYdoes not appear in tmux scrollback during job executionGET /job/../../../../etc/passwd— should return 400as?change🤖 Generated with Claude Code