@schovest/pi-sudo-helper
Sudo password helper extension for Pi coding agent
Package details
Install @schovest/pi-sudo-helper from npm and Pi will load the resources declared by the package manifest.
$ pi install npm:@schovest/pi-sudo-helper- Package
@schovest/pi-sudo-helper- Version
0.2.0- Published
- Oct 27, 2026
- Downloads
- 367/mo · 245/wk
- Author
- schovest
- License
- MIT
- Types
- extension
- Size
- 36.3 KB
- Dependencies
- 0 dependencies · 2 peers
Pi manifest JSON
{
"extensions": [
"./index.ts"
]
}Security note
Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.
README
@schovest/pi-sudo-helper
Sudo password helper for the Pi coding agent. When the
agent runs a sudo command through the bash tool, a masked password dialog pops up; the
password is injected via SUDO_ASKPASS + a FIFO in /dev/shm (tmpfs) — it never touches
disk, process arguments, or the agent's context.
Install
pi install npm:@schovest/pi-sudo-helper
Restart your Pi session.
How it works
- On every bash
tool_call, the command is scanned forsudousage - A
sudo -n trueprecheck skips the dialog while the sudo timestamp is still valid - A FIFO + askpass script are created under
/dev/shm(permissions0600/0700) - A masked password dialog takes over input; the typed password is XOR-encrypted in memory
- On submit, only the first
sudois rewritten toSUDO_ASKPASS='<script>' sudo -A; nested sudos run as root and no longer need a password, so one authentication coverssudo bash -c '…'wrapping arbitrary inner commands - Temp resources are cleaned up when the tool call finishes
Input timeout
The password dialog cancels itself automatically after 120 seconds without input, so a forgotten dialog can never block the session indefinitely. A timed-out dialog blocks the tool call with an explanatory reason (the command is not executed and left unmodified); just re-issue the command to try again.
Reactive failure hints
No standing prompt is injected. If a sudo command fails and the original command shows a
structural problem (multiple bare sudos, sudo -n probing, double-quoted
sudo bash -c "…"), the tool result gets a short hint appended — the error snippet plus a
suggestion to use sudo bash -c '<entire command>' with single quotes. Well-formed
commands that fail for their own reasons stay silent.
Security
- Never persisted — the FIFO lives on
/dev/shmtmpfs, pure RAM - Never visible to
ps//proc— the password travels through a kernel pipe, not argv or environ - Never exposed to the agent — the session records the original command; the agent only sees the command and its result
- Never a plain string in the heap — keystrokes are XOR-encrypted into a
SecureBufferwith a random per-byte key; plaintext exists only inside aBufferfor the duration of a singlewrite()and is zero-filled immediately after - Wiped after use — buffers are physically zeroed, temp files unlinked
License
MIT