mirror of
https://github.com/headroomlabs-ai/headroom.git
synced 2026-11-22 13:29:19 +08:00
fix(proxy): add same-origin check to /v1/retrieve/tool_call
/v1/retrieve already rejects cross-origin requests; its sibling /v1/retrieve/tool_call did not. Add the same guard and cover it in the CSRF tests.
This commit is contained in:
@@ -5778,7 +5778,10 @@ def create_app(config: ProxyConfig | None = None) -> FastAPI:
|
||||
)
|
||||
|
||||
# CCR Tool Call Handler - for agent frameworks to call when LLM uses headroom_retrieve
|
||||
@app.post("/v1/retrieve/tool_call", dependencies=[Depends(_require_loopback)])
|
||||
@app.post(
|
||||
"/v1/retrieve/tool_call",
|
||||
dependencies=[Depends(_require_loopback), Depends(_require_same_origin)],
|
||||
)
|
||||
async def ccr_handle_tool_call(request: Request):
|
||||
"""Handle a CCR tool call from an LLM response.
|
||||
|
||||
|
||||
@@ -134,6 +134,7 @@ CSRF_GUARDED = [
|
||||
"/stats/reset",
|
||||
"/cache/clear",
|
||||
"/v1/retrieve",
|
||||
"/v1/retrieve/tool_call",
|
||||
"/v1/telemetry/import",
|
||||
"/admin/runtime-env",
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user