feat(security): add VibeGuard-style client-side redaction#2099
Draft
inkdust2021 wants to merge 1 commit intoQwenLM:mainfrom
Draft
feat(security): add VibeGuard-style client-side redaction#2099inkdust2021 wants to merge 1 commit intoQwenLM:mainfrom
inkdust2021 wants to merge 1 commit intoQwenLM:mainfrom
Conversation
Adds security.redaction settings and /vibeguard command.
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.
TLDR
This PR adds VibeGuard-style client-side redaction to qwen-code to prevent secrets/PII from being sent to model providers.
__VG_<CATEGORY>_<hash12>__right before provider requests/vibeguard status|on|offfor session-level togglingsecurity.redaction.*settingsThis PR is opened as a Draft to get maintainer feedback early.
Dive Deeper
Placeholder format and mapping
__VG_<CATEGORY>_<hash12>__hash12is the first 12 lowercase hex chars ofHMAC-SHA256(sessionSecret, original)_<N>__suffixWhy this is implemented in core (not a plugin)
OpenCode exposes plugin hooks to intercept outbound messages and restore placeholders on the way back.
In qwen-code, I couldn’t find a comparable hook/extension API to intercept provider requests in a provider-agnostic way,
so this PR implements redaction at the
ContentGeneratorlevel (right before provider calls).If you prefer a plugin/extension-based approach (or if there is an existing hook I missed), I’m happy to refactor this into a plugin.
Prior art / references
https://github.com/inkdust2021/opencode-vibeguard
Follow-ups / maintainer preferences
I’m happy to iterate on naming (e.g.
/vibeguardvs/redaction), settings shape, docs placement, and i18n/multi-language support,and to align with any other project requirements.
Reviewer Test Plan
npm run buildnpm start.qwen/settings.json:security.redaction.keywords(e.g.example-secret-123)/vibeguard onTesting Matrix
Notes (🍏 macOS local):
npm run test --workspace=packages/corenpm run typecheck --workspace=packages/cli/vibeguard(see screenshot below)Linked issues / bugs
Related to #2010.
Screenshot / recording
因误删 fork 仓库导致旧 PR 自动关闭,现重建以便继续 review。
旧 PR: #2031
变更内容与旧 PR 保持一致