fix(vscode): match homedir with boundaries in vsix-verify - #3305
fix(vscode): match homedir with boundaries in vsix-verify#3305kimi-agent-bot wants to merge 1 commit into
Conversation
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.
|
commit: |
There was a problem hiding this comment.
💡 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-])`); |
There was a problem hiding this comment.
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 👍 / 👎.
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
verifyNoSensitiveContentinapps/vscode/scripts/vsix-verify.mjsdid naive substring matching ofhomedir(). 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.tsAll contain
/rootas 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/rootstill matches;/roots.ts,/rootFileSkillSource.ts,/root-dirdo not. Real leaks such as/root/kimi-code/...are still caught. Marketplace tokens keep plain substring matching.Local verification
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.package:platform -- linux-x64run 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.