baphuongna/pi-crew/ownership-session-security
Claude Code and agent skill by baphuongna/pi-crew
Trust tier 3
- community
Source check pending
Checking that the SKILL.md file is still in the repository.
Session ownership and authorization workflow. When NOT to use: general session lifecycle questions (use live-agent-lifecycle); for non-session auth issues.
Install
npx vskill@latest install baphuongna/pi-crew/ownership-session-securitySKILL.md
ownership-session-security
Use this skill for cross-session safety and trust-boundary work.
Source patterns distilled
- Pi session IDs:
ctx.sessionManager.getSessionId()from Pi coreExtensionContext - pi-crew ownership:
TeamRunManifest.ownerSessionId,src/extension/team-tool/run.ts,cancel.ts,respond.ts - Path safety:
src/utils/safe-paths.ts,src/state/state-store.ts,src/state/mailbox.ts - Destructive actions:
src/extension/team-tool/lifecycle-actions.ts,src/worktree/cleanup.ts
Rules
- Propagate the active Pi session ID into
TeamContextfor every production tool/command path. - New runs should record
ownerSessionIdwhen available. - For owned runs, cross-session actions that mutate state must be rejected unless explicit force/admin semantics are designed and tested.
- Legacy runs without
ownerSessionIdmay remain permissive for backward compatibility, but document this behavior. - User/LLM-controlled path fields (
cwd, import paths, artifact paths, task IDs) must be normalized and contained under an allowed base. - Use
resolveContainedPath,resolveRealContainedPath,assertSafePathId, and symlink checks rather than ad-hocstartsWithchecks. - Destructive management actions must require
confirm: true; referenced resource deletes must requireforce: truewhere applicable.
Enforcement — Ownership Session Security Gate
Before mutating run state or cross-session operations, verify:
- [ ] Session ID propagated into TeamContext for production paths
- [ ] ownerSessionId verified before respond/cancel/mutate operations
- [ ] Path fields (cwd, import, artifact) normalized and contained under allowed base
- [ ] Safe path helpers used (resolveContainedPath, assertSafePathId) not startsWith checks
- [ ] Destructive actions require explicit confirm/force parameters
If ANY answer is NO → Stop. Verify ownership before mutating state.
Anti-patterns
- Assuming
ctx.sessionIdexists directly on Pi context. - Letting
cwd: ../other-projectmove run state into another project. - Letting
respond/cancelmutate a foreign owned run. - Trusting task IDs, run IDs, or artifact paths from tool params without validation.
Verification
Security
- Security scanPassed, 90 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/ownership-session-security/SKILL.md
Popularity
- 7-day trend score
- 5
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/baphuongna/pi-crew/ownership-session-security)