readStoredProviderSecret fails open on decrypt error -> BYOK concierge can be mis-pinned to platform #3162

Open
opened 2026-06-22 19:02:26 +00:00 by hongming · 0 comments
Owner

readStoredProviderSecret (workspace-server/internal/handlers/platform_agent.go) returns "" on any decrypt/read error, treated as 'provider unset'. Combined with the empty-MODEL platform pin from #3160, a BYOK/self-host concierge that hits a transient decrypt failure while its MODEL is momentarily empty (rebuilt-from-DB payload) could be pinned LLM_PROVIDER=platform and mis-routed onto the platform proxy.

Not introduced by #3160#3160 only un-gated the empty-MODEL case; the fail-open read predates it. But the two compose into a real (narrow) mis-pin window.

Suggested fix: distinguish a decrypt/read error from a genuine 'not set' (e.g. return a sentinel/err) so the pin logic can fail closed (skip the pin, or retry) rather than treating a transient decrypt error as 'no provider stored'.

Found during the #3160/#161 review (CEO adversarial pass) — pre-existing, NOT introduced by those PRs. Tracking separately.

🤖 Generated with Claude Code

`readStoredProviderSecret` (workspace-server/internal/handlers/platform_agent.go) returns `""` on any decrypt/read error, treated as 'provider unset'. Combined with the empty-MODEL platform pin from #3160, a BYOK/self-host concierge that hits a *transient* decrypt failure while its MODEL is momentarily empty (rebuilt-from-DB payload) could be pinned `LLM_PROVIDER=platform` and mis-routed onto the platform proxy. **Not introduced by #3160** — #3160 only un-gated the empty-MODEL case; the fail-open read predates it. But the two compose into a real (narrow) mis-pin window. **Suggested fix:** distinguish a decrypt/read *error* from a genuine 'not set' (e.g. return a sentinel/err) so the pin logic can fail closed (skip the pin, or retry) rather than treating a transient decrypt error as 'no provider stored'. Found during the #3160/#161 review (CEO adversarial pass) — pre-existing, NOT introduced by those PRs. Tracking separately. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: molecule-ai/molecule-core#3162