Skip to content

fix(permissions): scope external path approval per call#978

Merged
XingYu-Zhong merged 1 commit into
developfrom
codex/replace-887-external-path-approval
Jul 19, 2026
Merged

fix(permissions): scope external path approval per call#978
XingYu-Zhong merged 1 commit into
developfrom
codex/replace-887-external-path-approval

Conversation

@XingYu-Zhong

@XingYu-Zhong XingYu-Zhong commented Jul 18, 2026

Copy link
Copy Markdown
Collaborator

Summary

Changes

  • Opts only the write and edit tools into exact per-call external-path approval.
  • Resolves and records the approved physical file identity, strips caller-supplied grants, and mints the grant inside the host.
  • Revalidates the approved single-link inode with a no-follow file handle and performs the mutation through that same handle.
  • Fails closed for external file creation, where Node does not expose a portable parent-directory openat primitive.
  • Rejects sibling-prefix, symlink, hard-link alias, casing, and approval-to-mutation path swaps.
  • Normalizes trailing path separators with a linear scan, including adversarial repeated-separator coverage.

This protects the approval workflow from path redirection; it is not an OS-level lock against a hostile same-user process racing the final system call.

Tests

  • Focused permission/path tests (89 passed).
  • Full Kun suite (2158 passed, 1 skipped).
  • Kun and root typecheck/build, ESLint, and git diff --check.

Original contribution and problem analysis: @luoye520ww in #887.

Replaces #887.

Comment thread kun/src/adapters/tool/workspace-path.ts Fixed
@XingYu-Zhong
XingYu-Zhong force-pushed the codex/replace-887-external-path-approval branch from 523f320 to 6762769 Compare July 19, 2026 05:00
@XingYu-Zhong
XingYu-Zhong marked this pull request as ready for review July 19, 2026 05:01

@github-actions github-actions 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.

PR checks failed. Please fix the failing CI jobs before merging.

Failed jobs:

  • Ad-hoc macOS packaged validation (PR)

Run details: https://github.com/KunAgent/Kun/actions/runs/29674204821

@XingYu-Zhong
XingYu-Zhong dismissed github-actions[bot]’s stale review July 19, 2026 06:04

Transient macOS packaged-extension guest-target timeout; the failed job was rerun in isolation and the complete workflow passed on the same PR head.

@XingYu-Zhong
XingYu-Zhong merged commit 9f00a17 into develop Jul 19, 2026
14 of 21 checks passed
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.

2 participants