LocalAI/core/backend
LocalAI [bot] 70cf8ac546
fix(backend): resolve relative draft_model paths against the models dir (#9680)
* fix(backend): resolve relative draft_model paths against the models dir

The main model file and mmproj are joined with the configured models
directory before reaching the backend, but draft_model was sent
verbatim. With a relative draft_model in the YAML config, llama.cpp
opens the path from the backend process's CWD and fails with "No such
file or directory", forcing users to hard-code an absolute path.

Mirror the existing mmproj resolution: if draft_model is relative,
join it with modelPath. Absolute paths are passed through unchanged.

Adds an e2e regression test against the mock backend that asserts the
main model file, mmproj, and draft_model all arrive at the backend
resolved to absolute paths.

Closes #9675

Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
Assisted-by: Claude:claude-opus-4-7-1m [Read] [Edit] [Bash] [Write]

* fix(backend): always join draft_model with models dir (drop IsAbs shortcut)

The previous commit kept absolute draft_model paths intact via an
IsAbs check. That left a path-traversal vector open: a user-supplied
YAML config could set draft_model to /etc/passwd (or any other host
file the backend process can read) and the path would be sent through
unchanged.

filepath.Join cleans the leading slash from absolute components, so
joining unconditionally — the way mmproj already does — keeps the
result rooted at the configured models directory regardless of input.

Adds a second e2e spec that feeds an absolute draft_model into the
mock backend and asserts the path is clamped under modelsPath.

Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
Assisted-by: Claude:claude-opus-4-7-1m [Read] [Edit] [Bash]

---------

Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
Co-authored-by: Ettore Di Giacinto <mudler@localai.io>
2026-05-06 00:58:38 +02:00
..
audio_transform.go feat: add LocalVQE backend and audio transformations UI (#9640) 2026-05-04 22:07:11 +02:00
backend_suite_test.go feat: extract output with regexes from LLMs (#3491) 2024-09-13 13:27:36 +02:00
detection.go feat(sam.cpp): add sam.cpp detection backend (#9288) 2026-04-09 21:49:11 +02:00
diarization.go feat(api): add /v1/audio/diarization endpoint with sherpa-onnx + vibevoice.cpp (#9654) 2026-05-05 15:10:13 +02:00
diarization_test.go feat(api): add /v1/audio/diarization endpoint with sherpa-onnx + vibevoice.cpp (#9654) 2026-05-05 15:10:13 +02:00
embeddings.go feat(ui): Per model backend logs and various fixes (#9028) 2026-03-18 08:31:26 +01:00
face_analyze.go feat(face-recognition): add insightface/onnx backend for 1:1 verify, 1:N identify, embedding, detection, analysis (#9480) 2026-04-22 21:55:41 +02:00
face_embed.go feat(face-recognition): add insightface/onnx backend for 1:1 verify, 1:N identify, embedding, detection, analysis (#9480) 2026-04-22 21:55:41 +02:00
face_verify.go feat(face-recognition): add insightface/onnx backend for 1:1 verify, 1:N identify, embedding, detection, analysis (#9480) 2026-04-22 21:55:41 +02:00
image.go feat(ui): Per model backend logs and various fixes (#9028) 2026-03-18 08:31:26 +01:00
llm.go Respect explicit reasoning config during GGUF thinking probe (#9463) 2026-04-21 21:53:10 +02:00
llm_probe_test.go Respect explicit reasoning config during GGUF thinking probe (#9463) 2026-04-21 21:53:10 +02:00
llm_test.go feat(autoparser): prefer chat deltas from backends when emitted (#9224) 2026-04-04 12:12:08 +02:00
options.go fix(backend): resolve relative draft_model paths against the models dir (#9680) 2026-05-06 00:58:38 +02:00
options_internal_test.go feat(vllm): expose AsyncEngineArgs via generic engine_args YAML map (#9563) 2026-04-29 00:49:28 +02:00
rerank.go feat(ui): Per model backend logs and various fixes (#9028) 2026-03-18 08:31:26 +01:00
soundgeneration.go feat(ui): Per model backend logs and various fixes (#9028) 2026-03-18 08:31:26 +01:00
stores.go feat: add biometrics UI (#9524) 2026-04-24 08:50:34 +02:00
token_metrics.go feat(ui): Per model backend logs and various fixes (#9028) 2026-03-18 08:31:26 +01:00
tokenize.go feat: add distributed mode (#9124) 2026-03-30 00:47:27 +02:00
transcript.go feat: support word-level timestamps for faster-whisper (#9621) 2026-05-06 00:32:52 +02:00
tts.go feat(ui): Per model backend logs and various fixes (#9028) 2026-03-18 08:31:26 +01:00
vad.go feat: add distributed mode (#9124) 2026-03-30 00:47:27 +02:00
video.go feat(ui): Per model backend logs and various fixes (#9028) 2026-03-18 08:31:26 +01:00
voice_analyze.go feat: voice recognition (#9500) 2026-04-23 12:07:14 +02:00
voice_embed.go feat: voice recognition (#9500) 2026-04-23 12:07:14 +02:00
voice_verify.go feat: voice recognition (#9500) 2026-04-23 12:07:14 +02:00