Summary
TypeBot's bot-engine runtime contains an authorization flaw that allows authenticated users to access credentials belonging to other workspaces via the preview chat endpoint.
Because workspace ownership checks can be bypassed with a crafted workspaceId value, attackers may exfiltrate stored credentials and abuse connected external services under certain conditions.
Affected context
The vulnerability arises in the TypeBot bot-engine runtime when handling preview chat requests that need to retrieve stored credentials.
In affected versions, the getCredentials() utility function relies on a truthy/falsy check of the workspaceId field, and the associated schema permits empty strings.
When deployments:
- Rely on workspace-scoped credentials for external integrations, and
- Allow authenticated users to interact with the preview chat endpoint,
the bot engine may fail to properly enforce workspace ownership, exposing credentials across workspace boundaries.
Exploit preconditions
- Attack surface: TypeBot bot-engine preview chat endpoint.
- Required access: Any authenticated user account capable of invoking the preview chat functionality.
- Trigger point: A request to the preview chat endpoint that causes the runtime to call getCredentials() with a client-supplied workspaceId field.
- Why exploitation is possible: The workspace ownership validation uses a conditional check of the form
if (workspaceId && ...).
Since the Zod schema for the preview endpoint accepts empty strings, an attacker can pass workspaceId: "", causing the ownership check to be skipped while still allowing credential retrieval logic to proceed.
Why this happens
The root cause is an improper access control implementation tied to weak input validation and over-trust in client-supplied identifiers.
Instead of enforcing workspace ownership server-side using authoritative context (e.g., session-bound workspace IDs), the bot engine:
- Accepts a workspaceId parameter directly from the client for credential lookup, and
- Uses a falsy check (
if (workspaceId && ...)) as the gate for ownership checks.
When combined with a schema that permits empty strings, this pattern allows bypassing authorization logic by providing a value that satisfies type constraints but fails the truthy check.
This maps primarily to CWE-284: Improper Access Control, with elements of CWE-639: Authorization Bypass Through User-Controlled Key, where a client-controlled identifier is used for access decisions, and CWE-522: Insufficiently Protected Credentials, since secrets are retrievable beyond their intended scope.
Potential impact
- Unauthorized access to stored credentials from other workspaces.
- Abuse of external services (e.g., payment processors, messaging APIs, third-party integrations) using stolen credentials.
- Financial loss due to unintended API usage, quotas being exhausted, or fraudulent activity.
- Cross-workspace data exposure and potential data breach if credentials grant access to sensitive systems.
- Erosion of tenant isolation guarantees in multi-tenant deployments.
General mitigation guidance
Effective mitigation focuses on tightening authorization checks and reducing reliance on client-controlled identifiers:
- Perform workspace ownership validation using server-side context (e.g., user-session associations, database lookups) rather than trusting workspaceId values supplied by the client.
- Treat workspace IDs and similar scoping identifiers as sensitive authorization parameters, enforcing strict, non-bypassable validation for every credential lookup.
- Avoid using truthiness checks to guard access control logic; prefer explicit validation of allowed value sets and consistent handling of empty, null, or missing fields.
- Centralize access control decisions in a shared authorization layer that is reused by both builder and runtime components, minimizing the risk of partial or inconsistent fixes.
- Restrict exposure of stored credentials by returning only what is strictly necessary for the runtime, and consider token-scoping or proxying external API calls rather than handing raw secrets to clients.
- Apply least-privilege principles to all stored credentials so that any unauthorized access has limited blast radius.
How teams detect issues like this
Organizations can identify this class of issue through layered detection approaches:
- Static analysis and code scanning:
- Search for handlers that accept client-controlled IDs (workspaceId, projectId, tenantId) and immediately use them in database queries or access decisions.
- Flag conditional patterns where access control depends on generic truthy/falsy checks or where security-critical checks are gated by loosely validated inputs.
- Targeted code review:
- Review all endpoints that return or use credentials, secrets, or tokens, ensuring that authorization logic is consistent and independent of client-manipulable identifiers.
- Verify that both builder and runtime paths share the same authorization guarantees, especially after partial fixes for prior advisories.
- Runtime monitoring and logging:
- Log credential access events with the requesting user ID, workspace context, and credential owner workspace, then alert on cross-workspace access patterns.
- Use anomaly detection to identify unusual credential access volumes or patterns for low-privilege accounts.
- Security testing:
- Include multi-tenant access control tests in QA and security assessments, intentionally varying workspaceId or similar fields to confirm that unauthorized access is denied.

