Repository navigation
server : do not forward --api-key-file to router-spawned child instances - #28938
Conversation
In router mode, authentication belongs to the router. unset_reserved_args() already unset LLAMA_API_KEY, but did not unset LLAMA_ARG_API_KEY_FILE. When --api-key-file was passed, children re-validated against file keys only, causing clients using --api-key to 401 on chat completions (ggml-org#28820). In addition, router internal calls without auth headers (such as POST /v1/streams/lookup and DELETE /v1/stream) were silently rejected with 401. Unset LLAMA_ARG_API_KEY_FILE in unset_reserved_args() so no API keys reach child instances. This keeps keys out of child argv, ensures all keys the router accepts work end-to-end, and prevents router internal stream calls from 401ing. Fixes ggml-org#28820
|
I ran the full matrix on master with and without the line, router mode with --api-key and --api-key-file together, plus the preset INI and environment variable paths:
|
ServeurpersoCom
left a comment
There was a problem hiding this comment.
LGTM. Clear improvement in router mode, inert in single model mode
|
And to be sure: the CLI key never reached the child in the first place, so the line changes nothing for --api-key alone, and the whole fix lands on --api-key-file, which is the nominal case and the one that leaves a child asking for a key the router never sends on its two internal calls. I don't see a case where you would need both flags at the same time, and I think the simplest thing would be to reject them when they are passed together. --api-key 6614372 alone:
--api-key-file keys.txt alone:
|
|
Hi @ggerganov , @allozaur Could you please have a look at this PR when you get a chance? I believe it is a clean merge. Thanks |
|
cc @ngxson because he has the router's architecture in mind :) |
…ces (ggml-org#28938) In router mode, authentication belongs to the router. unset_reserved_args() already unset LLAMA_API_KEY, but did not unset LLAMA_ARG_API_KEY_FILE. When --api-key-file was passed, children re-validated against file keys only, causing clients using --api-key to 401 on chat completions (ggml-org#28820). In addition, router internal calls without auth headers (such as POST /v1/streams/lookup and DELETE /v1/stream) were silently rejected with 401. Unset LLAMA_ARG_API_KEY_FILE in unset_reserved_args() so no API keys reach child instances. This keeps keys out of child argv, ensures all keys the router accepts work end-to-end, and prevents router internal stream calls from 401ing. Fixes ggml-org#28820
…ces (ggml-org#28938) In router mode, authentication belongs to the router. unset_reserved_args() already unset LLAMA_API_KEY, but did not unset LLAMA_ARG_API_KEY_FILE. When --api-key-file was passed, children re-validated against file keys only, causing clients using --api-key to 401 on chat completions (ggml-org#28820). In addition, router internal calls without auth headers (such as POST /v1/streams/lookup and DELETE /v1/stream) were silently rejected with 401. Unset LLAMA_ARG_API_KEY_FILE in unset_reserved_args() so no API keys reach child instances. This keeps keys out of child argv, ensures all keys the router accepts work end-to-end, and prevents router internal stream calls from 401ing. Fixes ggml-org#28820 (cherry picked from commit 982a332)
Overview
In router mode, authentication belongs to the router. unset_reserved_args() already unset LLAMA_API_KEY, but did not unset LLAMA_ARG_API_KEY_FILE. When --api-key-file was passed, children re-validated against file keys only, causing clients using --api-key to 401 on chat completions (#28820). In addition, router internal calls without auth headers (such as POST /v1/streams/lookup and DELETE /v1/stream) were silently rejected with 401.
Unset LLAMA_ARG_API_KEY_FILE in unset_reserved_args() so no API keys reach child instances. This keeps keys out of child argv, ensures all keys the router accepts work end-to-end, and prevents router internal stream calls from 401ing.
Fixes #28820
Additional information
Implements the approach suggested by @ServeurpersoCom in #28820 (comment)
Requirements