[Vault] MCP HTTP proxy 运行时注入 static_bearer - #212
Draft
qifanlili wants to merge 2 commits into
Draft
Conversation
在 Session MCP proxy 转发前按真实 mcp_url 匹配 vault 凭证并注入 Bearer,沙箱不接触明文 token。 Co-authored-by: Cursor <cursoragent@cursor.com>
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Co-authored-by: Cursor <cursoragent@cursor.com>
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.
总览
本 PR 在 Session MCP HTTP proxy(
/v2/ccr-sessions/{id}/mcp)转发前,按真实mcp_url匹配 sessionvault_ids中的活动凭证,并把命中的 static_bearer token 注入上游Authorization。Sandbox /mcp_config只看到 proxy URL 与 session JWT,看不到明文 token。依赖存库信封加密(#199 /
feat/vault-secret-envelope-encryption)。本 PR 只做运行时注入 MVP,不覆盖mcp_oauth、环境变量出口替换,也不走 CONNECT MITM。提供的功能与改动
1. Credential URL 匹配与注入决策
vault_ids顺序遍历活动凭证;首个可注入的static_bearer命中胜出。/分段前缀匹配(/mcp命中/mcp/sse,不命中/mcp-admin)。2. MCP HTTP proxy 接线
codesessions.WithVaultSecrets→injectMCPProxyHeaders→vaults.Injector.RewriteAuthorization。vault_ids与凭证;明文 token 不缓存,用完清零。3. 文档与测试
docs/design/be/vault-runtime.md与 permission-bridge 设计说明。测试
go test ./internal/vaults/ ./internal/db/ ./internal/codesessions/ -count=1不做
mcp_oauth注入与 refreshenvironment_variable出口替换networking.allowed_hosts