Skip to content

Hook rewrite coverage: openssl and awk unmapped; sshpass unusable as a transparent prefix #4190

Open

Description

@lingeswaranmca

Version: rtk 0.49.0 (latest release at time of filing), macOS 27.0.0 / arm64, Claude Code PreToolUse hook (rtk hook claude).

What I measured

I swept 41 commands I actually use through rtk hook check to find out where the hook stops rewriting. 30 of 41 were rewritten. Compound handling is good — each recognised segment is rewritten independently across pipes, &&, ;, redirections, a cd prefix, and lines containing a for loop — so this report is only about unmapped commands, not compound parsing.

Before filing I searched open issues for each unmapped command. Most are already tracked, and I have listed those at the bottom rather than duplicating them. Three things appear to be unreported.

1. openssl — no rewrite

$ rtk hook check 'openssl x509 -in cert.pem -noout -text'
No rewrite for: openssl x509 -in cert.pem -noout -text

openssl x509 -text on a single certificate is ~60 lines, most of it a hex modulus dump. The useful fields are subject, issuer, validity dates and SANs. s_client -connect is similarly noisy around a handful of decisive lines. This looks like a good fit for a filter: the output has a fixed, parseable shape.

I found no open issue proposing an openssl wrapper (the single search hit, #1169, is unrelated).

2. awk — no rewrite

$ rtk hook check "awk '{print \$1}' file.txt"
No rewrite for: awk '{print $1}' file.txt

sed is already requested in #1511 and #4111, but I could not find any issue covering awk. It is the same class of command and a common partner to sed in agent-written shell. I appreciate this is harder than a fixed-format tool, since the output shape is whatever the program prints — feel free to close as out of scope if arbitrary interpreters are deliberately excluded. Filing it so the decision is recorded somewhere.

3. sshpass cannot be used as a transparent prefix

transparent_prefixes works well — I set ["time", "env", "nohup"] and all three became see-through:

$ rtk hook check 'time git status'
time rtk git status

But it only matches a bare prefix word, so a prefix that takes its own flags is not reachable:

$ rtk hook check 'sshpass -p pw ssh host git status'
No rewrite for: sshpass -p pw ssh host git status

ssh host git status on its own rewrites fine. sshpass -p <pass> ssh ... is the standard non-interactive form for password-based SSH, so on any host that is not key-based, every remote command silently loses filtering. Supporting prefixes that consume their own arguments would fix this class generally.

A hazard for #146 (sudo prefix support)

Related, and worth recording before that feature lands: I tried adding sudo to transparent_prefixes locally. It works as designed —

$ rtk hook check 'sudo git status'
sudo rtk git status

— but that command then fails to execute on my machine. rtk is installed at ~/.local/bin/rtk, which is not on root's PATH, so sudo rtk git status is command not found. I removed sudo from the list for that reason.

So sudo prefix support probably needs to resolve rtk to an absolute path when it rewrites behind sudo, rather than emitting the bare name. Same consideration applies to any prefix that changes the PATH the rewritten command resolves against.

Already tracked — not duplicating

For completeness, these were also unmapped in my sweep and already have open issues:

Command Existing issue(s)
npm test, npm ci #1204, #2926, #2073
yarn install #998, #2921
python3 #928, #2785, #3732
node #1802, #3732, #4112
sed #1511, #4111
docker compose #2991, #3652, #3653
journalctl #1819, #2259, #3080
sudo prefix #146, #4099

One doc note

filters.toml points to the custom-filters docs, and I initially assumed a match_command entry could extend hook coverage myself. It cannot — I added a filter matching ^sed\b and rtk hook check 'sed -n 1,20p README.md' still reported no rewrite, and it did not apply under rtk proxy either. Custom filters appear to shape the output of commands rtk already wraps, not to add new ones. Saying so in the custom-filters section would save people the experiment.

Activity

  1. added
    enhancement
    help wanted
    on Sep 22, 2026
  2. rtk-wshm-sync-bot commented on Sep 22, 2026

    @rtk-wshm-sync-bot

    wshm · Automated triage by AI

    🔍 Automated Triage

    ✨ Category feature
    🟡 Priority medium
    🎯 Confidence 72%

    Summary

    Requests rewrite/filter coverage for openssl and awk, a generalized transparent_prefixes mechanism for flagged prefixes (sshpass -p), a PATH-resolution hazard note for future sudo support (#146), and a docs clarification for filters.toml/custom-filters.

    📁 Relevant files
    • docs/custom-filters.md
    • filters.toml

    Suggested Actions

    1. Add an openssl x509/s_client output filter (subject/issuer/validity/SANs), similar in spirit to rtk read: add a line-range option so sed -n range reads stop escaping the filter #4111
    2. Decide awk scope (fixed-format filter vs. arbitrary interpreter) and record the call, possibly as wontfix
    3. Generalize transparent_prefixes to match flagged prefixes like sshpass -p ...; this also unblocks Feature Request: Add sudo prefix support for command rewriting #146's sudo work
    4. Cross-link the sudo PATH-resolution hazard (bare rtk not on root's PATH) into Feature Request: Add sudo prefix support for command rewriting #146 before that feature lands

    Triaged automatically by wshm · This is an automated analysis, not a human review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:clienhancementhelp wantedpriority:medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions