feat: two auth modes — local (auto-key) and public (paste-key)#790
Draft
malhotra5 wants to merge 1 commit into
Draft
feat: two auth modes — local (auto-key) and public (paste-key)#790malhotra5 wants to merge 1 commit into
malhotra5 wants to merge 1 commit into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
1f40a57 to
781cb28
Compare
781cb28 to
c85cefa
Compare
c85cefa to
cf6341f
Compare
Member
Author
Local mode (agent-canvas, no flags): - Ingress binds to 127.0.0.1 only - Auto-generates session API key - Writes /backends.json to static dir so frontend auto-authenticates - Zero setup for localhost use Public mode (agent-canvas --public): - Ingress binds to 0.0.0.0 (all interfaces) - Requires LOCAL_BACKEND_API_KEY env var - Does NOT write /backends.json - Frontend shows API key entry screen on 401 Co-authored-by: openhands <openhands@all-hands.dev>
cf6341f to
092e0bf
Compare
Contributor
📸 Snapshot Test ReportWarning Snapshot comparison step crashed (timeout, OOM, or runner error) — diff results below may be incomplete or absent. ❌ 1 snapshot differ from the main branch baseline. Add the
✅ Unchanged snapshots (72)
Generated by the Snapshot Tests workflow. This comment was created by an AI agent (OpenHands) on behalf of the repo maintainers. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.




Why
Right now
agent-canvasalways auto-generates a session API key and bakes it intoVITE_SESSION_API_KEYat build time. This is fine forlocalhost, but dangerous for VM deployments — anyone who can reach the frontend controls the computer, and the key is visible in the JS bundle.We need two distinct auth modes:
/backends.jsonLOCAL_BACKEND_API_KEYand paste it into the frontendSummary
agent-canvas, no flags): ingress binds to127.0.0.1, auto-generates a session API key, writes it to/backends.jsonso the frontend auto-authenticates — zero setup.agent-canvas --public): ingress binds to0.0.0.0, requiresLOCAL_BACKEND_API_KEYenv var, does NOT write/backends.json. Frontend shows a full-screen API key entry screen when/server_inforeturns 401.VITE_SESSION_API_KEY— keys are injected at runtime via/backends.json.How to Test
Local mode:
Public mode:
Missing key in public mode:
npx @openhands/agent-canvas --public # → Should fail immediately with a clear error messageHelp text:
npx @openhands/agent-canvas --help # → Should show both modes documentedType
Notes
/backends.json→ (3) build-timeVITE_SESSION_API_KEY/backends.jsonfor auto-auth (Docker always auto-generates keys)isAuthenticationError()to detect 401s, so it only shows when the server actually requires auth — standalone agent-servers without auth still work fineAUTH$API_KEY_REQUIRED_TITLE,AUTH$API_KEY_REQUIRED_DESCRIPTION,AUTH$API_KEY_PLACEHOLDER,AUTH$CONNECT) with all 15 languagesThis PR was created by an AI agent (OpenHands) on behalf of the user.
@malhotra5 can click here to continue refining the PR
🐳 Docker images for this PR
• GHCR package: https://github.com/OpenHands/agent-canvas/pkgs/container/agent-canvas
ghcr.io/openhands/agent-canvasghcr.io/openhands/agent-server:1.23.1-pythonopenhands-automation==1.0.0a5092e0bf9d1305839d57b965c5ce83d55408d1318Pull (multi-arch manifest)
# Multi-arch manifest — Docker automatically pulls the correct architecture docker pull ghcr.io/openhands/agent-canvas:sha-092e0bfRun
All tags pushed for this build
About Multi-Architecture Support
sha-092e0bf) is a multi-arch manifest supporting both amd64 and arm64sha-092e0bf-amd64) are also available if needed