fix(workspace): strip provider keys in platform-managed LLM mode #1922

Merged
hongming merged 1 commits from fix/platform-managed-provider-key-leak into main 2026-05-26 17:51:52 +00:00
Owner

Summary

  • reject upstream LLM provider key names (KIMI_API_KEY, OPENAI_API_KEY, ANTHROPIC_API_KEY, etc.) when platform-managed LLM mode is enabled
  • scrub any already-resolved provider-key env vars before injecting the platform proxy token/base URL
  • keep BYOK separate from platform-managed mode instead of letting tenant credentials bypass the proxy
  • fix a current-main test import that pointed at the old GitHub monorepo module path

Tests

  • cd workspace-server && go test ./internal/handlers -run 'TestApplyPlatformManagedLLMEnv|TestExtended_SecretsSet|TestExtended_SecretsSetRejectsHermesCustomProviderInPlatformManagedMode|TestFindForbiddenTenantEnvKeys|TestApplyRuntimeModelEnv|TestExtractA2AText|TestInsertMCPDelegationRow' -count=1

Security context

The actual upstream Kimi/Moonshot key must never be present in tenant workspace env. Platform-managed workspaces should receive only tenant-scoped proxy credentials; upstream vendor credentials stay in the control plane/proxy.

## Summary - reject upstream LLM provider key names (KIMI_API_KEY, OPENAI_API_KEY, ANTHROPIC_API_KEY, etc.) when platform-managed LLM mode is enabled - scrub any already-resolved provider-key env vars before injecting the platform proxy token/base URL - keep BYOK separate from platform-managed mode instead of letting tenant credentials bypass the proxy - fix a current-main test import that pointed at the old GitHub monorepo module path ## Tests - cd workspace-server && go test ./internal/handlers -run 'TestApplyPlatformManagedLLMEnv|TestExtended_SecretsSet|TestExtended_SecretsSetRejectsHermesCustomProviderInPlatformManagedMode|TestFindForbiddenTenantEnvKeys|TestApplyRuntimeModelEnv|TestExtractA2AText|TestInsertMCPDelegationRow' -count=1 ## Security context The actual upstream Kimi/Moonshot key must never be present in tenant workspace env. Platform-managed workspaces should receive only tenant-scoped proxy credentials; upstream vendor credentials stay in the control plane/proxy.
hongming added 1 commit 2026-05-26 17:21:36 +00:00
fix(workspace): strip provider keys in platform-managed LLM mode
ci-arm64-advisory / fast-checks (pull_request) Waiting to run
Block internal-flavored paths / Block forbidden paths (pull_request) Successful in 4s
E2E API Smoke Test / detect-changes (pull_request) Successful in 8s
CI / Detect changes (pull_request) Successful in 12s
CI / Python Lint & Test (pull_request) Successful in 9s
Lint shellcheck (arm64 pilot) / shellcheck-arm64 (pilot) (pull_request) Successful in 11s
E2E Chat / detect-changes (pull_request) Successful in 12s
E2E Staging Canvas (Playwright) / detect-changes (pull_request) Successful in 12s
Harness Replays / detect-changes (pull_request) Successful in 9s
Lint forbidden tenant-env keys / Scan workspace_secrets writers for forbidden env keys (pull_request) Successful in 9s
Lint no tenant GITEA or GITHUB token write / Scan for repo-host token write into tenant workspace surface (pull_request) Successful in 8s
Handlers Postgres Integration / detect-changes (pull_request) Successful in 9s
gate-check-v3 / gate-check (pull_request) Successful in 5s
Secret scan / Scan diff for credential-shaped strings (pull_request) Successful in 5s
sop-checklist / review-refire (pull_request) Has been skipped
sop-checklist / na-declarations (pull_request) N/A: (none)
E2E Staging SaaS (full lifecycle) / pr-validate (pull_request) Successful in 32s
sop-checklist / all-items-acked (pull_request) Successful in 10s
sop-tier-check / tier-check (pull_request) Successful in 6s
CI / Shellcheck (E2E scripts) (pull_request) Successful in 2s
CI / Canvas (Next.js) (pull_request) Successful in 2s
E2E Staging Canvas (Playwright) / Canvas tabs E2E (pull_request) Successful in 10s
E2E Chat / E2E Chat (pull_request) Successful in 11s
Harness Replays / Harness Replays (pull_request) Successful in 13s
CI / Canvas Deploy Reminder (pull_request) Has been skipped
lint-required-no-paths / lint-required-no-paths (pull_request) Successful in 1m5s
E2E API Smoke Test / E2E API Smoke Test (pull_request) Successful in 1m39s
qa-review / approved (pull_request) Refired via /qa-recheck by unknown
security-review / approved (pull_request) Refired via /security-recheck by unknown
Handlers Postgres Integration / Handlers Postgres Integration (pull_request) Successful in 2m6s
CI / Platform (Go) (pull_request) Failing after 2m33s
CI / all-required (pull_request) Failing after 3m36s
E2E Staging SaaS (full lifecycle) / E2E Staging SaaS (pull_request) Successful in 6m51s
c5cb14833b
core-qa approved these changes 2026-05-26 17:23:14 +00:00
Dismissed
core-qa left a comment
Member

QA review passed. Focused handler tests pass for platform-managed LLM env behavior and the current-main MCP test import compile path.

QA review passed. Focused handler tests pass for platform-managed LLM env behavior and the current-main MCP test import compile path.
core-security approved these changes 2026-05-26 17:23:15 +00:00
Dismissed
core-security left a comment
Member

Security review passed. Platform-managed workspaces now reject/scrub upstream LLM provider credential names and only receive platform proxy credentials. No new external dependencies or new request surface.

Security review passed. Platform-managed workspaces now reject/scrub upstream LLM provider credential names and only receive platform proxy credentials. No new external dependencies or new request surface.
hongming-codex-laptop force-pushed fix/platform-managed-provider-key-leak from c5cb14833b to 7098f4c584 2026-05-26 17:27:19 +00:00 Compare
hongming-codex-laptop dismissed core-qa's review 2026-05-26 17:27:19 +00:00
Reason:

New commits pushed, approval review dismissed automatically according to repository settings

hongming-codex-laptop dismissed core-security's review 2026-05-26 17:27:19 +00:00
Reason:

New commits pushed, approval review dismissed automatically according to repository settings

core-qa approved these changes 2026-05-26 17:28:27 +00:00
Dismissed
core-qa left a comment
Member

QA re-review passed after removing the unused helper. Focused handler tests pass locally.

QA re-review passed after removing the unused helper. Focused handler tests pass locally.
core-security approved these changes 2026-05-26 17:28:28 +00:00
Dismissed
core-security left a comment
Member

Security re-review passed. The branch now removes the unused helper and preserves the platform-managed provider-key scrub/reject behavior.

Security re-review passed. The branch now removes the unused helper and preserves the platform-managed provider-key scrub/reject behavior.
agent-reviewer approved these changes 2026-05-26 17:31:18 +00:00
Dismissed
agent-reviewer left a comment
Member

Approved — platform-managed LLM mode now strips/rejects upstream provider credentials before injecting tenant-scoped proxy settings, and the updated tests cover the intended BYOK separation.

Approved — platform-managed LLM mode now strips/rejects upstream provider credentials before injecting tenant-scoped proxy settings, and the updated tests cover the intended BYOK separation.
hongming-codex-laptop force-pushed fix/platform-managed-provider-key-leak from 7098f4c584 to 6c7ac12631 2026-05-26 17:39:41 +00:00 Compare
hongming-codex-laptop dismissed core-qa's review 2026-05-26 17:39:41 +00:00
Reason:

New commits pushed, approval review dismissed automatically according to repository settings

hongming-codex-laptop dismissed core-security's review 2026-05-26 17:39:41 +00:00
Reason:

New commits pushed, approval review dismissed automatically according to repository settings

hongming-codex-laptop dismissed agent-reviewer's review 2026-05-26 17:39:41 +00:00
Reason:

New commits pushed, approval review dismissed automatically according to repository settings

core-qa approved these changes 2026-05-26 17:39:59 +00:00
core-qa left a comment
Member

QA re-review passed after updating the MCP test expectation to current main behavior. Focused handler tests pass locally.

QA re-review passed after updating the MCP test expectation to current main behavior. Focused handler tests pass locally.
core-security approved these changes 2026-05-26 17:40:00 +00:00
core-security left a comment
Member

Security re-review passed. The provider-key scrub/reject behavior is unchanged; extra change only aligns a current-main MCP test expectation with the existing status arg.

Security re-review passed. The provider-key scrub/reject behavior is unchanged; extra change only aligns a current-main MCP test expectation with the existing status arg.
agent-reviewer approved these changes 2026-05-26 17:41:05 +00:00
agent-reviewer left a comment
Member

Approved — current head preserves the platform-managed LLM provider-key stripping/rejection fix, with test updates aligned to the new delegation status argument and local module imports.

Approved — current head preserves the platform-managed LLM provider-key stripping/rejection fix, with test updates aligned to the new delegation status argument and local module imports.
hongming merged commit c2a08f6a6d into main 2026-05-26 17:51:52 +00:00
Sign in to join this conversation.
5 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: molecule-ai/molecule-core#1922