Skip to content

fix(api): treat cx/* and codex/* as equivalent API-key model permissions - #8805

Merged
diegosouzapw merged 1 commit into
cheaper-inference:release/v3.8.49from
Prudhvivuda:fix/8803-cx-codex-model-permissions
Jul 28, 2026
Merged

diegosouzapw merged 1 commit into
cheaper-inference:release/v3.8.49from
Prudhvivuda:fix/8803-cx-codex-model-permissions

Conversation

@Prudhvivuda

@Prudhvivuda Prudhvivuda commented Jul 27, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Dashboard Codex restrictions use the public cx/ alias, while /v1/responses normalizes bare Codex model IDs to codex/ before API-key permission checks.
  • Expand getModelPermissionCandidates via the provider registry alias map so cx/* and codex/* match for both allowedModels and blockedModels.
  • Adds regression coverage for allow/block alias equivalence and wildcard patterns.

Closes #8803

Test plan

  • node --import tsx/esm --test tests/unit/db-apiKeys-crud.test.ts
  • node --import tsx/esm --test tests/unit/apikeys-model-permissions-split.test.ts
  • Restrict an API key to cx/gpt-5.6-terra in the Dashboard, then POST /v1/responses with bare gpt-5.6-terra (or codex/gpt-5.6-terra) and confirm 200 instead of 403
  • Confirm openai/gpt-5.6-terra remains denied when only cx/gpt-5.6-terra* is allowed

Dashboard Codex restrictions use the public cx/ alias while /v1/responses
normalizes bare Codex IDs to codex/, so allow/block checks falsely 403'd.
Expand permission candidates via the provider registry alias map.

Closes cheaper-inference#8803
@Libsod

Libsod commented Jul 27, 2026 •

Copy link
Copy Markdown

Confirmed working end-to-end. With the API key restricted to cx/gpt-5.6-terra in the Dashboard, a /v1/responses request using the bare model ID gpt-5.6-terra now returns HTTP 200 OK.

Tested locally using this PR branch.

Also confirmed the negative case from the test plan:

When the API key only allows cx/gpt-5.6-terra*, a request using
openai/gpt-5.6-terra is still correctly rejected with HTTP 403 Forbidden.

So the alias expansion remains scoped to cx/* ↔ codex/* and does not
accidentally grant access to the OpenAI provider.

image

@diegosouzapw
diegosouzapw merged commit 3e6684e into cheaper-inference:release/v3.8.49 Jul 28, 2026
5 checks passed
diegosouzapw added a commit that referenced this pull request Jul 28, 2026
…0 test

file-size: apiKeys.ts 1518 -> 1529 (#8805, treating cx/* and codex/* as
equivalent provider prefixes in API-key model permissions) and chatCore.ts
5006 -> 5020 (#8806, passing the real response payload into plugin onResponse
hooks instead of a hardcoded {status:200}). Both extend existing call sites
rather than adding a branch.

stryker: account-fallback-cf1010-no-retry-8775.test.ts covers
accountFallback.ts but was missing from tap.testFiles, which would redden
Fast Quality Gates on every subsequent PR.
@diegosouzapw diegosouzapw mentioned this pull request Jul 28, 2026
HouMinXi pushed a commit to HouMinXi/OmniRoute that referenced this pull request Aug 2, 2026
…ons (cheaper-inference#8805)

Dashboard Codex restrictions use the public cx/ alias while /v1/responses
normalizes bare Codex IDs to codex/, so allow/block checks falsely 403'd.
Expand permission candidates via the provider registry alias map.

Closes cheaper-inference#8803
HouMinXi pushed a commit to HouMinXi/OmniRoute that referenced this pull request Aug 2, 2026
…0 test

file-size: apiKeys.ts 1518 -> 1529 (cheaper-inference#8805, treating cx/* and codex/* as
equivalent provider prefixes in API-key model permissions) and chatCore.ts
5006 -> 5020 (cheaper-inference#8806, passing the real response payload into plugin onResponse
hooks instead of a hardcoded {status:200}). Both extend existing call sites
rather than adding a branch.

stryker: account-fallback-cf1010-no-retry-8775.test.ts covers
accountFallback.ts but was missing from tap.testFiles, which would redden
Fast Quality Gates on every subsequent PR.
muhamadgalihsaputra pushed a commit to niyatna/NiyatnaRoute that referenced this pull request Sep 27, 2026
…ons (cheaper-inference#8805)

Dashboard Codex restrictions use the public cx/ alias while /v1/responses
normalizes bare Codex IDs to codex/, so allow/block checks falsely 403'd.
Expand permission candidates via the provider registry alias map.

Closes cheaper-inference#8803
muhamadgalihsaputra pushed a commit to niyatna/NiyatnaRoute that referenced this pull request Sep 27, 2026
…0 test

file-size: apiKeys.ts 1518 -> 1529 (cheaper-inference#8805, treating cx/* and codex/* as
equivalent provider prefixes in API-key model permissions) and chatCore.ts
5006 -> 5020 (cheaper-inference#8806, passing the real response payload into plugin onResponse
hooks instead of a hardcoded {status:200}). Both extend existing call sites
rather than adding a branch.

stryker: account-fallback-cf1010-no-retry-8775.test.ts covers
accountFallback.ts but was missing from tap.testFiles, which would redden
Fast Quality Gates on every subsequent PR.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Dashboard cx/* restrictions do not allow bare Codex model IDs normalized to codex/*

3 participants