Skip to content

fix: use AbsolutePathBuf for permission profile file roots - #12970

Merged
bolinfest merged 1 commit into
mainfrom
pr12970
Feb 27, 2026
Merged

bolinfest merged 1 commit into
mainfrom
pr12970

Conversation

@bolinfest

@bolinfest bolinfest commented Feb 27, 2026 •

Copy link
Copy Markdown
Collaborator

Why

PermissionProfile should describe filesystem roots as absolute paths at the type level. Using PathBuf in FileSystemPermissions made the shared type too permissive and blurred together three different deserialization cases:

  • skill metadata in agents/openai.yaml, where relative paths should resolve against the skill directory
  • app-server API payloads, where callers should have to send absolute paths
  • local tool-call payloads for commands like shell_command and exec_command, where additional_permissions.file_system may legitimately be relative to the command workdir

This change tightens the shared model without regressing the existing local command flow.

What Changed

  • changed protocol::models::FileSystemPermissions and the app-server AdditionalFileSystemPermissions mirror to use AbsolutePathBuf
  • wrapped skill metadata deserialization in AbsolutePathBufGuard, so relative permission roots in agents/openai.yaml resolve against the containing skill directory
  • kept app-server/API deserialization strict, so relative additionalPermissions.fileSystem.* paths are rejected at the boundary
  • restored cwd/workdir-relative deserialization for local tool-call payloads by parsing shell, shell_command, and exec_command arguments under an AbsolutePathBufGuard rooted at the resolved command working directory
  • simplified runtime additional-permission normalization so it only canonicalizes and deduplicates absolute roots instead of trying to recover relative ones later
  • updated the app-server schema fixtures, app-server/README.md, and the affected transport/TUI tests to match the final behavior

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

Copy link
Copy Markdown
Contributor

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: 554fd38785

ℹ️ 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 100 to 103
pub(crate) fn normalize_additional_permissions(
additional_permissions: PermissionProfile,
command_cwd: &Path,
) -> Result<PermissionProfile, String> {
let Some(file_system) = additional_permissions.file_system else {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P1 Badge Preserve cwd-relative additional permission paths

This change drops command_cwd from additional-permission normalization and switches the path list to AbsolutePathBuf, but shell/unified-exec tool arguments are still parsed via plain serde_json::from_str (without an AbsolutePathBufGuard). In that flow, relative additional_permissions.file_system entries such as "./output" now fail deserialization (AbsolutePathBuf deserialized without a base path) before the approval flow runs, whereas previously they were resolved against the command cwd. This breaks existing with_additional_permissions requests that rely on relative paths.

Useful? React with 👍 / 👎.

@bolinfest
bolinfest enabled auto-merge (squash) February 27, 2026 17:00
@bolinfest
bolinfest force-pushed the pr12970 branch 2 times, most recently from 6bbf5b2 to 7c5be39 Compare February 27, 2026 17:11
@bolinfest
bolinfest merged commit d09a753 into main Feb 27, 2026
70 of 78 checks passed
@bolinfest
bolinfest deleted the pr12970 branch February 27, 2026 17:42
@github-actions github-actions Bot locked and limited conversation to collaborators Feb 27, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants