Skip to content

fix(vscode): match homedir with boundaries in vsix-verify - #3305

Open
kimi-agent-bot wants to merge 1 commit into
MoonshotAI:mainfrom
kimi-agent-bot:fix/vsix-verify-homedir-boundary
Open

fix(vscode): match homedir with boundaries in vsix-verify#3305
kimi-agent-bot wants to merge 1 commit into
MoonshotAI:mainfrom
kimi-agent-bot:fix/vsix-verify-homedir-boundary

Conversation

@kimi-agent-bot

Copy link
Copy Markdown
Collaborator

Background

Split out from #3304 per review feedback. This does NOT block the 0.7.3 release — the release builds with a non-root builder, which bypasses the false positive described below. This is a robustness fix for the packaging toolchain, for follow-up review.

Root cause

verifyNoSensitiveContent in apps/vscode/scripts/vsix-verify.mjs did naive substring matching of homedir(). When building as root, homedir() is /root, and the bundle legitimately contains strings such as:

  • notifications/roots/list_changed
  • ../../packages/agent-core/src/profile/agentfile/roots.ts
  • ../../packages/agent-core-v2/src/features/skill/workspace/rootFileSkillSource.ts

All contain /root as a substring and were misreported as "contains a local filesystem path". Any build running as root hits this.

Fix

Local filesystem paths (sourceRoot, homedir(), extra forbidden text) are now matched with path boundaries — a path only counts when it appears standalone (not preceded by a word character or path separator, and not followed by a word character or -). /root/ or a quoted/whitespace-delimited /root still matches; /roots.ts, /rootFileSkillSource.ts, /root-dir do not. Real leaks such as /root/kimi-code/... are still caught. Marketplace tokens keep plain substring matching.

Local verification

  • Boundary-matching unit checks: agentfile/roots.ts, workspace/rootFileSkillSource.ts, notifications/roots/list_changed, foo/root, /root-dir/x → no match; /root/kimi-code/..., quoted/whitespace-delimited /root, C:\root\x (Windows separator variant) → match.
  • Full package:platform -- linux-x64 run as root with this fix applied (together with fix(vscode): bundle immer into vsix extension #3304) passed: Verified linux-x64: 25 files, 19046898 unpacked bytes; package/static checks passed.

No changeset included: CI does not enforce changesets on PRs, and this fix must not bump the 0.7.3 version.

verifyNoSensitiveContent used naive substring matching for the
builder's homedir/sourceRoot. When building as root, homedir() is
"/root" and legitimate bundled strings like "agentfile/roots.ts" or
"workspace/rootFileSkillSource.ts" false-positive as local path
leaks, aborting the package build. Paths now only match when they
appear standalone: not preceded by a word character or path separator
and not followed by a word character or "-". Real leaks such as
"/root/kimi-code/..." are still caught; marketplace tokens keep
plain substring matching.
@changeset-bot

changeset-bot Bot commented Aug 27, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: f3eab97

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@pkg-pr-new

pkg-pr-new Bot commented Aug 27, 2026

Copy link
Copy Markdown
pnpm dlx https://pkg.pr.new/@moonshot-ai/kimi-code@f3eab97
npx https://pkg.pr.new/@moonshot-ai/kimi-code@f3eab97

commit: f3eab97

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f3eab97f0c

ℹ️ 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".

.flatMap((value) => [value, value.replaceAll('\\', '/'), value.replaceAll('/', '\\')]);
.flatMap(pathVariants)
.map((value) => {
const pattern = new RegExp(`(?<![\\w/\\\\])${escapeRegExp(value)}(?![\\w-])`);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Allow absolute paths after file URL prefixes

When a leaked local path is serialized as a file URL, such as file:///workspace/kimi-code/private, the slash immediately before the matching /workspace/kimi-code causes this negative lookbehind to fail. The previous substring check rejected this representation, but the new matcher accepts it, allowing source-root or home-directory paths embedded in file: URLs to pass the package audit; special-case file URL prefixes while retaining the boundary protection for ordinary path suffixes.

Useful? React with 👍 / 👎.

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.

1 participant