forked from lidge-jun/opencodex
-
Notifications
You must be signed in to change notification settings - Fork 0
fix(vision): bind generated capabilities to provider transport #581
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
luvs01
wants to merge
3
commits into
dev
Choose a base branch
from
codex/propose-fix-for-vision-sidecar-vulnerability
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
f700c56
test(openai-chat): declare role acceptance in suites that assert the …
devin-ai-integration[bot] a2aadb7
fix(vision): bind metadata to provider transport
luvs01 3cb3d0a
fix(vision): validate transport against the registry entry owning a m…
devin-ai-integration[bot] File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -116,6 +116,29 @@ export function providerMatchesRegistryTransport( | |
| return normalizedProviderEndpoint(provider.baseUrl) === normalizedProviderEndpoint(entry.baseUrl); | ||
| } | ||
|
|
||
| /** | ||
| * `providerMatchesRegistryTransport` for a configured name that may be a generated-metadata | ||
| * ALIAS rather than a registry id. | ||
| * | ||
| * A registry row claims extra names through `extraMetadataAliases` (`gemini` for `google`, | ||
| * `anthropic-key` for `anthropic`, ...), and `resolveMetadataProvider` resolves those names — | ||
| * case-folded, the way saved provider keys arrive — to the row's metadata bundle. A provider | ||
| * saved under an alias is owned by the declaring entry, so its transport must be validated | ||
| * against that entry; an id-only lookup finds no `gemini` row and would drop a verdict the | ||
| * registry still owns. | ||
| */ | ||
| export function providerMatchesRegistryTransportOrAlias( | ||
| name: string, | ||
| provider: Pick<OcxProviderConfig, "baseUrl" | "adapter"> & Partial<Pick<OcxProviderConfig, "authMode">>, | ||
| ): boolean { | ||
| const lower = name.toLowerCase(); | ||
| const entry = getProviderRegistryEntry(name) | ||
| ?? PROVIDER_REGISTRY.find(row => | ||
| row.id.toLowerCase() === lower | ||
| || (row.extraMetadataAliases ?? []).some(alias => alias.toLowerCase() === lower)); | ||
| return entry !== undefined && providerMatchesRegistryTransport(entry.id, provider); | ||
|
Comment on lines
+130
to
+139
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| } | ||
|
|
||
| /** | ||
| * Resolve the registry entry a configured provider actually points at, by TRANSPORT | ||
| * rather than by name. | ||
|
|
||
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
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
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
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
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🟡 Metadata aliases still misclassify custom destinations
A custom
gemini,anthropic-key, or case-varied provider is accepted through its metadata owner. Routing preserves that custom transport, so generated capabilities can still divert or strip its images.Learn more
extraMetadataAliasesfeeds generated model metadata, but it is not a routing alias. The router looks up registry entries by the exact configured provider name in routedProviderConfig. Therefore, a configured provider namedgeminikeeps its own adapter and base URL, while this helper finds thegooglerow and appliesgoogle's permissive transport rule. The same mismatch affects aliases such asanthropic-keyand case-varied registry names.Example: Configure
geminiwithadapter: "openai-chat"andbaseUrl: "https://operator.example/v1". Routing sends requests to that endpoint unchanged. This helper resolvesgeminitogoogle, returns true becausegoogledoes not setpreserveCustomDestination, and a generated text-only verdict can send the image to a sidecar or strip it.Recommended fix: For names that are not exact registry IDs, require the configured adapter, auth mode, and normalized endpoint to match the resolved alias owner directly. Do not reuse the owner's pinning rule, because routing does not canonicalize
extraMetadataAliases. Add regression coverage for a custom alias-named destination and a case-varied custom provider.Was this helpful? React with 👍 or 👎 to provide feedback.