fix(cli): block project markdown secret exfiltration - #12168
Merged
Conversation
chrarnoldus
approved these changes
Jul 13, 2026
Contributor
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Files Reviewed (2 files)
Previous Review Summary (commit 7a32383)Current summary above is authoritative. Previous snapshots are kept for context only. Previous review (commit 7a32383)Status: 1 Issues Found | Recommendation: Address before merge Overview
Issue Details (click to expand)WARNING
Files Reviewed (19 files)
Reviewed by gpt-5.6-sol · Input: 56.4K · Output: 5.6K · Cached: 391.7K Review guidance: REVIEW.md from base branch |
marius-kilocode
enabled auto-merge (squash)
July 13, 2026 12:08
AlexOcculate
pushed a commit
to AlexOcculate/kilocode
that referenced
this pull request
Jul 14, 2026
5 tasks
t7tran
pushed a commit
to t7tran/kilocode
that referenced
this pull request
Aug 14, 2026
t7tran
pushed a commit
to t7tran/kilocode
that referenced
this pull request
Aug 14, 2026
* fix(cli): guard markdown substitutions by config trust * chore(cli): annotate markdown trust test changes * fix(cli): preserve trusted global instruction patterns
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Markdown-backed configuration is converted directly into model-visible prompts for project agents, commands, modes, workflows, instructions, and skills. Until now,
KilocodeMarkdown.substituteexpanded{env:VAR}and{file:path}without knowing whether the Markdown came from user-controlled global configuration or an untrusted repository.A malicious repository could therefore commit Markdown such as
{file:~/.aws/credentials}or{env:AWS_SECRET_ACCESS_KEY}under.kiloor another discovered project configuration directory. Loading that Markdown copied the local secret into the resulting prompt. When the prompt was sent to a model, particularly through a provider configuration using an attacker-controlledbaseURL, the repository could exfiltrate credentials or arbitrary readable files without requiring a normal file-read tool call or permission prompt.#11886 introduced the trust boundary for JSON configuration values, but intentionally left the parallel Markdown substitution path for #11889. This change completes that boundary across every Markdown-backed configuration loader.
The durable behavior is:
{env:...}references because environment variables have no safe project-scoped form.{file:...}references are allowed only when the canonical target remains inside the active project root.ConfigVariableGuard, preserving its traversal, symlink, inode-swap, and/proc/*/environprotections.{file:...}substitutions remain confined to the active project boundary.KILO_CONFIG,KILO_CONFIG_CONTENT, organization, MDM, andKILO_CONFIG_DIRsources preserve their existing file and environment substitution behavior.The trust and scope signal is threaded through agent, command, mode, workflow, instruction, skill, settings-overlay, and validation paths, with runtime-only provenance removed before configuration is persisted or exposed for editing.
Fixes #11889
Follow-up to #11886.