Skip to content

fix(app): encode server credentials as UTF-8 - #46225

Closed
sdivyanshu90 wants to merge 1 commit into
anomalyco:devfrom
sdivyanshu90:unicode-server-auth
Closed

sdivyanshu90 wants to merge 1 commit into
anomalyco:devfrom
sdivyanshu90:unicode-server-auth

Conversation

@sdivyanshu90

Copy link
Copy Markdown
Contributor

Issue for this PR

Closes #46224

Type of change

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

What does this PR do?

The app passed username:password directly to btoa(), which either encoded non-ASCII credentials with the wrong bytes or threw InvalidCharacterError. This change converts the credential string to UTF-8 bytes before standard Base64 encoding, matching the server decoder. Regression tests cover both Latin-1-range and multibyte credentials while preserving the existing ASCII result.

How did you verify your code works?

From packages/app at reduced process priority:

  • bun test src/utils/server.test.ts src/utils/server-health.test.ts src/utils/server-protocol.test.ts src/utils/server-compat.test.ts src/utils/terminal-websocket-url.test.ts — 30 tests passed
  • bun typecheck — passed

Screenshots / recordings

Not applicable. This changes authentication encoding logic without changing the rendered UI.

Checklist

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

@sdivyanshu90

Copy link
Copy Markdown
Contributor Author

Hi @Brendonovich, @Hona, could you please review this PR when you have a chance?

@sdivyanshu90

Copy link
Copy Markdown
Contributor Author

Hi @Hona @Brendonovich, could you please review this PR whenever you have some time. Thanks!

@kvnloo

kvnloo commented Sep 25, 2026

Copy link
Copy Markdown

Focused validation looks good on head 7adf3a3.

"bun test src/utils/server.test.ts"
→ 6 pass / 0 fail

The regression covers both sides of the compatibility boundary: ASCII credentials keep their existing encoding, while multibyte credentials round-trip through Basic auth correctly, including a 用户 / 秘密🔐 case.

That is a better invariant than testing only one accented password, because it verifies UTF-8 encoding and the existing decode path agree.

One caveat: the exact-head GitHub workflows currently show action_required rather than green, so I'm treating this as independent focused evidence, not CI qualification.

@github-actions

Copy link
Copy Markdown
Contributor

Automated PR Cleanup

Thank you for contributing to opencode.

Due to the high volume of PRs from users and AI agents, we periodically close older PRs using automated criteria so maintainers can focus review time on the most active and community-supported contributions.

This PR was closed because it matched the following cleanup criteria:

  • The PR was created more than 1 month ago
  • The PR had fewer than 2 positive reactions
  • Positive reactions are counted as thumbs-up, heart, celebration, or rocket reactions on the PR

PRs created within the last month are not affected by this cleanup.

If you believe this PR was closed incorrectly, or if you are still actively working on it, please leave a comment explaining why it should be reopened. A maintainer can review and reopen it if appropriate.

Thanks again for taking the time to contribute.

@sdivyanshu90

Copy link
Copy Markdown
Contributor Author

Hi @Hona, could you please reopen and review this PR when you have time? Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Web and desktop clients cannot authenticate with Unicode server credentials

2 participants