Skip to content

fix(auth): declare UTF-8 on callback success/error pages#499

Merged
platinummonkey merged 1 commit into
DataDog:mainfrom
srosenthal-dd:stephen.rosenthal/fix-callback-utf8-charset
May 12, 2026
Merged

fix(auth): declare UTF-8 on callback success/error pages#499
platinummonkey merged 1 commit into
DataDog:mainfrom
srosenthal-dd:stephen.rosenthal/fix-callback-utf8-charset

Conversation

@srosenthal-dd
Copy link
Copy Markdown
Member

Summary

Localhost callback page rendered non-ASCII org names as mojibake — a Japanese-named org like Datadog れお 🚲🌤️🌷 データドッグ showed up as Datadog れ㊠🚲🌤ï¸ðŸŒ· データドッグ. Root cause: the HTTP response sent Content-Type: text/html with no charset, so browsers fell back to Latin-1 / Windows-1252 and decoded the UTF-8 bytes one at a time.

Changes

  • src/auth/callback.rs:190 — add ; charset=utf-8 to the Content-Type header.
  • src/auth/callback.rs:245, :275 — add <meta charset="utf-8"> to the success and error page <head> blocks (defense in depth, in case the file is ever saved/reopened without HTTP headers).

Content-Length is unchanged — String::len() returns byte length, which is what the header wants for UTF-8.

Follow-up to #480, which introduced the org name in the callback page.

Test plan

  • cargo test --bin pup auth::callback — 20/20 pass
  • cargo clippy --bin pup --all-targets -- -D warnings clean
  • cargo fmt --check clean
  • End-to-end: login flow against an org with Japanese characters + emoji in its name — renders correctly in browser

The localhost callback response sent `Content-Type: text/html` with no
charset, so browsers fell back to Latin-1 / Windows-1252 and rendered
non-ASCII org names (ex: "Datadog れお 🚲🌤️🌷 データドッグ") as mojibake.

Add `; charset=utf-8` to the HTTP header and a `<meta charset="utf-8">`
to both success and error page `<head>` blocks for defense in depth.
@srosenthal-dd srosenthal-dd marked this pull request as ready for review May 12, 2026 20:06
@srosenthal-dd srosenthal-dd requested a review from a team as a code owner May 12, 2026 20:06
@platinummonkey platinummonkey merged commit e169f46 into DataDog:main May 12, 2026
6 checks passed
@srosenthal-dd srosenthal-dd deleted the stephen.rosenthal/fix-callback-utf8-charset branch May 13, 2026 00:21
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.

2 participants