Repository navigation
fix(settings): drop a trailing host dot from the Public URL (abilityai/trinity#3881) - #3904
Conversation
A Public URL like https://host.example.com. was stored as typed, and every Telegram bot was re-registered there. The TLS certificate is for the name without the dot, so Telegram's check failed and no message arrived while the bot showed Connected. normalize_public_url strips the dot (keeping port and path). The save path stores and re-points with the clean value, and get_public_chat_url normalises on read, so a row stored earlier or a dotted PUBLIC_CHAT_URL env never reaches a webhook, public link or WhatsApp URL either. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
CodeQL flagged the trailing-dot regex as polynomial on user input. Split the authority into userinfo, host and port with rpartition and rstrip the host instead. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…3881) Telegram startup re-registration and connect, WhatsApp and VoIP read the public_chat_url row directly and skipped normalisation, so a row stored with a trailing dot before this fix was re-registered at every boot. They now call settings_service.get_public_chat_url_setting(), which is the same row-only read, normalised. The portal's local resolver copy normalises too. A scan test fails if a raw row read comes back. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
/review + /validate-prVerdict: APPROVE after fixes (review requested changes for C1; fixed below). CodeQL alert #458 ( Review
Fixed after review
Not changed, by design: the admin read of the raw row ( Open: the manual tunnel + |
|
Regression details (head_sha: `7bbf917fbad7e7940d469f0465911c608142d931`)Seed Backend unit-suite regression diffPer-XML totals
❌ New failures introduced by HEAD (1)Tests failing under HEAD that did not fail under BASE in any seed:
Legend: [F] = assertion failure, [E] = collection or fixture error. Reproduce locally: |
…; pin the portal mirror (#3881) — mechanical, per the merge-train note on the PR Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
|
merge-train (2026-10-23): pushed to your branch Two mechanical fixes landed on 1. The validator found that Tests added to
Both were red before the guard (the exact 2. The portal mirror is pinned —
Test run: The PR body was also patched from No approval, label or merge from the train — that stays with the owner. |
Summary
settings_service.normalize_public_url: trims whitespace and a trailing/(as before) and drops a trailing dot from the host, keeping port and path.https://host.example.com./→https://host.example.com.PUT /api/settings/public_chat_urlstores, and re-points Telegram webhooks at, the normalised value.get_public_chat_url()(public links, paid chat) normalises on read too, and the webhook registrars that read the stored row directly (Telegram startup re-registration and connect, WhatsApp, VoIP) now call the newget_public_chat_url_setting(), the same row-only read, normalised. The portal's local resolver copy normalises too. So a row stored before this fix, or a dottedPUBLIC_CHAT_URLenv value, is handed out clean. No migration needed. A scan test fails if a raw row read returns.Chose "strip" over "refuse with 422" from the AC: an absolute name is the same name, and refusing would leave an existing dotted row in force.
Not in this PR: the optional follow-up to show Telegram's
getWebhookInfolast_error_messagein the Telegram panel.Changes
src/backend/services/settings_service.pysrc/backend/routers/settings/generic.pytests/unit/test_3881_public_url_trailing_dot.py(new)Test Plan
cd tests && pytest unit/test_3881_public_url_trailing_dot.py unit/test_2691_public_url_reachability.py unit/test_3215_public_base_url.py unit/test_2380_tls_ask_endpoint.py unit/test_2380_install_provenance.py unit/test_1028_settings_package.py— 219 passed (new test red on all 14 cases before the fix)pytest unit -k "public or telegram or whatsapp or settings or paid"— 1706 passed; the 30 failures (IPv6-mapped URL validation, A2A paid gate) also fail ondevlocallyhttps://<tunnel>.trycloudflare.com., Settings shows it without the dot, TelegramgetWebhookInfohas no SSL errorFixes #3881
🤖 Generated with Claude Code