Summary
A missing authorization check in one-api allows an authenticated, low-privilege account to select arbitrary channel identifiers through a URL path parameter. The server may then send upstream requests using a channel's stored provider key, bypassing group restrictions and model allowlists.
Affected context
The vulnerability occurs in deployments where authenticated requests can reach the channel-selection route and where channel identifiers are accepted from URL parameters. The selected channel is loaded without verifying that it belongs to the requesting user or group, allowing the request to use channels outside the caller's authorized scope.
Exploit preconditions
- Attack surface: An authenticated API route that accepts a channel identifier
in the URL path
- Required access: A valid one-api API token; administrative privileges are
not required
- Trigger point: Channel selection during request distribution
- Why exploitation is possible: The path-parameter branch does not perform
the role, ownership, or group authorization checks applied to the alternate
channel-pinning path
- Resulting trust issue: The distributor can load an out-of-scope channel and
use its configured upstream credentials and endpoint
Why this happens
The underlying bug is an inconsistent authorization design. One channel-pinning path requires an administrative check, while another accepts a caller-controlled channel identifier after token authentication alone. The distributor then retrieves the referenced channel by numeric identifier without enforcing ownership, group membership, or equivalent policy scope. This maps to CWE-862: Missing Authorization, because a protected operation is reachable without checking whether the authenticated principal is permitted to perform it.
Potential impact
- A low-privilege account may access channels outside its assigned scope
- The server could make upstream requests using provider keys not granted to the account
- Per-group channel restrictions may be bypassed
- Model allowlists may be bypassed
- Provider quotas, billing accounts, or reputation could be misused
- Sensitive upstream responses or operational metadata could be exposed
General mitigation guidance
Mitigation generally focuses on enforcing authorization at the point where the
channel is selected and again before its credentials are used.
Common defensive patterns include:
- Applying the same role, ownership, group, and model-policy checks to every
channel-selection path
- Deriving permitted channels from the authenticated principal rather than
trusting a client-supplied identifier
- Centralizing channel authorization in a shared policy or service layer
- Using deny-by-default behavior when ownership or group scope is missing
- Avoiding exposure of provider credentials to request paths that have not passed
authorization
- Applying least privilege to channel records, upstream credentials, and provider
accounts
- Recording authorization decisions and limiting anomalous channel-selection
behavior
How teams detect issues like this
Detection approaches can include:
- Static analysis for route parameters that flow into resource lookups without
nearby authorization checks
- Code review searches for direct channel or tenant retrieval by client-supplied
identifiers
- Policy tests covering cross-user, cross-group, and non-administrative access
- Integration tests verifying that model allowlists and group restrictions are
enforced on every routing path
- Runtime logging of the authenticated principal, selected channel, group scope,
and authorization decision without recording secret values
- API gateway or application policies that reject channel selections outside the
caller's resolved authorization scope
Automated review tools may help identify inconsistent checks, but authorization
behavior should also be validated with end-to-end tests.

