Desktop AI Client Architecture Evolution and Security Practices: Chat, Cowork, and Code
This article explains how desktop AI clients evolved from thin launchers into high-privilege local runtimes, and what that means for security. It breaks down the technical differences behind the Chat, Cowork, and Code tabs, outlines the typical four-stage evolution path, and describes how third-party inference gateways work. It also covers model whitelisting and local mapping proxies, DLL side-loading risks with prioritized hardening steps, and enterprise deployment recommendations. The goal is to help readers understand the permission gradient across tabs and the protocol constraints of gateway mode so they can control risk while using parallel tasks and local development.
1. Introduction: What the Executable Has Become
The executable of a desktop AI client is no longer just a launcher. It plays four roles at once: process host, UI rendering container, local capability agent, and credential vault. Understanding this is the prerequisite for understanding every architectural decision and security risk that follows.
In the early form, the core logic was very thin: read local configuration, start an embedded browser engine, load remote pages, and forward user input to a server-side inference endpoint. As usage expanded from question answering to parallel task orchestration and local code development, the program had to introduce more complex local runtimes, and the size of the executable and its attack surface grew together.
This article takes a neutral perspective, describes the common technical architecture of this class of desktop clients in abstract terms, and provides reusable security hardening and integration practices.
2. Capability Layers: The Technical Meaning of the Chat, Cowork, and Code Tabs
Mainstream desktop clients usually divide capabilities into three tabs, and their underlying dependencies differ significantly:
- Chat: Almost entirely dependent on remote inference services. The local side only handles session state, context trimming, and streaming rendering. It is sensitive to network jitter and has the lowest local permission requirements.
- Cowork: Introduces local file read/write and task orchestration. It requires a controlled filesystem access scope, a task queue, and a concurrency scheduler. The permission model starts to become complex.
- Code: Requires a built-in terminal, editor, syntax parsing, and command execution, essentially a streamlined integrated development environment. It carries the highest risk level because it inherently requires “executing arbitrary local commands.”
One key conclusion: the more tabs a client has, the closer it gets to being “a runtime with a graphical interface,” and its security boundary must be enforced by operating-system-level permissions rather than in-app dialogs.
3. Evolution Milestones: From a Model Interaction Tool to a Full Development Environment
The refactoring of this kind of product usually follows a clear curve:
- Usability stage: Complete cross-platform packaging (executable formats, signing, and notarization processes differ between Windows and Unix-like systems), and get login and billing working.
- Parallel task stage: Introduce sidebar task management, session isolation, and background resident processes to solve the problem that “single-threaded conversation cannot carry long tasks.”
- Embedded environment stage: Build in a terminal, file tree, diff view, and patch application capability; the program begins to hold higher privileges.
- Ecosystem openness stage: Provide extension points or third-party inference integration, turning the “model source” from hard-coded into configurable.
The side effect of this curve is that the program changes from a “network client” into a “high-privilege local agent,” and any configuration mistake is amplified into a system-level risk.
4. Third-Party Inference Gateways: How Gateway Mode Works
Gateway mode means the client no longer connects directly to the official inference endpoint. Instead, it sends requests to a compatible HTTP interface that handles authentication, routing, and model mapping. The general request shape looks like this:
POST {BASE_URL}/v1/chat/completionsAuthorization: Bearer {API_KEY}Content-Type: application/json{"model": "your-model-id","stream": true,"messages": [{ "role": "user", "content": "..." }]}
Four engineering concerns matter here:
- Protocol compatibility: The interface must support streaming responses, tool calls, and multimodal fields; otherwise patch application in the Code tab will fail.
- Model discovery: Clients often pull the list of available models through
GET /v1/models, and this endpoint is the main enforcement point for whitelist policies. - Credential storage: Keys should go into the operating system credential store, not a plaintext configuration file.
- Mode exclusivity: Third-party gateways and official account login usually cannot coexist; switching requires restarting the process and clearing the session cache.
5. Whitelists and Local Proxies: A Common Approach to the Compatibility Trade-off
When the server keeps only model identifiers with specific prefixes on the model discovery endpoint, third-party models get filtered out. A common industry response is to run a protocol conversion proxy locally that maps external model identifiers to identifiers inside the whitelist and then forwards the real request:
# Illustration: core logic of a local mapping proxyALLOWED_PREFIX = ("claude", "anthropic")def map_model(name: str) -> str:return "claude-sonnet-4-6" if not name.startswith(ALLOWED_PREFIX) else name# Replace the model field when forwarding the request; usage and tool_calls in the response must be passed back unchanged
It is worth stressing that this kind of practice is a compatibility adaptation. It may violate terms of service, and differences in protocol fields may also cause tool calls to break. A safer choice for production is to route everything through a standard gateway and let the gateway side normalize identifiers.
6. Plugin Loading Chain Risk: Causes and Hardening of DLL Side-Loading
Security researchers have disclosed a dynamic library side-loading issue in a certain desktop client on Windows: at startup the program searches for same-named dynamic libraries in a fixed order, and if the installation directory is writable, an attacker who places a malicious library with the same name can make a legitimately digitally signed process load and execute arbitrary code. The danger is that “the signature is trusted but the behavior is not,” which defeats both conventional antivirus and user intuition.
Hardening recommendations, in priority order:
- Minimize directory permissions: Allow only administrators to write to the installation directory; do not let normal users write there or merge it with per-install directories.
- Explicit load paths: Load dependencies with full absolute paths; disable current-directory and relative search.
- Dual signature and hash verification: Verify the publisher signature and file hash before loading, and terminate startup if either fails.
- Integrity self-monitoring: Take baseline snapshots of critical directories, and use logging services and monitoring alerts to detect anomalous changes.
- Least-privilege execution: Run Code tab command execution inside a restricted sandbox or container platform instead of inheriting all of the user’s privileges.
- Trusted update channel: Verify signatures on update packages and support resumable downloads; keep the previous stable version for rollback.
7. Enterprise Deployment Recommendations
For enterprise users, it is recommended to bring the desktop client into unified endpoint governance: distribute installation directory permission policies through configuration management; host API keys in a key management service rather than local files; archive session audit logs in object storage; isolate high-privilege coding tasks in a container platform; and cover anomalous process loading and anomalous outbound connections with monitoring alerts. If an enterprise wants to build its own capabilities quickly, it can build a unified gateway layer on top of the compute, storage, and model service categories offered by Baidu AI Cloud to achieve identifier normalization and end-to-end auditing.
8. Conclusion
The technical throughline of desktop AI clients is the continuous tug-of-war between “capability expansion” and “permission reduction.” Understanding the permission gradient across the three tabs, the protocol constraints of gateway mode, the trade-off between whitelists and mapping proxies, and the key points of hardening the dynamic library loading chain is what allows you to enjoy the convenience of parallel tasks and local development while keeping risk within an acceptable range.
