Skip to content

fix(pm-dispatch): constrain session directories for every caller - #3483

Closed
dezren39 wants to merge 1 commit into
mainfrom
queue/5418-2664-session-dir-validation
Closed

dezren39 wants to merge 1 commit into
mainfrom
queue/5418-2664-session-dir-validation

Conversation

@dezren39

@dezren39 dezren39 commented Nov 1, 2026 •

Copy link
Copy Markdown
Member

Summary

 resolve session directory
- OIDC: exact repo root only; bearer: unrestricted
+ all callers: blank → repo root; normalized absolute root/subdirectory only
+ reject relative and out-of-tree paths before any side effect

Blank/whitespace session titles now use the prompt-derived fallback. Updated the dispatch README and added resolver + HTTP regression coverage. Fixes #2664.

Evidence

  • Before: bearer paths bypassed validation; OIDC rejected valid subdirectories and blank directory/title values did not default.
    After: cd pm-stack/dispatch && bun test — 80 passed, 0 failed across 9 files; git diff --check clean.
  • bun run typecheck was attempted but unavailable in this worktree because @types/bun is not installed (tsc TS2688).

Merge Danger

Door: two-way

Blast Radius: dispatch-boundary

Only session directory/title validation changes; invalid requests fail before issue, task, or session side effects.


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.

@dezren39
dezren39 requested a review from a team as a code owner November 1, 2026 10:11
@coderabbitai

coderabbitai Bot commented Nov 1, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 45 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: ff7f58d2-853e-4a62-9284-16e22265fa76
Commits

Reviewing files that changed from the base of the PR and between 39835db and 8a9a387.

Files selected for processing: 5
  • pm-stack/dispatch/README.md
  • pm-stack/dispatch/src/server.ts
  • pm-stack/dispatch/src/validate.ts
  • pm-stack/dispatch/test/server.test.ts
  • pm-stack/dispatch/test/validate.test.ts
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 1, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-01T10:13:58.507166Z 8a9a387 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8a9a387039

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +173 to +175
const target = resolve(directory);
const fromRoot = relative(root, target);
if (fromRoot === ".." || fromRoot.startsWith(`..${sep}`) || isAbsolute(fromRoot)) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Resolve symlinks before checking directory containment

For OIDC requests, the newly accepted subdirectories can escape the configured clone through existing tracked symlinks. For example, this repository's nixpkgs symlink points to ../nixpkgs, but /home/user/git/code/nixpkgs passes this lexical containment check and is forwarded unchanged through launchSession to OpenCode's location.directory, selecting a directory outside the target clone. Previously, OIDC callers could not select this path. Canonicalize the root and requested directory using filesystem resolution, or reject escaping symlink components, before permitting side effects.

Useful? React with 👍 / 👎.

@dezren39

dezren39 commented Nov 6, 2026

Copy link
Copy Markdown
Member Author

Closing as a stale duplicate — superseded by merged PR #3507.

PR #3507 (merged 2026-11-01, merge commit 2115038) landed the same issue #2664 fix in pm-stack/dispatch: unified resolveSessionDirectory for OIDC+bearer callers and blank title/directory handling via optNonBlankString. Issue #2664 is closed.

Spot-check by queue task 10878 (issue #6428) against current main: every piece of this PR is present on main — validate.ts line 124 (optNonBlankString) and line 172 (resolveSessionDirectory), resolver and blank-parsing tests citing issue #2664, HTTP-level directory-scoping tests, and README scoping text — and main additionally carries the later issue #3999 symlink hardening this PR does not have. Nothing unique to salvage (salvage note posted on PR #3507). This PR is CONFLICTING/DIRTY against main and has been untouched since 2026-11-01; closing, not merging, per issue #6428.

@dezren39 dezren39 closed this Nov 6, 2026
@dezren39 dezren39 removed the queue/queued Has a queued task in the Supabase agent queue label Nov 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant