mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #3366] [CLOSED] [Other] Let a trusted LAN serve without an API key via STRATA_ALLOW_KEYLESS_BIND env variable #4593
Labels
No labels
needs-format
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Niko1221/Strata#4593
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Niko1221/Strata/pull/3366
Author: @dsenchankau
Created: 10/20/2026
Status: ❌ Closed
Base:
main← Head:override-api-key-restriction📝 Commits (1)
40bd837Other: serve keyless on a trusted LAN behind STRATA_ALLOW_KEYLESS_BIND📊 Changes
4 files changed (+24 additions, -5 deletions)
View changed files
📝
docs/TERMINAL.md(+1 -1)📝
serve/server.py(+11 -2)📝
strata_cli/cli.py(+2 -2)📝
tests/terminal/test_profiles.py(+10 -0)📄 Description
Problem and result
Since v0.2.0-beta, the server started on
0.0.0.0refuses witha non-loopback bind requires an inference API keyand exit 2; Although0.0.0.0is not loopback, it's my local network, behind a firewall, and nothing else reaches it.Now, if you set
STRATA_ALLOW_KEYLESS_BIND=1in the environment where strata starts, bothstrata serveandlaunchchecks let the keyless bind through. The server prints a warning at startup so a stray env var stays visible:STRATA_ALLOW_KEYLESS_BIND is set: anyone who can reach this port can use the model. Unset or empty, nothing changes, same refusal, same message.Approach
One helper,
keyless_bind_allowed(), next toapi_key_ofinserve/server.py. Both gates call it: the server startup check and_launch_planinstrata_cli/cli.py, which already imports fromserve.server. The gate checks the effective host, so it doesn't matter whether the host comes from the run config or from--host. It is an env var rather than a flag: the check runs in the process that starts the server, and a flag would need plumbing through launch, the TUI and the app. It is only read when the bind is non-loopback and no key was configured.Validation
Passed:
.venv/bin/python -m unittest tests.terminal.test_profiles— 22 tests,OK. The newtest_keyless_non_loopback_bind_needs_the_opt_in_envplans a profile withhost=0.0.0.0, expects the refusal, and expects the plan to pass with the env var set..venv/bin/python -m unittest tests.terminal.test_launch—OK..venv/bin/python -m py_compile serve/server.py strata_cli/cli.py— no output (compiles).STRATA_ALLOW_KEYLESS_BIND=1 python serve/server.py --engine strata --config <run config> --host 0.0.0.0 --port 1337— the server started, no[strata] a non-loopback bind requires an inference API keyerror.Failed:
Not run:
Limits
envfield doesn't help: it feeds the engine subprocess, the gate reads the server's own environment at startup.--allow-keylessflag, nothing in the app or TUI.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.