Repository navigation
revert: roll back workspace trust-boundary hardening - #4013
Conversation
Roll back the hardening added in #3964 that guarded against malicious content inside an already-trusted repository: - background git invocations no longer override repo-local git config (fsmonitor, hooksPath, filters, drivers, gpg, editor) - agent file tools no longer re-resolve paths through symlinks - project-local local.toml applies without workspace-trust gating, additional_dir entries are no longer rejected for resolving to the home directory or filesystem root, and writing it is auto-approved again inside a git worktree Kept, since they only affect the pre-trust window or the trust prompt itself: the fail-closed trust prompt and lazy footer git detection.
🦋 Changeset detectedLatest commit: 4bb9061 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
@codex review |
|
Codex Review: Didn't find any major issues. Keep them coming! Reviewed commit: ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback". |
Signed-off-by: 7Sageer <[email protected]>
commit: |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4bb9061406
ℹ️ 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".
| "@moonshot-ai/kimi-code": patch | ||
| --- | ||
|
|
||
| Roll back some of the overly defensive changes in 2.1.0 |
There was a problem hiding this comment.
Describe the restored behavior in the changeset
Replace this vague sentence with the concrete user-visible behavior being restored, such as allowing file tools to follow external symlink targets, honoring repository Git configuration, and applying project-local additional_dir entries without extra approval. As written, the generated release notes only say that “some” changes were rolled back and do not tell users what changed, contrary to the repository requirement that changesets state the change in one short user-facing sentence.
AGENTS.md reference: AGENTS.md:L85-L86
Useful? React with 👍 / 👎.
…tch docs Follows upstream 929403b (MoonshotAI#4013, revert of MoonshotAI#3964): background git invocations no longer override repo-local git config (utils/git/git-args.ts deleted), the codebase scanner and git-status cache drop the config-args wiring, and the hardening-assertion tests are removed. The fail-closed trust prompt and lazy footer git detection stay, matching upstream. The Rust-side half was never committed (the MoonshotAI#3964 port lived only in the working tree), so nothing to revert there; the local.toml feature itself stays ungated. Residual divergence (resolve_for_write realpath vs lexical) is recorded in ROADMAP §6.8.1. Docs for the watch-default-on flip (MoonshotAI#4015) are taken byte-identical from be7d5f5 (2.1.1 final): [watch] enabled defaults to on, KIMI_CODE_WATCH override documented — the code half remains unported (tracked, ROADMAP §6.8.2); the fork has no watcher subsystem and /reload stays explicit. ROADMAP §6.8 records the full 2.1.0..2.1.1 triage; check-upstream-v2-delta reports all deltas triaged.
/add-dir gains a "remember" choice: the picked directory is written to
the project's .kimi-code/local.toml (workspace.additional_dir) and every
later session of that checkout starts with it in scope.
Both hosts implement the same rules with mirrored tests: the TS side
(packages/node-sdk/src/project-local-config.ts, FileProjectLocalConfig
port) locates the project root by walking up to .git, validates and
dedupes additional_dir entries, and merges trusted project roots into
session additionalDirs at create/resume; the Rust side
(project_local_config.rs) serves the standalone server / web UI / VS
Code path, folding the project roots into spec.extra_roots. The prompt
builder's ${additional_dirs_section} now reflects the merged list, and
the session transcript snapshot reports the task set instead of an
empty placeholder.
Writing local.toml follows the reverted trust-boundary policy (upstream
MoonshotAI#4013): no trust gating on the file itself, and the tests cover the
untrusted-project and session-only-directory edges.
Step 10 of the incremental sync to 2.1.1: 4 upstream commits over 59 files. The step rolls back the 2.1.0 trust-boundary hardening and turns the filesystem watchers back on by default. Upstream's changes in this step, all absorbed: - roll back the workspace trust-boundary hardening (MoonshotAI#4013): background git invocations no longer override repo-local git config, agent file tools no longer re-resolve paths through symlinks, and project-local local.toml applies without trust gating again - turn filesystem watch back on by default (MoonshotAI#4015) - sync the 2.1.0 changelog into the release notes (MoonshotAI#4006) - release packages (MoonshotAI#4016) Fork behaviour that had to survive: - the fork's node-local → host rename: the test files the revert touches keep importing `#/os/backends/host/...` - the fork's inline media reading: the ReadTool-based symlink-escape test goes away with the guard it covered, and the retired ReadMediaFileTool stays retired - the fork's i18n: the revert restores no user-facing strings, so no new locale keys are needed - the fork's Windows-safe test cleanup and its own workspace and alias test additions stay in place Verified: typecheck clean across every package and app; full suite 17764 passed / 0 failed / 81 skipped / 1 todo, plus kimi-inspect's own 115 tests; lint 0 errors.
Requirement or Bug
Revert the workspace trust-boundary hardening from #3964: once a user trusts a repository, content inside it is the user's own responsibility — we no longer harden against it.
Bug Reproduction Steps
N/A
Root Cause
N/A
Code Changes
Rolled back (all post-trust hardening):
Kept (only affects the pre-trust window or the trust prompt itself):
kimi-tui.ts: a failed trust-info read is treated as untrusted and still promptsgit-status.ts: footer git repo detection stays deferred to the first renderDocs: removed the
local.tomltrust-gating and broad-dir-rejection sentences fromdocs/{en,zh}/configuration/config-files.md.Changeset:
.changeset/revert-trust-boundary-hardening.md(@moonshot-ai/kimi-codepatch).Impact Scope
packages/agent-core-v2: git service, file tools, permission policy, workspace dirs, project-local config, tower protocol gitapps/kimi-code: footer git status, codebase upload scannerpnpm typecheckgreen,pnpm lint0 errors, affected vitest files pass)Checklist
/approve). — N/A, internal revert; rationale above.gen-changesetsskill, or this PR needs no changeset.gen-docsskill, or this PR needs no doc update. —docs/{en,zh}/configuration/config-files.mdupdated in this PR.