Repository navigation
fix(vscode): sanitize implicit editor context - #4124
Merged
diegosouzapw merged 3 commits intoJun 18, 2026
Merged
diegosouzapw merged 3 commits into
diegosouzapw merged 3 commits into
Conversation
Contributor
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
…-context-sanitizer
Apply review fixes to the VS Code tokenized-route context sanitizer: - Stop the free-form text scan from using the bare-word sensitive patterns (credentials/kubeconfig/secrets); they corrupted legitimate chat prose (e.g. "how do I store API credentials?"). Those words still flag a sensitive *file path* at the object level — only the text scan is narrowed to anchored filename/extension patterns. - Document the OMNIROUTE_VSCODE_SANITIZE_CONTEXT opt-out in .env.example and docs/reference/ENVIRONMENT.md so check:env-doc-sync stays in sync. - Add regression tests: prose mentioning credentials/secrets is preserved, and a structured sensitive path is still redacted. Co-authored-by: diegosouzapw <diegosouza.pw@gmail.com>
diegosouzapw
merged commit Jun 18, 2026
cf716e9
into
cheaper-inference:release/v3.8.29
3 checks passed
Collaborator
|
Thanks for this, @zhiru! 🙏 Solid secure-by-default addition — stripping implicit active-editor context on the tokenized VS Code routes closes a real leakage path, and I appreciate the explicit-attachment preservation + object-level sensitive-file redaction. Before merging I pushed two small review fixes to your branch (co-authored, your authorship preserved):
Validated locally: sanitizer tests 7/7, existing |
Merged
tkgo11
pushed a commit
to tkgo11/OmniRoute
that referenced
this pull request
Sep 23, 2026
Integrated into release/v3.8.29 with review fixes (narrowed text-scan redaction + documented OMNIROUTE_VSCODE_SANITIZE_CONTEXT + regression tests). Co-authored-by: diegosouzapw
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.
Summary
Adds a defensive sanitizer for VS Code-compatible tokenized endpoints so implicit active-editor context is stripped before requests are forwarded to model providers. Explicit attachments remain available, while common sensitive file contexts are redacted.
Why
VS Code/Copilot-compatible clients can include active editor/current file context even when users only intended to attach a different file. Forwarding that implicit context can accidentally expose unrelated or sensitive files to upstream model providers.
Changes
sanitizeVscodeRequestBody/sanitizeVscodeRequestfor tokenized VS Code routes.editorContext,activeEditor,currentFile,selection, and visible/open editor metadata..env, private keys, kubeconfig, credentials/secrets, andserver-access.md./api/chattokenized routes.Validation
node --import tsx/esm --test tests/unit/vscode-context-sanitizer.test.tsnode --import tsx/esm --test tests/unit/vscode-token-routes.test.tsnpx eslint <changed files>npm run typecheck:coreSecurity
The default is secure-by-default. The sanitizer can only be disabled explicitly with
OMNIROUTE_VSCODE_SANITIZE_CONTEXT=0. File contents are not logged by this change.