Skip to content

fix(chat): reject path-escaping session keys - #126

Draft
cursor[bot] wants to merge 3 commits into
mainfrom
cursor/critical-bug-investigation-e7a0
Draft

fix(chat): reject path-escaping session keys#126
cursor[bot] wants to merge 3 commits into
mainfrom
cursor/critical-bug-investigation-e7a0

Conversation

@cursor

@cursor cursor Bot commented Jul 28, 2026

Copy link
Copy Markdown

Summary

  • Fixes a critical path escape where attacker-controlled session_key values were joined into transcript/plan paths. Absolute keys (e.g. /tmp/evil) replace the chat root via Path::join, and ../ keys escape it.
  • Adds shared validate_session_key / session_file_under_dir, hardens transcript/plan builders, and fail-closes CLI chat/clear-session, agent-rpc, schedule tick, and executor RPC entry points.
  • Adds regression tests proving absolute/traversal keys are rejected before any write outside chat/transcripts or chat/plans.

Bug Impact

  • Data write/read outside the chat data root (arbitrary file create/append under process permissions).
  • Concrete triggers: skilllite chat / clear-session --session-key '/tmp/…', agent-rpc session_key, schedule.json session_key, executor transcript/plan RPC.

Task Linkage

  • Task ID: TASK-2026-074
  • Task folder: tasks/TASK-2026-074-session-key-path-safety/

Injected Specs

  • spec/verification-integrity.md
  • spec/task-artifact-language.md
  • spec/security-nonnegotiables.md
  • spec/rust-conventions.md
  • spec/testing-policy.md
  • spec/docs-sync.md (N/A: no documented session-key path grammar; fail-closed validation only)

Validation Evidence

  • cargo fmt --all -- --check
  • cargo test -p skilllite-core path_validation → 3 passed
  • cargo test -p skilllite-executor --lib → 9 passed
  • cargo test -p skilllite-agent --lib → 247 passed
  • cargo clippy -p skilllite-core -p skilllite-executor -p skilllite-agent --all-targets -- -D warnings → clean
  • cargo check -p skilllite-commands → compiles (pre-existing dead_code warning unrelated)
  • python3 scripts/validate_tasks.py → passed

Regression Scope

Security Review Notes

  • What security policy changed, and why is it needed? Session keys must be single-segment before filesystem join.
  • Is default behavior more permissive? No — fail-closed.
  • Does this affect SKILLLITE_* config semantics? No.
  • Were tests and EN/ZH docs updated? Tests yes; docs N/A as above.
Open in Web View Automation 

cursoragent and others added 3 commits July 28, 2026 11:09
Absolute and traversal session_key values could escape chat/transcripts
and chat/plans via Path::join. Validate keys as a single safe segment
before joining and add regression coverage.

Co-authored-by: EXboy <EXboys@users.noreply.github.com>
Fail closed before chat/clear-session/agent-rpc/schedule use a session
key for transcript or plan filesystem operations.

Co-authored-by: EXboy <EXboys@users.noreply.github.com>
Co-authored-by: EXboy <EXboys@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant