Overview
YesPaPa uses a two-ring architecture. The Inner Ring (TOTP gate) is fully offline and self-contained. The Outer Ring (mobile app + remote server) adds push notifications and one-tap approvals.Component Details
Shell Interceptor (intercept.sh)
The interceptor is a shell script sourced by .zshrc / .bashrc. It defines shell functions that shadow deny-listed commands. When you type rm -rf ./dist, the shell runs the wrapper function instead of the real rm.
How interception works:
Daemon (packages/core/src/daemon/)
A long-running Node.js process that:
- Listens on a Unix socket (
/tmp/yespapa.sock) for intercepted commands - Evaluates the command against rules (deny-list, allow-list, bundles)
- Prompts for TOTP code via the terminal and/or pushes to the remote server
- Validates TOTP codes locally (never trusts the remote server)
- Checks grace periods (HMAC-validated auto-bypasses)
- Responds with approve/deny to the interceptor
~/.yespapa/yespapa.db). This is the source of truth. The remote server is a relay, not an authority.
Remote Server (optional)
The remote server relays commands between the daemon and the mobile app. It:- Stores pending commands in a
commandstable - Uses Realtime (WebSocket) to push updates to the daemon
- Sends push notifications to the mobile app via Expo Push
- Stores grace period records for cross-device sync
Mobile App (packages/mobile/)
A React Native + Expo app that:
- Pairs with hosts via QR code scan
- Displays intercepted commands in a queue
- Generates and submits TOTP codes automatically when you tap “Approve”
- Sends push notifications when new commands arrive
- Manages grace periods (activate/revoke auto-bypasses)
Data Flow: Command Approval
Security Model
| Threat | Mitigation |
|---|---|
| Agent removes interceptors | Heartbeat re-injects every 30s |
| Agent uninstalls YesPaPa | Uninstall requires TOTP/master key |
| Compromised remote server | TOTP validated locally; server cannot forge approvals |
| Forged grace token | HMAC-signed with TOTP seed; seed never leaves the machine |
| TOTP brute force | 3 attempts per command, then 30s cooldown |
| Agent reads TOTP seed | Seed encrypted with AES-256-GCM, key derived from master password via Argon2 |