Skip to content

feat: show the receiving command in the Touch ID dialog - #29

Merged
tashian merged 13 commits into
mainfrom
feat/touchid-command-context
Oct 9, 2026
Merged

tashian merged 13 commits into
mainfrom
feat/touchid-command-context

Conversation

@tashian

@tashian tashian commented Oct 9, 2026

Copy link
Copy Markdown
Owner

Summary

The Touch ID dialog now shows the command that receives the secret. Before this change, the dialog said only "Access secret 'gh-pat'" or "Unlock tsm vault". The user could not see what the secret was for.

tsmd is trying to unlock the vault and access 'gh-pat':

tsm get gh-pat | curl -sH @- https://api.github.com/user.

The daemon gets the command from the kernel. It does not use text that the client sends.

Changes

Daemon (tsmd)

  • ProcessReader.swift: reads the argv, environment, parent, working directory, and executable path of a process (KERN_PROCARGS2, proc_pidinfo, proc_pidpath).
  • PeerCommand.swift, TsmArgv.swift: find the command and the secret names for each connection.
    • tsm run: the command after --. If the program is not in a system or Homebrew directory, the dialog shows its full path.
    • tsm get: the command of the nearest parent shell that runs -c. The daemon goes up through node and bun, because the npm package starts tsm from them.
    • Other parents (python3 -c …, bash x.sh): the command of that parent.
    • The daemon identifies each process by its executable path, not by argv[0].
  • ShellCommand.swift: removes the Claude Code Bash tool wrapper (source … && eval '<command>' < /dev/null && pwd -P >| …). It does this only when the full string matches the wrapper. In all other cases, the dialog shows the full -c string.
  • CommandText.swift: removes control and format characters (including bidirectional overrides), changes line breaks and separators to spaces, adds shell quotes, and cuts long commands in the middle at 300 characters.
  • DialogReason.swift: makes the dialog text.
  • ApprovalSet.swift: one dialog covers all confirm-gated secrets of one tsm run. Approvals last only as long as the connection. A dialog that the user cancels approves nothing.
  • Audit log: the new field command replaces client_id. The log keeps the full command; only the dialog text is cut.

CLI (tsm)

  • The CLI does not send client_id.
  • tsm log shows the command.

Docs

  • SKILL.md: tells the agent that the dialog shows its command.
  • AGENTS.md: tells agents where the dialog text comes from.

Limits

  • The dialog shows the command line, not what the command does. A shell function, an alias, or BASH_ENV can make gh pr list run a different program.
  • A copy of another program with the name tsm passes the identity check. Issue Code-signed peer verification #2 (code-signed peer verification) covers this.
  • Every new build of tsmd causes a Keychain password prompt, because ad-hoc signatures change with each build. This was also true before this change. Developer ID signing will fix it.

Test plan

  • just test: 220 Swift tests (3 Keychain tests skipped, the same as on main), and all Go tests pass.
  • A full-branch review found 2 critical and 6 important problems. All are fixed, and each fix has a test that failed first.
  • Real Touch ID check: the unlock dialog and the confirm-gated dialog showed the correct command, and tsm log recorded it.

@tashian
tashian merged commit 857e59b into main Oct 9, 2026
1 check passed
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