Skip to content

fix(app): handle web basic auth startup credentials#28019

Open
n3crosis wants to merge 9 commits into
anomalyco:devfrom
n3crosis:copilot/fix-useglobal-sync-error
Open

fix(app): handle web basic auth startup credentials#28019
n3crosis wants to merge 9 commits into
anomalyco:devfrom
n3crosis:copilot/fix-useglobal-sync-error

Conversation

@n3crosis
Copy link
Copy Markdown

@n3crosis n3crosis commented May 17, 2026

Issue for this PR

Closes #15991
Closes #15238

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

When the web app is opened with HTTP Basic credentials in the URL, the app reads those credentials into the startup server connection while continuing to use a credential-free server URL. This lets SDK requests include the expected Basic Authorization header and avoids startup failures around the global sync provider.

The app now also removes startup credentials from the browser URL/history after extracting them, and terminal WebSocket fallback auth treats an empty password as valid Basic Auth instead of omitting auth.

Added focused coverage for parsing credentials from URLs and terminal auth token handling.

How did you verify your code works?

  • oxlint passes on changed files
  • Tests can be run locally: cd packages/app && bun test

Screenshots / recordings

N/A

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

If you do not follow this template your PR will be automatically rejected.

Copilot AI and others added 8 commits May 15, 2026 06:20
Agent-Logs-Url: https://github.com/n3crosis/opencode/sessions/49f38d9c-2304-442d-afb8-6159375148d5

Co-authored-by: n3crosis <11072158+n3crosis@users.noreply.github.com>
Agent-Logs-Url: https://github.com/n3crosis/opencode/sessions/49f38d9c-2304-442d-afb8-6159375148d5

Co-authored-by: n3crosis <11072158+n3crosis@users.noreply.github.com>
Agent-Logs-Url: https://github.com/n3crosis/opencode/sessions/49f38d9c-2304-442d-afb8-6159375148d5

Co-authored-by: n3crosis <11072158+n3crosis@users.noreply.github.com>
Agent-Logs-Url: https://github.com/n3crosis/opencode/sessions/49f38d9c-2304-442d-afb8-6159375148d5

Co-authored-by: n3crosis <11072158+n3crosis@users.noreply.github.com>
…sync-error

Co-authored-by: n3crosis <11072158+n3crosis@users.noreply.github.com>
Agent-Logs-Url: https://github.com/n3crosis/opencode/sessions/6f06909d-b09d-43ce-85ca-20f0912e0fd7

Co-authored-by: n3crosis <11072158+n3crosis@users.noreply.github.com>
Agent-Logs-Url: https://github.com/n3crosis/opencode/sessions/6f06909d-b09d-43ce-85ca-20f0912e0fd7

Co-authored-by: n3crosis <11072158+n3crosis@users.noreply.github.com>
Agent-Logs-Url: https://github.com/n3crosis/opencode/sessions/6f06909d-b09d-43ce-85ca-20f0912e0fd7

Co-authored-by: n3crosis <11072158+n3crosis@users.noreply.github.com>
@n3crosis n3crosis requested a review from adamdotdevin as a code owner May 17, 2026 11:09
Copilot AI review requested due to automatic review settings May 17, 2026 11:09
@github-actions github-actions Bot added needs:compliance This means the issue will auto-close after 2 hours. needs:issue labels May 17, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes web app startup when HTTP Basic credentials are provided in the URL, ensuring credentials are extracted for SDK/WebSocket auth while removed from the visible browser URL.

Changes:

  • Adds URL-based Basic Auth parsing alongside existing auth_token parsing.
  • Preserves empty-password Basic Auth credentials for SDK and terminal WebSocket fallback auth.
  • Adds focused tests for URL credential parsing and terminal auth token behavior.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
packages/app/src/entry.tsx Extracts startup auth from URL userinfo and clears credentials from browser history.
packages/app/src/utils/server.ts Adds authFromUrl and treats empty string passwords as valid credentials.
packages/app/src/utils/server.test.ts Covers URL credential parsing cases.
packages/app/src/utils/terminal-websocket-url.ts Sends terminal fallback auth when password is empty but defined.
packages/app/src/utils/terminal-websocket-url.test.ts Covers username-only startup credentials and undefined password behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@github-actions github-actions Bot removed needs:issue needs:compliance This means the issue will auto-close after 2 hours. labels May 17, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Thanks for updating your PR! It now meets our contributing guidelines. 👍

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.

Open an opencode url via basic auth will show error stack [Opencode Web]if password and user in url path. will show useGlobalSync error

3 participants