-
Notifications
You must be signed in to change notification settings - Fork 1.1k
[WRONG BRANCH] fix(providers): let field-masked writes reach canonical OpenAI past stored overlays #4447
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
Closed
Veritas-7
wants to merge
3
commits into
lidge-jun:main
from
Veritas-7:fix/openai-patch-operator-overlays
+100
−3
Closed
[WRONG BRANCH] fix(providers): let field-masked writes reach canonical OpenAI past stored overlays #4447
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
71985dc
fix(providers): let field-masked writes reach canonical OpenAI past s…
Veritas-7 726d2dd
fix(providers): let field-masked writes reach canonical OpenAI past s…
Veritas-7 ed96552
fix(providers): let field-masked writes reach canonical OpenAI past s…
Veritas-7 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
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.
🔒 Security & Privacy | 🛡️ Analyzed with Security Review | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
grep -n "function providerManagementConfigError" src/server/management/provider-routes.ts -A 80Repository: lidge-jun/opencodex
Length of output: 157
🏁 Script executed:
rg "function providerManagementConfigError" src/ --type ts -A 80Repository: lidge-jun/opencodex
Length of output: 6949
🏁 Script executed:
Repository: lidge-jun/opencodex
Length of output: 8652
🏁 Script executed:
Repository: lidge-jun/opencodex
Length of output: 6821
🏁 Script executed:
sed -n '600,750p' src/server/auth-cors.tsRepository: lidge-jun/opencodex
Length of output: 8682
🏁 Script executed:
Repository: lidge-jun/opencodex
Length of output: 16754
SSRF
Reachability: External
Exploitability: Difficult
CWE: CWE-918 — Server-Side Request Forgery (SSRF)
Canonical OpenAI PATCH allows
allowPrivateNetworkbypass viamatchesCanonicalProviderSeed.The
matchesCanonicalProviderSeedfunction at lines 616–619 validates only keys present in the registry seed. Because the canonical OpenAI seed does not defineallowPrivateNetwork, a PATCH request can injectallowPrivateNetwork: truewithout triggering the canonical seed check. This field is not deleted from the validation candidate (unlikepinnedReasoningEffort,modelCosts,requestPacing, etc.), so it passes through to persistence. Downstream code inproviderDestinationConfigErrorandproviderDestinationResolvedErrorthen consults this persisted flag to permit private-network destination access, enabling SSRF to internal metadata endpoints or RFC 1918 addresses.Add
allowPrivateNetworkto the field deletions for canonical OpenAI before the seed comparison, and cover the PATCH path with a regression test to prevent this field from being smuggled into canonical providers.Proposed fix
// Same category: annotating empty tool outputs is a user-owned request-shaping preference, // not part of the canonical transport seed. Without this the field is accepted by // validation and then rejected by the seed comparison, so canonical OpenAI could never // set OR clear it — the value was admitted and then refused in the same request. delete canonicalCandidate.annotateEmptyToolOutputs; + // allowPrivateNetwork is an explicit operator opt-in for non-registry destinations. + // Canonical OpenAI must never include it; reject any attempt to smuggle it via PATCH. + delete canonicalCandidate.allowPrivateNetwork; const canonical = seed && (options?.allowOperatorOverlays🤖 Prompt for AI Agents