From 4030deeba887a6ae07c767c4a79b4e7fd7fff322 Mon Sep 17 00:00:00 2001
From: Neil
Date: Tue, 10 Nov 2026 05:43:43 -0800
Subject: [PATCH] fix(cloud): every agent credential a sandbox gets in full is
marked 'Real value in sandbox', not only AWS keys
A shared list of agent and model-provider credential names (AWS, Bedrock, OpenRouter, Groq, xAI,
Mistral, DeepSeek, Together, Fireworks, Perplexity, Cerebras, Moonshot/Kimi, DashScope, Z.ai,
MiniMax, NVIDIA, Cohere, Azure OpenAI, Hugging Face, Amp, Factory, ...) marks every one that has no
egress swap. AWS keeps its own sentence; others read 'Orca can't swap {{name}} at the network edge,
...'. The control-plane test now walks the server's agent keys, this list and the desktop's Agent
API key presets: each is swapped, or flagged.
---
.../test/agent-credentials-more.test.ts | 14 ++-
.../cloud-secrets/CloudSecretEditor.tsx | 2 +-
.../cloud-secrets/CloudSecretVmBadge.tsx | 18 ++--
.../cloud-secrets/CloudSecretsPasteRow.tsx | 2 +-
.../cloud-secrets-fixture-data.ts | 3 +-
src/renderer/src/i18n/locales/en.json | 3 +-
.../cloud-secrets/cloud-secret-rules.ts | 97 +++++++++++++------
.../cloud-secret-stored-on-vm.test.ts | 27 +++++-
8 files changed, 123 insertions(+), 43 deletions(-)
diff --git a/cloud/apps/sandbox-control/test/agent-credentials-more.test.ts b/cloud/apps/sandbox-control/test/agent-credentials-more.test.ts
index b342c939f58..fe9f5107ab7 100644
--- a/cloud/apps/sandbox-control/test/agent-credentials-more.test.ts
+++ b/cloud/apps/sandbox-control/test/agent-credentials-more.test.ts
@@ -6,7 +6,14 @@ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
import { compileNetworkPolicy } from '../src/network-policy'
import { SWAPPED_CREDENTIALS, credentialTargets } from '../src/provider-env'
import { AGENT_KEY_NAMES } from '../src/secrets'
-import { CLOUD_SWAPPED_CREDENTIALS, cloudSecretStoredOnVm } from '../../../../src/shared/cloud-secrets/cloud-secret-rules'
+import {
+ AGENT_CREDENTIAL_NAMES,
+ CLOUD_SWAPPED_CREDENTIALS,
+ cloudSecretStoredOnVm
+} from '../../../../src/shared/cloud-secrets/cloud-secret-rules'
+import { AGENT_API_KEY_PRESETS } from '../../../../src/shared/agent-api-keys/agent-api-key-catalog'
+
+const AGENT_API_KEY_PRESET_NAMES = Object.values(AGENT_API_KEY_PRESETS).flatMap((presets) => (presets ?? []).map((preset) => preset.envName))
import { egressSecretHosts, encodeEgressSecretHosts } from '../src/secret-egress'
import { ENV_COMMAND } from '../src/sandbox-vm-commands'
import { createHarness } from './harness'
@@ -282,7 +289,10 @@ describe('egress swap on a sandbox with the new keys', () => {
describe('every agent credential is either swapped or marked "stored on workspace"', () => {
it('leaves no agent key reaching the VM raw without the warning', () => {
const settings = /(_MODEL|_BASE_URL|_REGION|_PROJECT|_PROJECT_ID)$|^CLAUDE_CODE_USE_/
- for (const name of AGENT_KEY_NAMES) {
+ // Every credential the server treats as an agent key, the desktop's agent key presets and the
+ // known model-provider key names: each is swapped, or the UI says the sandbox gets it in full.
+ const names = new Set([...AGENT_KEY_NAMES, ...AGENT_CREDENTIAL_NAMES, ...AGENT_API_KEY_PRESET_NAMES])
+ for (const name of names) {
if (settings.test(name)) {
continue
}
diff --git a/src/renderer/src/components/settings/cloud-secrets/CloudSecretEditor.tsx b/src/renderer/src/components/settings/cloud-secrets/CloudSecretEditor.tsx
index 631319eb2d2..7163c8bf049 100644
--- a/src/renderer/src/components/settings/cloud-secrets/CloudSecretEditor.tsx
+++ b/src/renderer/src/components/settings/cloud-secrets/CloudSecretEditor.tsx
@@ -169,7 +169,7 @@ export function CloudSecretEditor({
{cloudSecretStoredOnVm(name.trim()) ? (
<>
{' '}
- {cloudSecretVmWarning(t)}
+ {cloudSecretVmWarning(t, name.trim())}
>
) : null}
diff --git a/src/renderer/src/components/settings/cloud-secrets/CloudSecretVmBadge.tsx b/src/renderer/src/components/settings/cloud-secrets/CloudSecretVmBadge.tsx
index 549e9904d4d..2da3404cedb 100644
--- a/src/renderer/src/components/settings/cloud-secrets/CloudSecretVmBadge.tsx
+++ b/src/renderer/src/components/settings/cloud-secrets/CloudSecretVmBadge.tsx
@@ -13,7 +13,7 @@ export function CloudSecretVmBadge({ name }: { name: string }): React.JSX.Elemen
if (!cloudSecretStoredOnVm(name)) {
return null
}
- const why = cloudSecretVmWarning(t)
+ const why = cloudSecretVmWarning(t, name)
return (
@@ -36,9 +36,15 @@ export function CloudSecretVmBadge({ name }: { name: string }): React.JSX.Elemen
)
}
-export function cloudSecretVmWarning(t: ReturnType): string {
- return t(
- 'cloudSecrets.vm.warning',
- 'Orca can’t swap AWS keys at the network edge, so cloud workspaces get the real value. Anything running in the sandbox can read it.'
- )
+export function cloudSecretVmWarning(t: ReturnType, name: string): string {
+ return name.startsWith('AWS_')
+ ? t(
+ 'cloudSecrets.vm.warning',
+ 'Orca can’t swap AWS keys at the network edge, so cloud workspaces get the real value. Anything running in the sandbox can read it.'
+ )
+ : t(
+ 'cloudSecrets.vm.warningKey',
+ 'Orca can’t swap {{name}} at the network edge, so cloud workspaces get the real value. Anything running in the sandbox can read it.',
+ { name }
+ )
}
diff --git a/src/renderer/src/components/settings/cloud-secrets/CloudSecretsPasteRow.tsx b/src/renderer/src/components/settings/cloud-secrets/CloudSecretsPasteRow.tsx
index a0b06b13edd..c6f9ed4c405 100644
--- a/src/renderer/src/components/settings/cloud-secrets/CloudSecretsPasteRow.tsx
+++ b/src/renderer/src/components/settings/cloud-secrets/CloudSecretsPasteRow.tsx
@@ -192,7 +192,7 @@ export function PasteRowEditor({
{note ? `${status} · ${note}` : status}
{row.name && cloudSecretStoredOnVm(row.name) ? (
- {cloudSecretVmWarning(t)}
+ {cloudSecretVmWarning(t, row.name)}
) : null}
)
diff --git a/src/renderer/src/components/settings/cloud-secrets/cloud-secrets-fixture-data.ts b/src/renderer/src/components/settings/cloud-secrets/cloud-secrets-fixture-data.ts
index eb20c16a70a..951081dd0cb 100644
--- a/src/renderer/src/components/settings/cloud-secrets/cloud-secrets-fixture-data.ts
+++ b/src/renderer/src/components/settings/cloud-secrets/cloud-secrets-fixture-data.ts
@@ -47,7 +47,8 @@ export const FIXTURE_SECRETS: Record = {
view('personal', 'SENTRY_ENV', 'env', null, 400),
// Not swappable at egress: shows "Real value in sandbox".
view('personal', 'AWS_ACCESS_KEY_ID', 'agent_key', 'Q7MP', 6),
- view('personal', 'AWS_SECRET_ACCESS_KEY', 'agent_key', 'k2Vd', 6)
+ view('personal', 'AWS_SECRET_ACCESS_KEY', 'agent_key', 'k2Vd', 6),
+ view('personal', 'OPENROUTER_API_KEY', 'env', 'r9Tw', 8)
],
org: [
view('org', 'AI_GATEWAY_API_KEY', 'agent_key', 'M3kz', 30, 'u_dana'),
diff --git a/src/renderer/src/i18n/locales/en.json b/src/renderer/src/i18n/locales/en.json
index 59f4d128034..16f1c6d054c 100644
--- a/src/renderer/src/i18n/locales/en.json
+++ b/src/renderer/src/i18n/locales/en.json
@@ -26936,7 +26936,8 @@
},
"vm": {
"badge": "Real value in sandbox",
- "warning": "Orca can’t swap AWS keys at the network edge, so cloud workspaces get the real value. Anything running in the sandbox can read it."
+ "warning": "Orca can’t swap AWS keys at the network edge, so cloud workspaces get the real value. Anything running in the sandbox can read it.",
+ "warningKey": "Orca can’t swap {{name}} at the network edge, so cloud workspaces get the real value. Anything running in the sandbox can read it."
}
},
"cloudMcpSync": {
diff --git a/src/shared/cloud-secrets/cloud-secret-rules.ts b/src/shared/cloud-secrets/cloud-secret-rules.ts
index 843d5a77f95..64f5e2a0f9c 100644
--- a/src/shared/cloud-secrets/cloud-secret-rules.ts
+++ b/src/shared/cloud-secrets/cloud-secret-rules.ts
@@ -38,19 +38,80 @@ const AGENT_KEY_NAMES: ReadonlySet = new Set([
])
/**
- * Agent keys the egress proxy cannot swap, so the workspace VM holds the real value: AWS requests
- * are signed in the VM (SigV4) with the secret key, and Bedrock API keys are not routed yet. Every
- * other agent key reaches the VM only as a placeholder. Mirrors the control plane's swap list.
+ * Credentials agents and their model providers read. Any of these the egress proxy cannot swap
+ * reaches a cloud sandbox as its real value, so the UI marks it "Real value in sandbox": AWS keys
+ * (requests are signed in the VM with SigV4), Bedrock API keys (not routed yet) and every provider
+ * key below that has no swap route. A control-plane test keeps this in step with the proxy.
*/
-const STORED_ON_VM_NAMES: ReadonlySet = new Set([
+export const AGENT_CREDENTIAL_NAMES: readonly string[] = [
'AWS_ACCESS_KEY_ID',
'AWS_SECRET_ACCESS_KEY',
'AWS_SESSION_TOKEN',
- 'AWS_BEARER_TOKEN_BEDROCK'
-])
+ 'AWS_BEARER_TOKEN_BEDROCK',
+ 'OPENROUTER_API_KEY',
+ 'GROQ_API_KEY',
+ 'XAI_API_KEY',
+ 'MISTRAL_API_KEY',
+ 'DEEPSEEK_API_KEY',
+ 'TOGETHER_API_KEY',
+ 'TOGETHER_AI_API_KEY',
+ 'FIREWORKS_API_KEY',
+ 'PERPLEXITY_API_KEY',
+ 'CEREBRAS_API_KEY',
+ 'MOONSHOT_API_KEY',
+ 'KIMI_API_KEY',
+ 'DASHSCOPE_API_KEY',
+ 'ZAI_API_KEY',
+ 'ZHIPU_API_KEY',
+ 'MINIMAX_API_KEY',
+ 'NVIDIA_API_KEY',
+ 'COHERE_API_KEY',
+ 'AZURE_OPENAI_API_KEY',
+ 'AZURE_API_KEY',
+ 'HUGGINGFACE_API_KEY',
+ 'HF_TOKEN',
+ 'AMP_API_KEY',
+ 'FACTORY_API_KEY',
+ 'AUGMENT_API_KEY',
+ 'CODEBUFF_API_KEY',
+ 'CLINE_API_KEY',
+ 'QWEN_API_KEY',
+ // Swapped (no badge): listed so the test sees every agent credential in one place.
+ 'ANTHROPIC_API_KEY',
+ 'ANTHROPIC_AUTH_TOKEN',
+ 'AI_GATEWAY_API_KEY',
+ 'OPENAI_API_KEY',
+ 'GEMINI_API_KEY',
+ 'GOOGLE_API_KEY',
+ 'GOOGLE_GENERATIVE_AI_API_KEY',
+ 'CURSOR_API_KEY',
+ 'COPILOT_GITHUB_TOKEN',
+ 'COPILOT_PROVIDER_API_KEY',
+ 'COPILOT_PROVIDER_BEARER_TOKEN'
+]
+/** Agent credentials the egress proxy swaps: a sandbox only ever holds a stand-in for these. */
+export const CLOUD_SWAPPED_CREDENTIALS: readonly string[] = [
+ 'ANTHROPIC_API_KEY',
+ 'ANTHROPIC_AUTH_TOKEN',
+ 'AI_GATEWAY_API_KEY',
+ 'OPENAI_API_KEY',
+ 'GEMINI_API_KEY',
+ 'GOOGLE_GENERATIVE_AI_API_KEY',
+ 'CURSOR_API_KEY',
+ 'GOOGLE_API_KEY',
+ 'COPILOT_GITHUB_TOKEN',
+ 'COPILOT_PROVIDER_API_KEY',
+ 'COPILOT_PROVIDER_BEARER_TOKEN'
+]
+
+export function cloudSecretSwapped(name: string): boolean {
+ return CLOUD_SWAPPED_CREDENTIALS.includes(name)
+}
+
+/** An agent credential a cloud sandbox gets in full (no egress stand-in for it). */
export function cloudSecretStoredOnVm(name: string): boolean {
- return STORED_ON_VM_NAMES.has(name)
+ return AGENT_CREDENTIAL_NAMES.includes(name) && !cloudSecretSwapped(name)
}
const RESERVED_NAMES: ReadonlySet = new Set([
@@ -169,25 +230,3 @@ export function isPublicHttpsUrl(value: string): boolean {
!host.startsWith('[')
)
}
-
-/**
- * Variables the Orca Cloud egress proxy swaps (cloud/apps/sandbox-control/src/provider-env.ts,
- * checked equal by a control-plane test): a workspace only ever holds a stand-in for these.
- */
-export const CLOUD_SWAPPED_CREDENTIALS: readonly string[] = [
- 'ANTHROPIC_API_KEY',
- 'ANTHROPIC_AUTH_TOKEN',
- 'AI_GATEWAY_API_KEY',
- 'OPENAI_API_KEY',
- 'GEMINI_API_KEY',
- 'GOOGLE_GENERATIVE_AI_API_KEY',
- 'CURSOR_API_KEY',
- 'GOOGLE_API_KEY',
- 'COPILOT_GITHUB_TOKEN',
- 'COPILOT_PROVIDER_API_KEY',
- 'COPILOT_PROVIDER_BEARER_TOKEN'
-]
-
-export function cloudSecretSwapped(name: string): boolean {
- return CLOUD_SWAPPED_CREDENTIALS.includes(name)
-}
diff --git a/src/shared/cloud-secrets/cloud-secret-stored-on-vm.test.ts b/src/shared/cloud-secrets/cloud-secret-stored-on-vm.test.ts
index d75820f39a9..9a2623603c7 100644
--- a/src/shared/cloud-secrets/cloud-secret-stored-on-vm.test.ts
+++ b/src/shared/cloud-secrets/cloud-secret-stored-on-vm.test.ts
@@ -1,8 +1,31 @@
import { describe, expect, it } from 'vitest'
-import { cloudSecretKind, cloudSecretStoredOnVm } from './cloud-secret-rules'
+import {
+ AGENT_CREDENTIAL_NAMES,
+ cloudSecretKind,
+ cloudSecretStoredOnVm,
+ cloudSecretSwapped
+} from './cloud-secret-rules'
describe('agent keys the workspace VM holds in full', () => {
- it('marks only the AWS keys, which the egress proxy cannot swap', () => {
+ it('flags every agent credential that is not swapped, and only those', () => {
+ for (const name of AGENT_CREDENTIAL_NAMES) {
+ expect(cloudSecretStoredOnVm(name), name).toBe(!cloudSecretSwapped(name))
+ }
+ for (const name of [
+ 'OPENROUTER_API_KEY',
+ 'GROQ_API_KEY',
+ 'XAI_API_KEY',
+ 'AWS_BEARER_TOKEN_BEDROCK'
+ ]) {
+ expect(cloudSecretStoredOnVm(name), name).toBe(true)
+ }
+ // Ordinary variables are the user's own business, not agent credentials.
+ for (const name of ['DATABASE_URL', 'STRIPE_SECRET_KEY', 'AWS_REGION']) {
+ expect(cloudSecretStoredOnVm(name), name).toBe(false)
+ }
+ })
+
+ it('marks the AWS keys, which the egress proxy cannot swap', () => {
for (const name of [
'AWS_ACCESS_KEY_ID',
'AWS_SECRET_ACCESS_KEY',