[GH-ISSUE #212] GET /status needs no API key and returns the end of the last answer #110

Closed
opened 2026-11-04 01:40:02 +07:00 by bsakaguchi · 2 comments
Owner

Originally created by @alphastorm on GitHub (Sep 30, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/212

With an API key configured, /v1/*, /slots, /props, /metrics, /settings and /mcp answer 401 without it, and docs/DETAILS.md says the metadata endpoints and /slots require the key. GET /status (serve/server.py#L1312-L1323) does not check it, and its answer includes tail, the last 600 characters of the generated text (#L781), and tool, the tool being called. tail is not cleared when the request ends (#L916 resets only busy), so /status keeps returning the end of the most recent answer while the server is idle.

So anything that can reach the port can read the model's output without the key: every local process on the default 127.0.0.1, and the network with --host 0.0.0.0.

Reproduce (v0.1.27, a790805, mock engine)

python serve/server.py --engine mock --port 18095 --api-key secret \
  --script $'</think>\n\nThe meeting moved to Thursday; the door code is 4417.'
curl -s http://127.0.0.1:18095/v1/chat/completions -H 'Authorization: Bearer secret' \
  -H 'Content-Type: application/json' -d '{"model": "x", "messages": [{"role": "user", "content": "hi"}], "max_tokens": 64}'

curl -s http://127.0.0.1:18095/status     # no key
curl -s http://127.0.0.1:18095/slots      # no key

After the request has finished, /status without the key returns:

{"busy": false, "queued": 0, "phase": "answering", "prompt_tokens": 246, "generated": 63, "tool": null, "tail": "The meeting moved to Thursday; the door code is 4417.", "max_tokens": 64}

/slots, /v1/status and /v1/models without the key return 401 missing or wrong API key.

Suggested fix

Require the key on /status as on /slots (nothing in serve/web reads /status), or keep it open without tail and tool. Clearing tail when a request ends would also stop it from outliving the request.

Originally created by @alphastorm on GitHub (Sep 30, 2026). Original GitHub issue: https://github.com/Niko1221/Strata/issues/212 With an API key configured, `/v1/*`, `/slots`, `/props`, `/metrics`, `/settings` and `/mcp` answer 401 without it, and [docs/DETAILS.md](https://github.com/Niko1221/Strata/blob/a79080535d1b2a71a3419a0d97d8e7dca194b0f1/docs/DETAILS.md#L302-L306) says the metadata endpoints and `/slots` require the key. `GET /status` ([serve/server.py#L1312-L1323](https://github.com/Niko1221/Strata/blob/a79080535d1b2a71a3419a0d97d8e7dca194b0f1/serve/server.py#L1312-L1323)) does not check it, and its answer includes `tail`, the last 600 characters of the generated text ([#L781](https://github.com/Niko1221/Strata/blob/a79080535d1b2a71a3419a0d97d8e7dca194b0f1/serve/server.py#L781)), and `tool`, the tool being called. `tail` is not cleared when the request ends ([#L916](https://github.com/Niko1221/Strata/blob/a79080535d1b2a71a3419a0d97d8e7dca194b0f1/serve/server.py#L916) resets only `busy`), so `/status` keeps returning the end of the most recent answer while the server is idle. So anything that can reach the port can read the model's output without the key: every local process on the default 127.0.0.1, and the network with `--host 0.0.0.0`. ### Reproduce (v0.1.27, `a790805`, mock engine) ```sh python serve/server.py --engine mock --port 18095 --api-key secret \ --script $'</think>\n\nThe meeting moved to Thursday; the door code is 4417.' ``` ```sh curl -s http://127.0.0.1:18095/v1/chat/completions -H 'Authorization: Bearer secret' \ -H 'Content-Type: application/json' -d '{"model": "x", "messages": [{"role": "user", "content": "hi"}], "max_tokens": 64}' curl -s http://127.0.0.1:18095/status # no key curl -s http://127.0.0.1:18095/slots # no key ``` After the request has finished, `/status` without the key returns: ```json {"busy": false, "queued": 0, "phase": "answering", "prompt_tokens": 246, "generated": 63, "tool": null, "tail": "The meeting moved to Thursday; the door code is 4417.", "max_tokens": 64} ``` `/slots`, `/v1/status` and `/v1/models` without the key return 401 `missing or wrong API key`. ### Suggested fix Require the key on `/status` as on `/slots` (nothing in `serve/web` reads `/status`), or keep it open without `tail` and `tool`. Clearing `tail` when a request ends would also stop it from outliving the request.
Author
Owner

@Niko1221 commented on GitHub (Sep 30, 2026):

Confirmed, thanks. In 0.1.28 (in testing) /status requires the key like /v1/*, and the answer's end is not kept after the request.

<!-- gh-comment-id:5908107040 --> @Niko1221 commented on GitHub (Sep 30, 2026): Confirmed, thanks. In 0.1.28 (in testing) `/status` requires the key like `/v1/*`, and the answer's end is not kept after the request.
Author
Owner

@Niko1221 commented on GitHub (Sep 30, 2026):

Fixed in 0.1.28: /status needs the API key when one is set, and the answer's end is dropped when the request finishes.

<!-- gh-comment-id:5908631198 --> @Niko1221 commented on GitHub (Sep 30, 2026): Fixed in [0.1.28](https://github.com/Niko1221/Strata/releases/tag/v0.1.28): `/status` needs the API key when one is set, and the answer's end is dropped when the request finishes.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Niko1221/Strata#110
No description provided.