Repository navigation
feat: enforce key data controls and record token details - #85
Merged
Merged
Conversation
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configuration
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
multillm-proxy | 8b67b1d | Oct 20 2026, 11:12 AM |
ALikesToCode
marked this pull request as ready for review
October 20, 2026 11:19
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Keys can require official provider classes and enforce OpenRouter preferences for an app whose requests carry personal data. Direct non-official calls return 403
provider_class_not_allowed; automatic, cascade and managed routes filter concrete candidates. The Limits form and key-controls API expose both controls. Forced values override caller preferences while retaining a caller'sdata_collection: "deny".Provider HTTP and SDK dispatch now share one admission boundary per runtime:
services/provider_dispatch.pyandworker/provider-dispatch.mjs. Every send rereads current durable controls. The version-1data_policyenvelope requires both explicit fields; absent, malformed or unsupported policies, missing accounts and store outages refuse dispatch. Bootstrap administrative recovery remains separate from generation authority. Restricted requests select the operator's current attested credential after adapters, pooling and fallback selection; cached credentials cannot recover a missing binding.The boundaries cover native and unified protocols, media creation and retrieval, video polling and watches, audio, embeddings, async and batch execution, Realtime, roleplay, shadow evaluation, intelligence and Knowledge/MCP. Deferred work retains identity and rereads policy. Knowledge ingestion and imported-skill watches retain their source account across scheduling and retries; legacy ownerless imports refuse upstream checks until explicitly imported again. Realtime checks ticket issuance and socket admission. Realtime and roleplay refuse forced preferences because those complete transports cannot enforce them. Controlled requests are excluded from shadow sampling, and replay rechecks its source before candidate and judge dispatch. Restricted paid-tier requests reject caller credential overrides and use only the current attested operator binding.
Credential injection is limited to each provider's allowlisted API origins. Public video assets remain policy-admitted but receive no API credentials, including during relay and storage copying. Downloads follow at most five HTTPS redirects, rechecking admission at every hop and permanently stripping credential headers after an origin change. Unresolved redirects fail instead of returning redirect pages as video. Vertex resolves a fresh token from the current operator service-account or OAuth binding; missing, malformed or changed bindings refuse dispatch.
The static inventory now pins every runtime source module independently of transport spelling. A session-wide socket audit hook covers Python connections, including extension sockets. Worker guards cover fetch, Node HTTP and socket transports; replacing fetch in tests retains the guard. Provider SDK and index binding doubles share a factory that checks admission on every method, nested handle and replacement method. Capabilities exist only during admitted operations and are revoked after success or failure. Mutation regressions exercise alternate clients from unlisted modules, extension-socket connects, and removal of both provider SDK admission wrappers. Separate control traffic uses destination-bound scopes; disposable D1 fixtures register only their own loopback ports. Private persistence, storage management, authentication, telemetry, public capability metadata and webhook delivery remain separate from provider generation.
Provider-reported cached input and reasoning tokens persist in events and per-key/model totals. The Usage page displays cache-hit percentage and reasoning tokens. Unreported event details remain null; cache-hit percentage is cached input divided by all recorded input in the group. The optional budget webhook is omitted.
Rollout: apply
0041_key_data_guards.sql,0042_usage_token_details.sqland0043_integration_data_policy.sqlthrough the migration runner; deploy the matching Worker, including the private Knowledge Worker; deploy the Container; enable controls last. Existing keys remain unrestricted until configured. Mixed-version responses fail closed. The unmigrated-account fixture excludes the dependent ALTER migrations and retains its refusal assertions. This branch starts independently from main.Provider classification and evidence are documented in key data controls. Uncertainties: chutes/nineteen use conservative reseller tags; local runners and legacy aliases use conservative free tags; relay/pool sourcing and current terms remain unverified; hyperbolic's historical inference endpoint needs availability confirmation. Paid-tier classification requires operator attestation of the configured credential.
Validation: Full Python, Worker and local D1 integration suites passed through the shared test lock (5,275 Python tests plus 975 subtests, with 2 skipped; 1,954 Worker tests; 7 integration tests). Integration explicitly selected the virtualenv Python. Credential-origin, relay/storage redirects, runtime bypass mutations and current Vertex binding regressions passed. Disabling socket auditing broke both extension-socket regressions; removing the two SDK admission wrappers broke seven of the eight original binding tests. Fatal lint, type checks across 290 source files, static secret scans, whitespace checks, and confidentiality and publication-attribution greps passed. No deployment or remote migration was performed.
Existing oversized files retain scoped integration changes:
services/auth_service.py(1,261 lines),services/proxy_service.py(3,437 lines), andtests/test_cloudflare_worker.mjs(4,165 lines). Admission lives in separate modules. Safe follow-up boundaries are account SQL persistence, provider transport orchestration, and protocol-specific Worker fixtures, respectively. Extracting those unrelated responsibilities here would expand the security change.