Repository navigation
feat: show the receiving command in the Touch ID dialog - #29
Merged
Merged
Conversation
…lace of client_id
…ions that take values
… drop invalid names
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
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.
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 throughnodeandbun, because the npm package startstsmfrom them.python3 -c …,bash x.sh): the command of that parent.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-cstring.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 onetsm run. Approvals last only as long as the connection. A dialog that the user cancels approves nothing.commandreplacesclient_id. The log keeps the full command; only the dialog text is cut.CLI (
tsm)client_id.tsm logshows 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
BASH_ENVcan makegh pr listrun a different program.tsmpasses the identity check. Issue Code-signed peer verification #2 (code-signed peer verification) covers this.tsmdcauses 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 onmain), and all Go tests pass.tsm logrecorded it.