Skip to content

fix: only look up YouTube URLs when adding channels and playlists - #1076

Open
mkulina wants to merge 4 commits into
devfrom
fix/restrict-channel-playlist-urls
Open

mkulina wants to merge 4 commits into
devfrom
fix/restrict-channel-playlist-urls

Conversation

@mkulina

@mkulina mkulina commented Nov 25, 2026 •

Copy link
Copy Markdown
Collaborator

Adding a channel or a playlist handed whatever URL you typed to yt-dlp. yt-dlp will fetch any address, so anyone signed in to Youtarr could make the server request other sites or addresses on its own network, such as http://127.0.0.1:9911/. The channel id that came back was also saved as is and later used in file paths.

Youtarr now only looks up YouTube addresses:

  • Channels (add channel, subscription import, Takeout import) accept youtube.com, its subdomains and youtu.be. Anything else gets a 400 with "Enter a YouTube channel URL."
  • Playlists accept the same, or a bare playlist id.
  • yt-dlp receives the parsed URL, because yt-dlp and Node can read the same text as different hosts (https://www.youtube.com\@127.0.0.1:9911/).
  • A channel id that does not look like a YouTube id or handle is refused before anything is saved.
  • The channel or playlist URL yt-dlp reports back gets the same check before it is saved, since later refreshes fetch it again.

You need to be signed in to use any of this, so the risk is low.

Found with Claude Mythos during a security review of the repo.

Proof: lint, typecheck and both test suites pass locally. On a dev instance the internal and lookalike URLs returned 400 and a listener inside the container saw no request, while a real channel, a playlist URL, a URL without a scheme and a bare playlist id still loaded.

Council review

Rounds: 3

Delegate Round 1 Round 2 Round 3
Claude Opus 7/10 8.5/10 8.5/10
Cline Pass (Kimi K3.1 Pro) 7/10 9/10 9.5/10

Round 1 found that the channel lookup checked the URL but fetched the original text, that the playlist page URL was stored unchecked, and that a trailing dot and some handles in other scripts were refused. Round 2 confirmed those fixes and pointed out that the channel URL yt-dlp reports back was still stored as is, which round 3 covers. In round 3 Opus noticed the two refresh paths would save a handle in another script in two different forms and rewrite it back and forth. The last commit makes them agree. That last one line change was not sent back for a fourth round.

Adding a channel or playlist passed whatever URL it was given to yt-dlp,
so a signed-in user could make the server request any address, including
ones on the internal network. The channel id that came back was stored
unchecked and later built into file paths.

Both lookups now accept YouTube URLs only (a bare playlist id still
works), and a channel id that is not a YouTube id or handle is refused.
The channel lookup checked the URL and then fetched the original text,
which yt-dlp can read as a different host than Node does. It now fetches
the parsed form, as the playlist lookup already did. The page URL yt-dlp
reports for a playlist gets the same check before it is stored, a host
with a trailing dot is accepted, and channel ids may contain combining
marks and the middle dot that YouTube handles allow.
@github-actions

github-actions Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

📊 Test Coverage Report

Backend Coverage

Type Coverage Status
Lines 91.22% 🟢
Statements 90.87% 🟢
Functions 90.30% 🟢
Branches 86.37% 🟢

Frontend Coverage

Type Coverage Status
Lines 91.41% 🟢
Statements 89.94% 🟢
Functions 84.61% 🟢
Branches 84.44% 🟢

Coverage Requirements

  • Minimum threshold: 70% line coverage
  • Backend: ✅ Passes
  • Frontend: ✅ Passes

Coverage report generated for commit a26a140

@mkulina
mkulina requested a review from dialmaster November 25, 2026 04:24
The URL yt-dlp returns for a channel is saved and fetched again by later
refreshes. It now gets the same YouTube check as the URL the user typed,
both when a channel is added and when a listing updates its URL.
The tab refresh now saves the parsed URL, which encodes handles written
in other scripts. The full listing still saved the raw text, so the two
would have rewritten such a channel's URL back and forth.

This branch has not been deployed

No deployments
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.

1 participant