Summary
Langflow's API key deletion endpoint deletes API keys based solely on an identifier in the path, without verifying that the key belongs to the currently authenticated user.
Under shared or multi-tenant deployments, an authenticated user who can guess or enumerate API key identifiers may be able to delete other users' API keys, disrupting their workflows and access.
Affected context
This vulnerability appears in Langflow instances that:
- Expose the
delete_api_key_route()endpoint to authenticated users - Identify API keys by a path parameter such as
api_key_id - Operate in a multi-user or multi-tenant environment where users own distinct API keys
The risk is most pronounced where API key identifiers are predictable, discoverable, or can be inferred through UI, logs, or indirect enumeration.
Exploit preconditions
- Attack surface: HTTP API endpoint for API key management (e.g.,
/api/keys/{api_key_id}style routes). - Required access: Valid authenticated user session that passes the generic
get_current_active_usercheck. - Trigger point: Sending a DELETE request with an
api_key_idthat refers to an API key owned by another user. - Why exploitation is possible: The
delete_api_key()CRUD function is called without confirming ownership, so any authenticated user can request deletion of any key referenced by ID, provided they can supply a valid identifier.
Why this happens
The core issue is an authorization flaw where access control is enforced only at the level of "is this user authenticated?" and not "is this user authorized to manipulate this specific resource?".
The route handler accepts an api_key_id and calls delete_api_key() without validating that the corresponding API key belongs to the current user.
This pattern maps to CWE-639: Insecure Direct Object Reference, in which user-controlled identifiers directly reference internal objects without a resource-level ownership or permission check.
Potential impact
- Disruption of other users' workflows by deleting their API keys.
- Forced downtime for agents and integrations that depend on deleted keys.
- Indirect denial of service against specific users or teams by repeatedly removing their credentials.
- Potential loss of auditability and confusion in incident response due to unexpected key deletions.
General mitigation guidance
Effective mitigation centers on enforcing resource-level authorization for all operations that act on user-owned objects:
- Ensure that all CRUD operations for API keys verify ownership by combining the current user's identity with the resource identifier (e.g., look up keys by
(user_id, api_key_id)). - Apply "scoped queries" so database lookups automatically constrain resources to the authenticated user's context.
- Treat any operation on user-specific resources (create, read, update, delete) as needing explicit checks for tenancy and ownership, not just generic authentication.
- Where possible, design API endpoints so that identifiers are not globally meaningful but already scoped to the current user or tenant.
- Adopt a principle of least privilege, allowing users to affect only objects that are explicitly associated with their account or role.
How teams detect issues like this
Detection typically involves both code-level analysis and runtime monitoring:
- Static analysis / code review:
- Flag handlers that take IDs in path or query parameters and directly call data layer methods without passing or checking the current user context.
- Look for CRUD functions that accept only a resource ID (e.g.,
delete_api_key(id)) instead of(user_id, id)or similar scoped parameters. - Review multi-tenant resource access patterns for missing ownership or tenant checks.
- Policy enforcement:
- Establish coding standards that require authorization checks for all operations on user-owned resources.
- Use automated review tools or linters to identify endpoints that lack explicit access control annotations or ownership checks.
- Runtime signals:
- Monitor logs for repeated deletion attempts across multiple user IDs or key IDs originating from a single account.
- Add structured logging that records the requester identity, the target resource owner, and the outcome of authorization decisions.

