Repository navigation
Conversation
…kip directory search-root prompts
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
🦋 Changeset detectedLatest commit: b7bf7e9 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 |
commit: |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b7bf7e9608
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| sensitiveFileGuard: z.boolean().optional(), | ||
| gitControlPathGuard: z.boolean().optional(), |
There was a problem hiding this comment.
Serialize the new guard fields in the TOML writer
When a desktop, web, or SDK client sets either new switch through the config API (POST /api/v1/config or IConfigService.set), validation accepts the field and the current process reports it as applied, but permissionToToml only serializes rules and never writes sensitive_file_guard or git_control_path_guard. The setting is therefore silently absent from config.toml and reverts to true after restart; update the custom writer and add a persistence/reload test for both fields.
AGENTS.md reference: AGENTS.md:L117-L119
Useful? React with 👍 / 👎.
| const stat = await fs.stat(access.path).catch(() => undefined); | ||
| return stat !== undefined && stat.isDirectory ? undefined : { kind: 'ask' }; |
There was a problem hiding this comment.
Keep sensitive-name symlinks behind approval
When a sensitive search root such as .env is a symlink to a directory, stat() follows the link and this branch silently skips approval even with the guard enabled. Grep path=".env" then passes that link explicitly to ripgrep—whose --help states that explicitly supplied hidden directories are searched—and an ordinary target file such as .env/token.txt is not removed by the basename-based sensitive-result filter, so its contents can reach the model without the previous prompt. Use lstat() or otherwise exclude symlinks from the directory exemption.
AGENTS.md reference: AGENTS.md:L117-L119
Useful? React with 👍 / 👎.
… on sensitive symlinks
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 23c1a20c4c
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| # sensitive_file_guard <- KIMI_CODE_SENSITIVE_FILE_GUARD (custom parse) | ||
| # git_control_path_guard <- KIMI_CODE_GIT_CONTROL_PATH_GUARD (custom parse) |
There was a problem hiding this comment.
Document consumers of the expanded config contract
Because these additions expand config-manifest.toml, the PR description must name the relevant external consumers, such as desktop/web config clients, and explain how clients and configuration data from the previous release remain compatible. The current description only says that the manifest was regenerated, so the required cross-repository compatibility check is missing.
AGENTS.md reference: AGENTS.md:L109-L111
Useful? React with 👍 / 👎.
|
Superseded: permission guards will be unified under the single dangerous_command_guard switch instead of per-guard switches. |
Requirement or Bug
Approved requirement, two parts: (1) add per-guard config switches symmetric to
dangerous_command_guardthat can disable the sensitive-file and git-control-path approval prompts; (2) stop the false positive whereGrep path="src/features/credentials"prompts only because the search root's basename matches the sensitive-name list — real-world search roots are directories, and a directory namedcredentialsis almost always source code, not secrets.Bug Reproduction Steps
N/A (feature PR). The false positive this removes: run
Grepwithpathset to any existing directory namedcredentials(or.env,id_rsa, …) — the sensitive-file approval prompt fired even though the target is a directory.Root Cause
N/A (feature PR).
Code Changes
packages/agent-core-v2/src/agent/permissionRules/configSection.ts: addsensitive_file_guardandgit_control_path_guardkeys (defaulttrue) to the[permission]config schema, withKIMI_CODE_SENSITIVE_FILE_GUARD/KIMI_CODE_GIT_CONTROL_PATH_GUARDenv bindings andisSensitiveFileGuardEnabled/isGitControlPathGuardEnabledgetters, following the exact conventions ofdangerous_command_guard.packages/agent-core-v2/src/agent/permissionPolicy/policies/sensitive-file-access-ask.ts: inject the config service and the agent runtime; return early when the guard is disabled; when a sensitive-named access path stats as a directory, do not ask — files and unstat-able paths keep asking (fail closed).packages/agent-core-v2/src/agent/permissionPolicy/policies/git-control-path-access-ask.ts: inject the config service and return early when the guard is disabled; behavior otherwise unchanged.docs/en|zh/configuration/config-files.mddocument both new keys and env vars;packages/agent-core-v2/docs/config-manifest.tomlregenerated.Behavior Changes and Affected Users
sensitive-file-access-ask)sensitive_file_guard = falseorKIMI_CODE_SENSITIVE_FILE_GUARD=falsetrue(default)git-control-path-access-ask)git_control_path_guard = falseorKIMI_CODE_GIT_CONTROL_PATH_GUARD=falsetrue(default)Grep pathto acredentials/source dir)PATH_SENSITIVE)Affected modules:
agent-core-v2permission policy chain and permission config section.Config-contract compatibility: the two new
[permission]keys are optional and default totrue, so config files written by older releases (which never contain them) behave exactly as before; an older release reading a file that does contain them ignores the unknown keys (and preserves them on writeback), with the guards staying on. External consumers of the config surface — the CLI/TUI, the desktop/web clients, and SDK callers of the kap-server/api/v1/configAPI — only see two additional optional boolean fields; clients that never set them keep the old behavior. No migration is needed. Coverage:test/agent/permissionPolicy/permissionPolicyService.test.ts(chain-level, all rows above),test/app/config/*(config section load/writeback), regenerated config manifest verified bytest/app/config/configManifest.test.ts.Checklist
/approve). (Internal requirement approved directly by the project owner; no issue.)gen-changesetsskill, or this PR needs no changeset.gen-docsskill, or this PR needs no doc update.