[codex] Fix slide deck MCP export provenance#19
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c9f1f3674a
ℹ️ 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".
| const absoluteReceiptPath = `${outputTarget.absolutePath}.receipt.json`; | ||
| const receiptPath = `${outputTarget.relativePath}.receipt.json`; | ||
|
|
||
| await fsp.writeFile(absoluteReceiptPath, `${JSON.stringify(receipt, null, 2)}\n`, "utf8"); |
There was a problem hiding this comment.
Refuse symlinked receipt paths
When a workspace already contains outputs/judgmentkit-slide-decks/<deck>.pptx.receipt.json as a symlink, this unguarded writeFile follows the symlink. prepareSlideDeckOutputTarget() only rejects symlinks at the PPTX path, so a successful export can overwrite a writable file outside the allowed output directory while still reporting a valid receipt. Apply the same lstat/no-symlink protection to the sidecar receipt path before writing it.
Useful? React with 👍 / 👎.
| root.includes(`${path.sep}.codex${path.sep}`) || | ||
| root.includes(`${path.sep}.cache${path.sep}codex-runtimes${path.sep}`) |
There was a problem hiding this comment.
Treat the .codex root itself as unsafe
If the MCP process is launched with process.cwd() set exactly to a .codex directory, this predicate returns false because it only matches paths containing /.codex/ with a trailing separator. In that context resolveSlideDeckWorkspaceRoot() accepts .codex as the implicit workspace and writes outputs/... under it instead of failing with workspace_root_missing, which contradicts the new path contract for unsafe implicit roots. Add exact directory-name checks for .codex and the runtime-cache root before accepting the cwd.
Useful? React with 👍 / 👎.
Summary
Fixes the agent-facing
create_slide_deckpath so exported PPTX artifacts are tied to an explicit workspace root and a verifiable JudgmentKit provenance receipt.What changed
runtime.workspace_rootto the MCP schema and resolves repo-relativeoutput.pathagainst explicit/configured workspace roots instead of blindly usingprocess.cwd()./var/task,.codex, and Codex runtime cache paths.planned,export_attempted,export_failed, andexported.Root cause
create_slide_deckrequired repo-relative output paths but resolved them against the MCP process cwd. In hosted/runtime contexts that could become/var/task, so a valid relative path could still target the wrong filesystem root. The tool also lacked a receipt strong enough for agents to distinguish MCP-generated decks from manually generated files saved under the same output folder.Validation
node tests/mcp.test.mjsnode tests/mcp-stdio.test.mjsnode tests/mcp-http.test.mjsnode tests/codex-plugin.test.mjsnpm run mcp:smokenpm test