Skip to content

fix(pairing): let a phone set up an Android TV on a plain-HTTP server - #666

Merged
Quick104 merged 1 commit into
Silo-Server:mainfrom
Rhainland:fix/pairing-http-server-consent
Oct 24, 2026
Merged

Quick104 merged 1 commit into
Silo-Server:mainfrom
Rhainland:fix/pairing-http-server-consent

Conversation

@Rhainland

@Rhainland Rhainland commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Related issue: Silo-Server/silo-server#1192
Validation tasks: unblocks #337 C2 and #336 C1; Silo-Server/silo-apple#326 C1; Silo-Server/silo-server#1193 C2

A phone or tablet can't set up an Android TV when its server uses plain HTTP, which is how most home servers on a LAN address run. The TV user taps Allow, then after about 40 seconds both the TV and the phone say the TV "can't reach" the server. No sign-in request ever reaches the server.

The TV needs its own cleartext approval for every credential-bearing request to a plain-HTTP origin. Manual server entry asks for it ("Connect without encryption?"); phone setup never did. So the TV's POST /api/v2/auth/device/start to the pushed server was refused locally, and the failure surfaced as unreachable.

Approach

When the pushed address is plain HTTP and this TV hasn't approved it, the TV's existing "Allow this setup?" step adds the manual-entry warning: "Your password and what you watch will be sent unencrypted to . Only do this on a network you trust." Allowing approves exactly that origin, then sign-in starts. The TV owner still decides; nothing is approved without that prompt.

A later plain-HTTP server in the same handover asks again instead of riding on the first consent. The phone waits 30 seconds for each later server, so that second ask has to be answered within 30 seconds. Declining it ends the handover, as declining always has; servers already signed in stay signed in. A verified alternate address that is also plain HTTP is not approved by this change.

Validation

  • PairingReceiverTest: allowing a plain-HTTP server approves its origin before sign-in starts, and a later plain-HTTP server in a consented session asks again. Both failed before the change.
  • Android TV emulator set up from an Android tablet and phone with a plain-HTTP server: before, both sides reported "can't reach"; after, the TV showed the warning and signed in.
  • ./gradlew testDebugUnitTest: 6140 tests, one failure, ReflowStyleTest > line height flows from settings, which fails the same way on main.
  • Supply-chain checks, the five lint tasks, and phone and TV debug builds pass.

Evidence

Evidence: https://evidence.siloserver.org/r/silo-android/pr-666/

Surface and build: Android TV emulator (Android 14) set up from a Pixel Tablet emulator (Android 16), TV debug builds from main and this branch, server at the emulator host alias http://10.0.2.2:18241. The change is in the TV app; the phone app is unchanged and shows the same card on phone, tablet and foldable, so the tablet capture stands for all three.

Risks

The TV now accepts a plain-HTTP server through phone setup, after its user reads the same warning manual entry shows. HTTPS servers are unaffected.

Checklist

  • I read and can explain the complete diff.
  • This pull request addresses one concern.
  • The Evidence section shows every change a user can see, or says there is none.

AI Disclosure

  • Harness: Claude Code in T3 Code
  • Tool(s): Claude Code; Codex CLI (second reviewer)
  • Model(s): claude-opus-5-5; gpt-6.1-sol (review only)
  • Involvement: Fully AI-generated, human verified
  • Adversarial review: two rounds of independent review by claude-opus-5-5 and gpt-6.1-sol on correctness, repository standards and the #1192 acceptance criteria. Round 1: the consent store defaulted to null, which could silently disable the gate (now required), and a decline on the second ask ended the whole handover. An attempted per-server decline was reverted after round 2 showed the Android sender still stops on any per-server failure; the timing limit and decline behavior are documented above.

Note

Require TV consent for pairing with plain-HTTP servers

  • Lets a phone set up an Android TV on a plain-HTTP server. PairingReceiver now takes a CleartextConsentStore and pauses with a ConsentRequested state (unencrypted flag set) when a pushed server URL uses an unencrypted origin.
  • On approval, the receiver canonicalizes the HTTP origin, records it in the consent store, then starts the pairing attempt. Already-approved origins still pass through automatically, even in a consented session.
  • The TV pairing panel shows an unencrypted-connection warning with the server host for these requests, with a new string in strings.xml.
  • Behavioral Change: PairingReceiver gains a required CleartextConsentStore constructor parameter — all callers, including the androidTvModule provider and tests in TvLoginScreenNetworkSignInTest.kt, are updated.

Macroscope summarized 9c85c17.

Every credential-bearing request from the TV to a plain-HTTP origin needs
that origin's cleartext approval on the TV. Manual server entry asks for
it, but phone setup never did, so device sign-in against a pushed HTTP
server was refused before it started and the TV and phone both reported
"can't reach" the server. Home servers on a LAN address usually serve
plain HTTP.

The TV's "Allow this setup?" step now says when the pushed address is
unencrypted, with the same warning as manual entry, and allowing it
approves exactly that origin. A later plain-HTTP server in the same
session asks again rather than riding on the first consent.
@silo-kody

silo-kody Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

Silo Kody — review complete

Review finished. Check the inline comments for findings and verify each suggestion against the code and tests.

Reviewing changes in Silo
  • Include the related issue, expected behavior, and validation steps in the PR description.
  • For API changes, describe the effect on Apple and Android clients and Jellyfin compatibility.
  • For plugin changes, identify the affected SDK contract, plugin, and catalog entry.
  • Follow this repository's AGENTS.md and CONTRIBUTING.md.
  • Request another review with @kody start-review in a PR comment.
  • React with 👍 or 👎 to give feedback on individual suggestions.
Review settings
Review Options

The following review options are enabled or disabled:

Options Enabled
Bug ✅
Performance ✅
Security ✅
Business Logic ❌

@coderabbitai

coderabbitai Bot commented Oct 22, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 59 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 8794d9a4-7d6e-4637-bc9c-fd58c5882f75
📥 Commits

Reviewing files that changed from the base of the PR and between ff53561 and 9c85c17.

📒 Files selected for processing: 6
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/pairing/PairingReceiver.kt
  • android-shared/src/androidUnitTest/kotlin/org/siloserver/silo/common/pairing/PairingReceiverTest.kt
  • androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/di/AndroidTvModule.kt
  • androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/auth/TvPairingPanel.kt
  • androidTvApp/src/androidMain/res/values/strings.xml
  • androidTvApp/src/androidUnitTest/kotlin/org/siloserver/silo/tv/ui/screens/auth/TvLoginScreenNetworkSignInTest.kt
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@silo-triage silo-triage Bot added the size/M 50–199 added + deleted lines (all files); change volume, not priority. label Oct 22, 2026
@macroscopeapp

macroscopeapp Bot commented Oct 22, 2026

Copy link
Copy Markdown

The plain-HTTP warning and repeat consent during pairing (PairingReceiver.kt, TvPairingPanel.kt, and strings.xml) reach Android TV only. Evidence is missing: the Evidence section says “pending” and contains no captures or recording.

Suggested fix: Add before-and-after captures of the same TV consent screen and a recording of the multi-step phone-to-TV pairing flow, naming the TV device and build or commit.

Automated check: Macroscope check run agent (gpt-6-luna). Evidence was not reviewed for correctness.

Posted via Macroscope — Visible change evidence

@silo-triage silo-triage Bot added bug Something isn't working impact: usability Core flow broken or severely blocked priority: P1 Core-path bug; painful workaround — next after P0 labels Oct 22, 2026
@Rhainland

Copy link
Copy Markdown
Contributor Author

Evidence is now published: https://evidence.siloserver.org/r/silo-android/pr-666/ (the Evidence check passes). It has before and after captures of the same TV consent screen, of the TV after Allow, and of the tablet's result, with the TV built from main and from this branch. The PR body names the devices and builds.

A recording isn't included: the change adds one warning line to the consent step and lets the flow finish. It doesn't change motion, timing or focus, and the evidence has a still of each step that differs.

@Quick104
Quick104 merged commit 4a239ad into Silo-Server:main Oct 24, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working impact: usability Core flow broken or severely blocked priority: P1 Core-path bug; painful workaround — next after P0 size/M 50–199 added + deleted lines (all files); change volume, not priority.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants