dify icon indicating copy to clipboard operation
dify copied to clipboard

fix: ssrf, add internal ip filter when parse tool schema

Open zyssyz123 opened this issue 1 month ago • 3 comments

[!IMPORTANT]

  1. Make sure you have read our contribution guidelines
  2. Ensure there is an associated issue and you have been assigned to it
  3. Use the correct syntax to link this PR: Fixes #<issue number>.

Summary

Screenshots

Before After
... ...

Checklist

  • [ ] This change requires a documentation update, included: Dify Document
  • [x] I understand that this PR may be closed in case there was no previous discussion or issues. (This doesn't apply to typos!)
  • [x] I've added a test for each change that was introduced, and I tried as much as possible to make a single atomic change.
  • [x] I've updated the documentation accordingly.
  • [x] I ran dev/reformat(backend) and cd web && npx lint-staged(frontend) to appease the lint gods

zyssyz123 avatar Dec 12 '25 03:12 zyssyz123

The error happens because the rerank model validation logic in the HTTP API does not handle the llm_factory (the part after the @ in your model name) for rerank models, even though it does for LLMs. When you specify a rerank model like qwen3-reranker@GPUStack, the system tries to find a model with that exact name, but your rerank model is actually registered with the name and factory stored separately. This mismatch causes the API to report that the rerank model doesn't exist, even though it does.

To fix this, the rerank model validation should split the rerank_id into model name and factory (just like it does for LLMs) and use both when querying for the model. Until this is fixed in the code, a possible workaround is to register and reference your rerank model without the @factory suffix, or to patch the validation logic to use the same split/query approach as LLMs. For more details, see the relevant code and explanation here: chat.py and tenant_llm_service.py.

To reply, just mention @dosu.


How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other

Chat with Dosu Open in Cursor Join Discord Share on X

dosubot[bot] avatar Dec 12 '25 09:12 dosubot[bot]

Dose the chat model work?

KevinHuSh avatar Dec 15 '25 08:12 KevinHuSh

Dose the chat model work?

The chat model can work successfully.

YYtang6 avatar Dec 15 '25 12:12 YYtang6

same bug when calling create_chat or chat.update api with ragflow v0.22.1

zorazzz2 avatar Dec 16 '25 10:12 zorazzz2

same bug when calling create_chat or chat.update api with ragflow v0.22.1

the same http api

YYtang6 avatar Dec 17 '25 01:12 YYtang6