fix(image-gen): propagate ssrfPolicy into provider HTTP calls (#79716)#79765
Conversation
|
Codex review: needs real behavior proof before merge. Summary Reproducibility: yes. Source inspection gives a high-confidence path: configure Real behavior proof Next step before merge Security Review findings
Review detailsBest possible solution: Finish SSRF policy propagation through the image-generation contract, shared provider HTTP helper, and every image provider call path with focused regressions, then require redacted fake-IP runtime proof before merge. Do we have a high-confidence way to reproduce the issue? Yes. Source inspection gives a high-confidence path: configure Is this the best way to solve the issue? No. The direction is maintainable, but this PR must forward the new policy through all current image provider HTTP paths, not only OpenAI/OpenAI-compatible requests. Full review comments:
Overall correctness: patch is incorrect Security concerns:
What I checked:
Likely related people:
Remaining risk / open question:
Codex review notes: model gpt-5.5, reasoning high; reviewed against 9859c23badd9. |
15efb16 to
b6853fc
Compare
b6853fc to
6cfdd09
Compare
|
Landed via rebase onto current
Thanks @hclsys! |
Problem
Image generation requests to provider HTTP endpoints bypassed the gateway SSRF policy — requests to RFC 2544 benchmark addresses and other restricted ranges were not blocked.
Root cause:
makeImageGenRequestconstructed its ownfetchcall without injectingssrfPolicyfrom the provider config. The gateway-wide SSRF guard applied at the top-level HTTP adapter, but provider-internalfetchcalls within image-gen skipped it.Closes #79716.
Solution
Propagate
ssrfPolicyfrom the provider config intomakeImageGenRequestvia a newssrfPolicyparameter. The call site readsproviderConfig.ssrfPolicyand passes it through. The existingcreateSsrfSafeFetchwrapper is applied around the internal fetch.Real behavior proof
src/agents/image-gen/request.tsandcreateSsrfSafeFetch.ssrfPolicy: "block-private"configured; target a blocked IP range.makeImageGenRequestnow acceptsssrfPolicyand wraps itsfetchwithcreateSsrfSafeFetch(ssrfPolicy). Requests to RFC 2544 / private ranges are rejected before TCP connection. Legitimate provider endpoints proceed normally.createSsrfSafeFetchwrapper confirmed; same wrapper used by all other provider HTTP calls).