Skip to content

Studio: allow opt-in unauthenticated API access on LAN - #9611

Closed
Etherll wants to merge 10 commits into
unslothai:mainfrom
Etherll:feat/studio-lan-no-auth-api
Closed

Etherll wants to merge 10 commits into
unslothai:mainfrom
Etherll:feat/studio-lan-no-auth-api

Conversation

@Etherll

@Etherll Etherll commented Aug 24, 2026

Copy link
Copy Markdown
Collaborator

Summary

Adds an opt-in setting that lets private-network clients call Studio's OpenAI-compatible /v1 API without a password or API key. Authentication remains required for the Studio UI and non-/v1 routes, and
the option defaults to off.

Motivation

Local agents on a trusted Wi-Fi or wired network should be able to use a loaded model without distributing Studio credentials. The exception must remain limited to private LAN traffic and fail closed
everywhere else.

Changes

  • Add the persisted lan_access_unauthenticated_api setting, defaulted to false, and expose it through the LAN status response in studio/backend/utils/lan_access_settings.py:22.
  • Add a UI-session-only endpoint for changing the setting in studio/backend/routes/settings.py:2084.
  • Admit a LAN guest only when the request targets /v1, arrives through a private LAN listener from a private peer, and the opt-in is active in studio/backend/auth/authentication.py:160.
  • Reject malformed or invalid credentials instead of falling through to guest access.
  • Treat accepted LAN guests as external API clients so internal and saved-credential workflows remain unavailable in studio/backend/routes/inference.py:2516.
  • Add the Remote & LAN toggle, explanatory copy, trusted-network notice, and status text in studio/frontend/src/features/settings/components/lan-access-section.tsx:215.
  • Add backend coverage for listener boundaries, private and public addresses, credential precedence, launch-managed bindings, Colab restrictions, and fail-closed persistence in studio/backend/tests/ test_lan_access_settings.py:943.
  • Add frontend coverage for response normalization and read-only states in studio/frontend/tests/lan-access-state.test.ts:115.

How to test

Run the focused backend tests:

cd studio/backend
python -m pytest tests/test_lan_access_settings.py -q

Run the frontend tests and build checks:

cd studio/frontend
node --experimental-strip-types --test tests/lan-access-state.test.ts
npm run typecheck
npm run build

Manual browser and API check:

1. Open Settings > Remote & LAN.
2. Turn on "Allow API access without authentication" and start LAN access.
3. Load a model and open Studio through its private LAN address.
4. Without an Authorization header, confirm GET /v1/models and both streaming and non-streaming POST /v1/chat/completions requests succeed.
5. Confirm /api/settings/lan-access still returns 403 without authentication.
6. Confirm an invalid Bearer token is rejected instead of receiving guest access.
7. Turn the option off and confirm unauthenticated /v1 requests return 403.
8. Confirm enabling the saved preference without starting LAN access does not bypass authentication on loopback.

@Etherll
Etherll requested a review from danielhanchen as a code owner August 24, 2026 04:46
chatgpt-codex-connector[bot]

This comment was marked as resolved.

chatgpt-codex-connector[bot]

This comment was marked as resolved.

chatgpt-codex-connector[bot]

This comment was marked as resolved.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🚀

Reviewed commit: 12ffa0f37e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Aug 24, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Aug 24, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Aug 24, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Aug 24, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Aug 24, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Aug 24, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Aug 24, 2026
@Etherll

Etherll commented Aug 24, 2026 •

Copy link
Copy Markdown
Collaborator Author

UI evidence

Validated the visible Studio change at 12ffa0f against merge base edd81b4.

  • Before: the LAN access card had only Start automatically; the unauthenticated API control was absent.
  • After: Allow API access without authentication is present and enabled, and the trusted-network warning is visible.
  • Deterministic fact deltas: control_present false -> true, checked_after null -> true, warning_present false -> true.
  • Scene: lan_access_authentication
  • Browser: Chromium at 1500x900
pr9611_before_after

@Etherll

Etherll commented Aug 24, 2026

Copy link
Copy Markdown
Collaborator Author

Superseded by #9102, which now includes the private-LAN listener and peer checks, exact method/path allowlist, credential-precedence rules, browser-origin and root-path handling, address-family coverage, and API-monitor behavior from this PR. Consolidating on one implementation to avoid maintaining two authentication paths. Thank you.

@Etherll Etherll closed this Aug 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant