You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
OpenHands Fork Audit - HIGH: get_litellm_model_info makes unvalidated httpx.get call at LLM init #4263
This is called from LLM._init_model_info_and_caps() (llm.py:619), which runs in post_init (during LLM object construction).
The call is gated on:
ifmodel.startswith("litellm_proxy/") andbase_url:
But the execution sequence matters:
In the agent-server, enforce_agent_llm_policy() is called at conversation start
This clamps the LLM model/base_url BEFORE an LLM object is constructed
So by the time _init_model_info_and_caps runs, the policy should have already filtered off-box models
However:
The SDK guard is the ONLY chokepoint if an LLM is constructed outside the agent-server (e.g., in unit tests, local SDK usage)
If a model starts with "litellm_proxy/" but base_url points off-box, the call proceeds
The _zentra_airgap.py guard in _prepare_transport_kwargs (line 2051) only fires on COMPLETION calls, not on post_init
Risk:
If the policy enforcement order changes or an LLM is constructed outside the agent-server path, an off-box base_url could trigger the httpx.get before the SDK call-boundary guard fires.
Fix guidance:
Add a call to assert_onbox_target() in _init_model_info_and_caps() BEFORE the httpx.get, OR gate the call on airgap_enforced(). Ensures the base_url is validated to the appliance endpoint before ANY HTTP call.
[Automatic Post]: This issue has been waiting for triage. @xingyaoww@neubig@enyst, could you
please take a look and add the appropriate priority label when you have a chance?
This comment was created by an AI agent (OpenHands) on behalf of the user.
[Automatic Post]: This issue has been waiting for triage. @xingyaoww@neubig@enyst, could you please take a look and add the appropriate priority label when you have a chance?
This comment was created by an AI agent (OpenHands) on behalf of the user.
[Automatic Post]: This issue has been waiting for triage. @xingyaoww@neubig@enyst, could you
please take a look and add the appropriate priority label when you have a chance?
This comment was posted by an AI agent (OpenHands) on behalf of the user.
[Automatic Post]: This issue has been waiting for triage. @xingyaoww@neubig@enyst, could you
please take a look and add the appropriate priority label when you have a chance?
This comment was created by an AI agent (OpenHands) on behalf of the user.
[Automatic Post]: This issue has had no activity for 32 days (labels: bug, needs-triage). @enyst@neubig@xingyaoww, could you take a look when you have a chance and help figure out next steps?
Generated by OpenHands automation on behalf of the user.
Closing as fork-specific: the air-gap guard it refers to (_zentra_airgap.py) only exists downstream. Upstream, querying the user-configured proxy is intended, and the timeout concern is tracked in #3912.
Activity
lxcxjxhx commentedon Jul 23, 2026
问题分析
这是一个典型的安全审计发现:在 LLM 初始化时,
get_litellm_model_info()函数会发起一个未经充分验证的 HTTP GET 请求到{base_url}/v1/model/info。虽然当前有litellm_proxy/前缀检查,但缺少对base_url本身的验证,可能导致在 airgap 环境中泄露请求到外部服务器。根因定位
问题出在
vendor/openhands-sdk/openhands/sdk/llm/utils/model_info.py:31:调用链:
LLM.__post_init__()→_init_model_info_and_caps()model.startswith("litellm_proxy/")且base_url存在,直接发起 HTTP 请求enforce_agent_llm_policy())虽然 agent-server 会在对话启动时验证 LLM 配置,但 SDK 本身缺少防护,在以下场景存在风险:
修复方案
方案 1:在 HTTP 请求前验证 base_url(推荐)
在
model_info.py中添加 base_url 验证:安全验证函数:
方案 2:集成 airgap 检查
如果系统启用了 airgap 模式,在 HTTP 请求前检查:
方案 3:延迟加载模型信息
将模型信息获取延迟到首次使用时,确保所有策略验证已完成:
测试用例
安全建议
环境限制说明:由于本地 Windows 环境缺少完整的 OpenHands 运行环境和 airgap 配置,无法进行完整的动态测试。以上修复方案基于代码审查和安全最佳实践,建议维护者在完整环境中验证。
需要我提交 PR 实现这个修复吗?
all-hands-bot commentedon Jul 30, 2026
[Automatic Post]: This issue has been waiting for triage. @xingyaoww @neubig @enyst, could you
please take a look and add the appropriate priority label when you have a chance?
This comment was created by an AI agent (OpenHands) on behalf of the user.
all-hands-bot commentedon Jul 31, 2026
[Automatic Post]: This issue has been waiting for triage. @xingyaoww @neubig @enyst, could you please take a look and add the appropriate priority label when you have a chance?
This comment was created by an AI agent (OpenHands) on behalf of the user.
all-hands-bot commentedon Aug 2, 2026
[Automatic Post]: This issue has been waiting for triage. @xingyaoww @neubig @enyst, could you
please take a look and add the appropriate priority label when you have a chance?
This comment was posted by an AI agent (OpenHands) on behalf of the user.
all-hands-bot commentedon Aug 3, 2026
[Automatic Post]: This issue has been waiting for triage. @xingyaoww @neubig @enyst, could you
please take a look and add the appropriate priority label when you have a chance?
This comment was created by an AI agent (OpenHands) on behalf of the user.
all-hands-bot commentedon Sep 4, 2026
[Automatic Post]: This issue has had no activity for 32 days (labels: bug, needs-triage). @enyst @neubig @xingyaoww, could you take a look when you have a chance and help figure out next steps?
Generated by OpenHands automation on behalf of the user.
VascoSch92 commentedon Oct 12, 2026
Closing as fork-specific: the air-gap guard it refers to (
_zentra_airgap.py) only exists downstream. Upstream, querying the user-configured proxy is intended, and the timeout concern is tracked in #3912.