feat(cli): add Zsh shell integration - #349
Conversation
|
| Filename | Overview |
|---|---|
| packages/cmd/shell_init.go | Adds the command and ZLE hook, but broad secret injection, replacement of existing accept-line behavior, and bypass of Zsh aliases/functions require attention. |
| packages/cmd/shell_init_test.go | Verifies generated-script fragments but does not exercise runtime command resolution, widget coexistence, or sensitive command categories. |
| README.md | Documents setup and prefixes accurately, but does not warn that installation and other project-controlled scripts receive injected secrets. |
Reviews (1): Last reviewed commit: "feat(cli): add Zsh shell integration" | Re-trigger Greptile
| for prefix in "${_infisical_auto_run_prefixes[@]}"; do | ||
| if [[ "$command" == "$prefix" ]]; then | ||
| BUFFER="infisical run -- $BUFFER" |
There was a problem hiding this comment.
Secrets reach dependency lifecycle scripts
When a user runs npm install, pnpm install, bun install, or a Node script in an untrusted project, this unconditional rewrite launches it through infisical run, and project-controlled code inherits the injected secrets and can exfiltrate them. How this was verified: The hook routes every matching command through the run path, which overlays fetched secrets onto the launched process environment.
Context Used: Flag SSRF risks (source)
Knowledge Base Used: infisical run Secret Injection Flow
| zle .accept-line | ||
| } | ||
|
|
||
| zle -N accept-line _infisical_auto_run_accept_line |
There was a problem hiding this comment.
Existing accept-line widget is discarded
When a user already has a custom or plugin-provided accept-line widget, this registration replaces it and the wrapper delegates directly to the built-in .accept-line, causing the existing Enter-key behavior to stop running.
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
|
|
||
| for prefix in "${_infisical_auto_run_prefixes[@]}"; do | ||
| if [[ "$command" == "$prefix" ]]; then | ||
| BUFFER="infisical run -- $BUFFER" |
There was a problem hiding this comment.
Zsh command resolution is bypassed
When npm, pnpm, bun, or node is defined as a Zsh alias or function, forwarding the raw token through infisical run -- launches the PATH executable directly, causing the user's wrapper, flags, and environment setup to be silently ignored.
Knowledge Base Used: infisical run Secret Injection Flow
Description 📣
Fixes #292.
Add an opt-in
infisical shell-init zshcommand that generates an interactive Zsh hook. Once sourced witheval "$(infisical shell-init zsh)", commands beginning withnpm,pnpm,bun, ornoderun throughinfisical run --. Other commands remain unchanged.The README documents setup and the supported prefixes. No new dependencies.
Type ✨
Tests 🛠️
The unit test verifies the generated hook is interactive-only, uses the requested command prefixes, wraps the command with
infisical run --, and delegates execution back to Zsh.