Skip to content

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pi-workspace-path-guard

Persistent workspace confinement for Pi tool calls.

Why

Pi extensions and AI-invoked tools run with your user permissions. A mistaken, overly broad, or malicious tool call can therefore read sensitive files or modify data outside the project you intended Pi to work on. Filesystem paths also need canonical checking because relative paths and symlinks can escape a workspace even when the original path appears local.

Solution

This extension adds a fail-closed guard before tool execution. It canonicalizes paths, confines writes to Pi's current workspace, requires interactive approval for outside reads, rejects outside reads when approval is unavailable, and blocks AI shell commands because arbitrary shell text cannot be reliably restricted with path inspection alone. /pathguard on|off controls the guard; the setting persists across Pi sessions and defaults to on if its state file is missing or invalid.

This reduces accidental workspace escape. It is not an OS sandbox: turning it off removes these checks, and other extensions or unhandled tools may still access the system with your permissions.

Behavior

When enabled, the extension:

  • blocks AI bash tool calls
  • blocks write and edit outside the current workspace
  • asks before reads outside the workspace in interactive sessions
  • denies outside reads in non-interactive sessions
  • resolves symlinks and existing path ancestors before checking containment

The guard defaults to on when no valid saved state exists.

Install from GitHub

pi install git:github.com/nor1c/pi-workspace-path-guard

Restart Pi, or run /reload in an existing session.

To install a tagged release:

pi install git:github.com/nor1c/pi-workspace-path-guard@v1.0.0

Commands

/pathguard on
/pathguard off
/pathguard

/pathguard without an argument reports current state. State persists across sessions in:

~/.pi/agent/workspace-path-guard.json

Important

Disabling the guard permits tool activity that this extension would otherwise block. Pi extensions execute with your user permissions; review extension source before installation.

License

MIT

About

Pi package to guard read, write and edit files outside working project directory.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages